You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

116 lines
1.9 KiB

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