Added server url in main args
This commit is contained in:
parent
a68c822cb5
commit
15ae3f241f
|
@ -23,9 +23,11 @@ Most of these values will be in the form of `key:: value` for easy integration w
|
||||||
- Run the program
|
- Run the program
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
$ ./mastodon-bookmarks YOUR_APP_TOKEN
|
$ ./mastodon-bookmarks YOUR_INSTANCE YOUR_APP_TOKEN
|
||||||
```
|
```
|
||||||
|
|
||||||
|
The `YOUR_INSTANCE` value must not have trailing slash (e.g: `https://hachyderm.io`)
|
||||||
|
|
||||||
## Development
|
## Development
|
||||||
|
|
||||||
- Clone this repository
|
- Clone this repository
|
||||||
|
@ -33,7 +35,7 @@ $ ./mastodon-bookmarks YOUR_APP_TOKEN
|
||||||
- `jpm deps --local`
|
- `jpm deps --local`
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
$ janet main.janet YOUR_APP_TOKEN
|
$ janet main.janet YOUR_INSTANCE YOUR_APP_TOKEN
|
||||||
```
|
```
|
||||||
|
|
||||||
## Build binary
|
## Build binary
|
||||||
|
|
14
main.janet
14
main.janet
|
@ -2,9 +2,11 @@
|
||||||
(import spork/json :as json)
|
(import spork/json :as json)
|
||||||
(import ./utils :as utils)
|
(import ./utils :as utils)
|
||||||
|
|
||||||
|
(var server "")
|
||||||
(var apptoken "")
|
(var apptoken "")
|
||||||
(var dbg false)
|
(var dbg false)
|
||||||
(def urls @["https://hachyderm.io/api/v1/bookmarks"])
|
|
||||||
|
(def urls @[])
|
||||||
(def save-path "./bookmarks/")
|
(def save-path "./bookmarks/")
|
||||||
(def done @[])
|
(def done @[])
|
||||||
|
|
||||||
|
@ -65,7 +67,7 @@
|
||||||
(do
|
(do
|
||||||
(print "Done")
|
(print "Done")
|
||||||
(os/exit 0)))
|
(os/exit 0)))
|
||||||
|
|
||||||
(print (string "Downloading " url))
|
(print (string "Downloading " url))
|
||||||
(def response
|
(def response
|
||||||
(r/get url {"Authorization" (string "Bearer " apptoken)} {}))
|
(r/get url {"Authorization" (string "Bearer " apptoken)} {}))
|
||||||
|
@ -96,8 +98,12 @@
|
||||||
|
|
||||||
|
|
||||||
(defn main [& args]
|
(defn main [& args]
|
||||||
(set apptoken (or (os/getenv "TOKEN") (args 1)))
|
(set server (args 1))
|
||||||
(set dbg (get args 2))
|
(set apptoken (args 2))
|
||||||
|
(set dbg (get args 3))
|
||||||
|
|
||||||
|
(array/push urls (string server "/api/v1/bookmarks"))
|
||||||
|
|
||||||
(os/mkdir "./bookmarks")
|
(os/mkdir "./bookmarks")
|
||||||
(os/mkdir "./bookmarks/attachments")
|
(os/mkdir "./bookmarks/attachments")
|
||||||
(download-bookmarks))
|
(download-bookmarks))
|
||||||
|
|
Loading…
Reference in New Issue
Block a user