Added server url in main args

This commit is contained in:
Simon Cambier 2024-06-23 22:31:47 +02:00
parent a68c822cb5
commit 15ae3f241f
2 changed files with 14 additions and 6 deletions

View File

@ -23,9 +23,11 @@ Most of these values will be in the form of `key:: value` for easy integration w
- Run the program
```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
- Clone this repository
@ -33,7 +35,7 @@ $ ./mastodon-bookmarks YOUR_APP_TOKEN
- `jpm deps --local`
```sh
$ janet main.janet YOUR_APP_TOKEN
$ janet main.janet YOUR_INSTANCE YOUR_APP_TOKEN
```
## Build binary

View File

@ -2,9 +2,11 @@
(import spork/json :as json)
(import ./utils :as utils)
(var server "")
(var apptoken "")
(var dbg false)
(def urls @["https://hachyderm.io/api/v1/bookmarks"])
(def urls @[])
(def save-path "./bookmarks/")
(def done @[])
@ -65,7 +67,7 @@
(do
(print "Done")
(os/exit 0)))
(print (string "Downloading " url))
(def response
(r/get url {"Authorization" (string "Bearer " apptoken)} {}))
@ -96,8 +98,12 @@
(defn main [& args]
(set apptoken (or (os/getenv "TOKEN") (args 1)))
(set dbg (get args 2))
(set server (args 1))
(set apptoken (args 2))
(set dbg (get args 3))
(array/push urls (string server "/api/v1/bookmarks"))
(os/mkdir "./bookmarks")
(os/mkdir "./bookmarks/attachments")
(download-bookmarks))