deprecated all API versions less than 1.4
This commit is contained in:
+5
-25
@@ -64,23 +64,7 @@
|
||||
(let [req-version (Double/parseDouble req-version)
|
||||
version (Double/parseDouble version)]
|
||||
(if (< req-version version)
|
||||
(let [args params
|
||||
args (if (and (:noteID args) (< req-version 1.3))
|
||||
(assoc args
|
||||
:noteID (sreplace (args :noteID) #" " "/")
|
||||
:noteID* (args :noteID))
|
||||
args)
|
||||
args (if (and (:note args) (< req-version 1.4))
|
||||
(assoc args :note* (sreplace (args :note) #"[\n\r]" ""))
|
||||
args)
|
||||
resp (f args)
|
||||
server-message (get-in resp [:status :message])]
|
||||
(assoc-in resp [:status :message]
|
||||
(str
|
||||
server-message
|
||||
(when server-message "; ")
|
||||
"this API version is deprecated and "
|
||||
"will be disabled by the end of June 2014!")))
|
||||
{:status (create-response false "Deprecated API version")}
|
||||
(f params)))
|
||||
{:status (create-response false "API version expected")}))
|
||||
|
||||
@@ -98,12 +82,11 @@
|
||||
{:status (create-response false "noteID '%s' unknown" noteID)}))
|
||||
|
||||
(defn post-note
|
||||
[{:keys [note pid signature password note*] :as params}]
|
||||
[{:keys [note pid signature password] :as params}]
|
||||
;(log "post-note: %s" {:pid pid :signature signature :password password :note note})
|
||||
(let [errors (filter identity
|
||||
[(when-not (storage/valid-publisher? pid) "pid invalid")
|
||||
; TODO: remove note* after June 2014
|
||||
(when-not (= signature (storage/sign pid (storage/get-psk pid) (or note* note)))
|
||||
(when-not (= signature (storage/sign pid (storage/get-psk pid) note))
|
||||
"signature invalid")
|
||||
(when (blank? note) "note is empty")])]
|
||||
(if (empty? errors)
|
||||
@@ -129,14 +112,11 @@
|
||||
{:status (create-response false (first errors))})))
|
||||
|
||||
|
||||
(defn update-note [{:keys [noteID note pid signature password noteID* note*]}]
|
||||
(defn update-note [{:keys [noteID note pid signature password]}]
|
||||
;(log "update-note: %s" {:pid pid :noteID noteID :signature signature :password password :note note})
|
||||
(let [errors (filter identity
|
||||
[(when-not (storage/valid-publisher? pid) "pid invalid")
|
||||
; TODO: noteID* is a hack introduced by backwards-comp. to older APIs
|
||||
(when-not (= signature (storage/sign pid (storage/get-psk pid) (or noteID* noteID)
|
||||
; TODO: remove note* after June 2014
|
||||
(or note* note) password))
|
||||
(when-not (= signature (storage/sign pid (storage/get-psk pid) noteID note password))
|
||||
"signature invalid")
|
||||
(when (blank? note) "note is empty")
|
||||
(when-not (storage/valid-password? noteID password) "password invalid")])]
|
||||
|
||||
@@ -133,6 +133,7 @@
|
||||
url))))
|
||||
|
||||
(defn gc [password dry]
|
||||
(println (get-setting :admin-pw))
|
||||
(when (= password (get-setting :admin-pw))
|
||||
(let [N 30
|
||||
timestamp (- (get-current-date) (* N 24 60 60 1000))
|
||||
|
||||
Reference in New Issue
Block a user