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