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)]]))
|
[::xspf/location (:url file)]])) statuses)]]))
|
||||||
|
|
||||||
(defn app [req]
|
(defn app [req]
|
||||||
(let [instance-url (if (not= "/" (:uri req))
|
(if (= "/" (:uri req))
|
||||||
(str "https://"
|
{: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 (:uri req) #"^/" "")
|
||||||
(str/replace #".xspf$" "")))
|
(str/replace #".xspf$" "")))
|
||||||
"https://post.lurk.org")
|
|
||||||
token (some-> (:body req) (slurp) (json/parse-string true) :token)
|
token (some-> (:body req) (slurp) (json/parse-string true) :token)
|
||||||
statuses (fetch-loops instance-url token)]
|
statuses (fetch-loops instance-url token)]
|
||||||
{:status 200
|
{:status 200
|
||||||
:headers {"Content-Type" "application/xspf+xml"}
|
:headers {"Content-Type" "application/xspf+xml"}
|
||||||
:body (xml/indent-str (->xspf statuses))}))
|
:body (xml/indent-str (->xspf statuses))})))
|
||||||
|
|
||||||
(defonce server
|
(defonce server
|
||||||
(atom nil))
|
(atom nil))
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue