diff --git a/README.md b/README.md index 92de6d0..69446d6 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,14 @@ -# padArchiver -Tool to store a pad (from the link) into IPFS and Git. +# padArchiver [![Go Report Card](https://goreportcard.com/badge/github.com/arnaucode/padArchiver)](https://goreportcard.com/report/github.com/arnaucode/padArchiver) -All the necessary files are in the /build directory. +Tool to store pads (from url) into local directory and IPFS. + +The tool is composed by different tools around the library: +- webServer +- listPadsImporter +- apiServer +- cli + +All the necessary files are in the /build directory. Can be build using the 'bash build.sh' script. ## 1.- webServer This is a webserver that automatically generates a web from the pads directories and files stored. @@ -10,6 +17,10 @@ To run, inside 'build' directory: ./webServer ``` +![padArchiver-webServer](https://raw.githubusercontent.com/arnaucode/padArchiver/master/padArchiver-webServer.gif) + +The html template can be easily changed. + ## 2.- listPadsImporter This is to import all pads from the json file 'list.json'. Just need to edit the json file, for example: @@ -116,3 +127,5 @@ To run the CLI, just need to run inside the directory 'build': ./padArchiver-cli ``` And follow the instructions. + +![padArchiver-cli](https://raw.githubusercontent.com/arnaucode/padArchiver/master/padArchiver-cli.png) diff --git a/apiServer/apiServer b/apiServer/apiServer index 653fb4b..42d7885 100755 Binary files a/apiServer/apiServer and b/apiServer/apiServer differ diff --git a/apiServer/main.go b/apiServer/main.go index 6398a75..6f5ff62 100644 --- a/apiServer/main.go +++ b/apiServer/main.go @@ -13,12 +13,15 @@ import ( "github.com/gorilla/mux" ) +//PadModel is the data structure for each pad type PadModel struct { Link string `json:"link"` Dir string `json:"dir"` Title string `json:"title"` IpfsHash string `json:"ipfsHash"` } + +//Repo contains all the pads --currently not used-- type Repo struct { Pads []string `json:"pads"` } @@ -37,6 +40,7 @@ func main() { log.Fatal(http.ListenAndServe(":"+config.Port, router)) } +//GetReposList is the endpoint to get the list of current repos func GetReposList(w http.ResponseWriter, r *http.Request) { file, err := os.Open(padArchiver.Storage) if err != nil { @@ -56,6 +60,7 @@ func GetReposList(w http.ResponseWriter, r *http.Request) { fmt.Fprintln(w, string(jResp)) } +//GetRepoIDList is the endpoint to get one repo by id func GetRepoIDList(w http.ResponseWriter, r *http.Request) { vars := mux.Vars(r) repoid := vars["repoid"] @@ -74,6 +79,8 @@ func GetRepoIDList(w http.ResponseWriter, r *http.Request) { check(err) fmt.Fprintln(w, string(jResp)) } + +//PostStorePad is the endpoint to post the signal to store one pad func PostStorePad(w http.ResponseWriter, r *http.Request) { vars := mux.Vars(r) repoid := vars["repoid"] diff --git a/apiServer/readConfig.go b/apiServer/readConfig.go index 14fd1ad..c604ace 100644 --- a/apiServer/readConfig.go +++ b/apiServer/readConfig.go @@ -5,6 +5,7 @@ import ( "io/ioutil" ) +//Config is the configuration of the API server type Config struct { Port string `json:"port"` } diff --git a/build/apiServer b/build/apiServer index 653fb4b..42d7885 100755 Binary files a/build/apiServer and b/build/apiServer differ diff --git a/build/cli b/build/cli index 8829e45..17eb60e 100755 Binary files a/build/cli and b/build/cli differ diff --git a/build/listPadsImporter b/build/listPadsImporter index 13459ac..5b6f9ac 100755 Binary files a/build/listPadsImporter and b/build/listPadsImporter differ diff --git a/build/templates/menuTemplate.html b/build/templates/menuTemplate.html index 05f1567..9a2b338 100644 --- a/build/templates/menuTemplate.html +++ b/build/templates/menuTemplate.html @@ -1,6 +1,6 @@