|
|
|
@ -157,7 +157,9 @@ |
|
|
|
psk (storage/get-psk pid)] |
|
|
|
psk (storage/get-psk pid)] |
|
|
|
(if (storage/valid-publisher? pid) |
|
|
|
(if (storage/valid-publisher? pid) |
|
|
|
(let [resp (api/post-note note pid (api/get-signature (str pid psk note)) password)] |
|
|
|
(let [resp (api/post-note note pid (api/get-signature (str pid psk note)) password)] |
|
|
|
(if (get-in resp [:status :success]) |
|
|
|
(if (and |
|
|
|
|
|
|
|
(storage/invalidate-session session) |
|
|
|
|
|
|
|
(get-in resp [:status :success])) |
|
|
|
(redirect (:longURL resp)) |
|
|
|
(redirect (:longURL resp)) |
|
|
|
(response 400))) |
|
|
|
(response 400))) |
|
|
|
(response 500))) |
|
|
|
(response 500))) |
|
|
|
@ -179,8 +181,8 @@ |
|
|
|
; Here lives the API |
|
|
|
; Here lives the API |
|
|
|
|
|
|
|
|
|
|
|
(defpage "/api" args |
|
|
|
(defpage "/api" args |
|
|
|
(let [title (get-message :api-title)] |
|
|
|
(layout (get-message :api-title) |
|
|
|
(layout title [:article.markdown (slurp "API.md")]))) |
|
|
|
[:article.markdown (slurp "API.md")])) |
|
|
|
|
|
|
|
|
|
|
|
(defpage [:get "/api/note"] {:keys [version noteID]} |
|
|
|
(defpage [:get "/api/note"] {:keys [version noteID]} |
|
|
|
(generate-string (api/get-note noteID))) |
|
|
|
(generate-string (api/get-note noteID))) |
|
|
|
@ -190,4 +192,3 @@ |
|
|
|
|
|
|
|
|
|
|
|
(defpage [:put "/api/note"] {:keys [version noteID note pid signature password]} |
|
|
|
(defpage [:put "/api/note"] {:keys [version noteID note pid signature password]} |
|
|
|
(generate-string (api/update-note noteID note pid signature password))) |
|
|
|
(generate-string (api/update-note noteID note pid signature password))) |
|
|
|
|
|
|
|
|
|
|
|
|