padArchiver/README.md
README.mdRaw
1# padArchiver
2Tool to store a pad (from the link) into IPFS and Git.
3
4## webServer
5This is a webserver that automatically generates a web from the pads directories and files stored.
6To run:
7```
8./webServer
9```
10
11## listPadsImporter
12This is to import all pads from the json file 'list.json'.
13Just need to edit the json file, for example:
14```json
15{
16 "repoid": "repo01",
17 "pads": [
18 {
19 "link": "http://board.net/p/pad1",
20 "dir": "Group1",
21 "title": "Pad1"
22 },
23 {
24 "link": "http://board.net/p/pad2",
25 "dir": "Group1",
26 "title": "Pad2"
27 },
28 {
29 "link": "http://board.net/p/pad3",
30 "dir": "Group2",
31 "title": "Pad3"
32 }
33 ]
34}
35```
36And then execute the importer:
37```
38./importFromList
39```
40
41## apiServer
42This is an API to run in localhost.
43
44#### Run
45To run using the compiled binary:
46- The Git repo needs to be initialized, and with the remote already configured.
47- The IPFS daemon needs to be running:
48```
49> ipfs daemon
50```
51
52- Edit the file config.json to configure the desired port:
53```
54{
55 "port": "3080"
56}
57```
58
59- Execute the API server:
60```
61> ./padArchiver-APIserver
62```
63
64#### API Routes
65
66##### - GET /repos
67this returns:
68```
69[
70 'repo01',
71 'repo02'
72]
73```
74
75
76##### - GET /repos/{repoid}
77this returns:
78```
79[
80 'repo01',
81 'repo01/Group1',
82 'repo01/Group1/Pad1.md',
83 'repo01/Group2',
84 'repo01/Group2/Pad2.md',
85 'repo01/Group2/Pad3.md',
86 'repo02/GroupA/Pad1.md'
87]
88```
89
90
91##### - POST /repos/{repoid}/pad
92data to send:
93```
94json: {
95 "link": "http://board.net/p/pad1",
96 "dir": "Group1",
97 "title": "Pad1"
98}
99```
100this returns:
101```
102{
103 "link": "http://board.net/p/pad1",
104 "dir": "Group1",
105 "title": "Pad1",
106 "ipfsHash": "QmVyp4JSREK5syLmNRCafkZkhzC7CfvS9qYWKfvfffqK2B"
107}
108```
109The IPFS hash is also added to the first line of the document, before adding the document to Git.
110
111## cli
112To run the CLI, just need to run:
113```
114./padArchiver-cli
115```
116And follow the instructions.