Skip to content

Commit 348cec9

Browse files
committed
All the files
1 parent dff68cb commit 348cec9

File tree

18 files changed

+295
-0
lines changed

18 files changed

+295
-0
lines changed

TODO.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
MULTI USER CVS SYSTEM
2+
3+
// USERS LOGIN VIA METAMASK
4+
5+
// FETCH ORGINAL FILES FROM IPFS
6+
// EVERY USER CLONE AND EDIT UNIQUE COPY OF FILE
7+
// ONE USERS FILE NEEDS TO BE SELECTED BEFORE COMMIT
8+
// UPLOAD TEMP VERSIONS TO IPFS
9+
// LINK WITH METADATA
10+
// LIST VERSIONS

contracts/Main.sol

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pragma solidity ^0.4.2;
2+
3+
contract Main {
4+
// STUFF
5+
}

contracts/Migrations.sol

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
pragma solidity ^0.4.2;
2+
3+
contract Migrations {
4+
address public owner;
5+
uint public last_completed_migration;
6+
7+
modifier restricted() {
8+
if (msg.sender == owner) _;
9+
}
10+
11+
function constructor() public {
12+
owner = msg.sender;
13+
}
14+
15+
function setCompleted(uint completed) restricted public {
16+
last_completed_migration = completed;
17+
}
18+
19+
function upgrade(address new_address) restricted public {
20+
Migrations upgraded = Migrations(new_address);
21+
upgraded.setCompleted(last_completed_migration);
22+
}
23+
}

deploy.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
rm -rf build/contracts/
2+
truffle migrate
3+
#truffle console

index.html

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<head>
2+
<meta charset="utf-8">
3+
<title>IPFS Testing</title>
4+
<link rel="stylesheet" href="interface/styles.css" type="text/css">
5+
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
6+
<!-- <script src="js/ipfs.js"></script> -->
7+
</head>
8+
<body>
9+
<div id="files"></div>
10+
</body>
11+
<script src="js/app.js"></script>

interface/fonts/main.woff

21.4 KB
Binary file not shown.

interface/styles.css

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
@font-face {
2+
font-family: 'Open Sans';
3+
src: url('fonts/main.woff');
4+
}
5+
6+
body {
7+
font: 13px 'Open Sans', verdana;
8+
color: #505050;
9+
margin: 0px;
10+
padding: 30px;
11+
}
12+
13+
a:link, a:visited, a:hover {
14+
color: #505050;
15+
text-decoration: none;
16+
-o-transition: .2s;
17+
-ms-transition: .2s;
18+
-moz-transition: .2s;
19+
-webkit-transition: .2s;
20+
transition: .2s;
21+
}
22+
23+
a:hover {
24+
text-decoration: underline;
25+
}
26+
27+
table {
28+
width: 100%;
29+
border-spacing: 0px;
30+
font: inherit;
31+
color: inherit;
32+
padding: 0px;
33+
margin: 0px;
34+
}
35+
36+
td {
37+
vertical-align: top;
38+
margin: 0px;
39+
padding: 0px;
40+
}
41+
42+
#files table tr#header {
43+
background: #CECECE;
44+
text-transform: uppercase;
45+
}
46+
47+
#files table tr#content {
48+
background: #F1F1F1;
49+
}
50+
51+
#files table td {
52+
width: 50%;
53+
padding: 8px;
54+
border-bottom: 4px solid white;
55+
}
56+
57+
#files table td:nth-child(2) {
58+
text-align: right;
59+
}

ipfs.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
ipfs swarm peers
2+
ipfs add -r .
3+
echo "Directory Hash?"
4+
read hash
5+
echo "Publishing....."
6+
ipfs name publish $hash

js/app.js

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
renderFiles();
2+
3+
function renderFiles() {
4+
5+
// CONTENT OBJECT
6+
var content = $.ajax({
7+
url: "js/content.json",
8+
async: false,
9+
dataType: 'json'
10+
}).responseJSON;
11+
12+
// DIRECTORY KEYS
13+
var directories = Object.keys(content);
14+
var links = '';
15+
16+
// LOOP THROUGH DIRECTORY LIST
17+
for (var x = 0; x < directories.length; x++) {
18+
var dir_name = directories[x];
19+
var dir_content = content[directories[x]];
20+
21+
// TABLE ELEMENTS
22+
var header = '<table><tr id="header"><td>' + dir_name + '</td></tr>';
23+
var footer = '</table>';
24+
25+
// FILE KEYS
26+
var files = Object.keys(dir_content);
27+
var rows = '';
28+
29+
// LOOP THROUGH FILES
30+
for (var y = 0; y < files.length; y++) {
31+
var file = files[y];
32+
var base = dir_content[file];
33+
34+
// GENERATE ROW AND APPEND PARENT
35+
var row = '<tr id="content"><td><a href="https://ipfs.io/ipfs/' + base.hash + '"><div>' + base.name + '</div></a></td></tr>';
36+
rows += row;
37+
}
38+
39+
// GENERATE TABLE AND APPEND PARENT
40+
var table = header + rows + footer;
41+
links += table;
42+
}
43+
44+
// RENDER TO SELECTOR
45+
$('#files').html(links);
46+
}
47+
48+
function log(stuff) {
49+
console.log(stuff);
50+
}

js/app_old.js

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
// UNCOMMENT IPFS LIBRARY @INDEX
2+
3+
const ipfs = new Ipfs({
4+
config: {
5+
Addresses: {
6+
Swarm: [
7+
'/dns4/ws-star.discovery.libp2p.io/tcp/443/wss/p2p-websocket-star/ipfs/QmZBAWZqfCTvBGqjiYLpp19MC2srkhdJWaUoUFY42JsCuS'
8+
]
9+
}
10+
}
11+
});
12+
13+
ipfs.on('ready', () => {
14+
15+
// QmQ2r6iMNpky5f1m4cnm3Yqw8VSvjuKpTcK1X7dBR1LkJF
16+
const validCID = 'QmXZG9SDe4xqo6FtBQ1EFdtidwL8pV3RNb8UAeJd8o66ec';
17+
$('body').html('<a href="https://ipfs.io/ipfs/' + validCID + '">' + validCID + '</a>')
18+
19+
/* ipfs.ls(validCID, function (err, files) {
20+
log(files);
21+
files.forEach((file) => {
22+
console.log(file.path)
23+
})
24+
}) */
25+
26+
ipfs.files.cat(validCID, function (err, file) {
27+
if (err) {
28+
throw err
29+
}
30+
31+
console.log(file.toString('utf8'))
32+
})
33+
34+
});
35+
36+
function log(stuff) {
37+
console.log(stuff);
38+
}

0 commit comments

Comments
 (0)