Do not set default instance
This commit is contained in:
parent
0a253575ea
commit
51b7139e80
1 changed files with 10 additions and 8 deletions
|
|
@ -78,16 +78,18 @@
|
|||
[::xspf/location (:url file)]])) statuses)]]))
|
||||
|
||||
(defn app [req]
|
||||
(let [instance-url (if (not= "/" (:uri req))
|
||||
(str "https://"
|
||||
(if (= "/" (:uri req))
|
||||
{:status 400
|
||||
:headers {"Content-Type" "text/plain"}
|
||||
:body "Please use the path to set an instance URL, for example /merveilles.town.xspf."}
|
||||
(let [instance-url (str "https://"
|
||||
(-> (str/replace (:uri req) #"^/" "")
|
||||
(str/replace #".xspf$" "")))
|
||||
"https://post.lurk.org")
|
||||
token (some-> (:body req) (slurp) (json/parse-string true) :token)
|
||||
statuses (fetch-loops instance-url token)]
|
||||
{:status 200
|
||||
:headers {"Content-Type" "application/xspf+xml"}
|
||||
:body (xml/indent-str (->xspf statuses))}))
|
||||
token (some-> (:body req) (slurp) (json/parse-string true) :token)
|
||||
statuses (fetch-loops instance-url token)]
|
||||
{:status 200
|
||||
:headers {"Content-Type" "application/xspf+xml"}
|
||||
:body (xml/indent-str (->xspf statuses))})))
|
||||
|
||||
(defonce server
|
||||
(atom nil))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue