mirror of
https://github.com/penpot/penpot.git
synced 2025-06-07 03:21:38 +02:00
Merge pull request #3169 from penpot/niwinz-enhancements-2
✨ Add the abiltiy to forward command params as query-string
This commit is contained in:
commit
d97bbdf140
2 changed files with 15 additions and 3 deletions
|
@ -78,6 +78,7 @@
|
||||||
:xnio/worker-threads (or (::worker-threads cfg)
|
:xnio/worker-threads (or (::worker-threads cfg)
|
||||||
(max 6 (px/get-available-processors)))
|
(max 6 (px/get-available-processors)))
|
||||||
:xnio/dispatch true
|
:xnio/dispatch true
|
||||||
|
:socket/backlog 4069
|
||||||
:ring/async true}
|
:ring/async true}
|
||||||
|
|
||||||
handler (cond
|
handler (cond
|
||||||
|
|
|
@ -97,7 +97,7 @@
|
||||||
(defn- send-command!
|
(defn- send-command!
|
||||||
"A simple helper for a common case of sending and receiving transit
|
"A simple helper for a common case of sending and receiving transit
|
||||||
data to the penpot mutation api."
|
data to the penpot mutation api."
|
||||||
[id params {:keys [response-type form-data? raw-transit?]}]
|
[id params {:keys [response-type form-data? raw-transit? forward-query-params]}]
|
||||||
(let [decode-fn (if raw-transit?
|
(let [decode-fn (if raw-transit?
|
||||||
http/conditional-error-decode-transit
|
http/conditional-error-decode-transit
|
||||||
http/conditional-decode-transit)
|
http/conditional-decode-transit)
|
||||||
|
@ -111,8 +111,11 @@
|
||||||
(if form-data?
|
(if form-data?
|
||||||
(http/form-data params)
|
(http/form-data params)
|
||||||
(http/transit-data params)))
|
(http/transit-data params)))
|
||||||
:query (when (= method :get)
|
:query (if (= method :get)
|
||||||
params)
|
params
|
||||||
|
(if forward-query-params
|
||||||
|
(select-keys params forward-query-params)
|
||||||
|
nil))
|
||||||
:response-type (or response-type :text)})
|
:response-type (or response-type :text)})
|
||||||
(rx/map decode-fn)
|
(rx/map decode-fn)
|
||||||
(rx/mapcat handle-response))))
|
(rx/mapcat handle-response))))
|
||||||
|
@ -139,6 +142,14 @@
|
||||||
[id params]
|
[id params]
|
||||||
(send-command! id params nil))
|
(send-command! id params nil))
|
||||||
|
|
||||||
|
(defmethod command :update-file
|
||||||
|
[id params]
|
||||||
|
(send-command! id params {:forward-query-params [:id]}))
|
||||||
|
|
||||||
|
(defmethod command :upsert-file-object-thumbnail
|
||||||
|
[id params]
|
||||||
|
(send-command! id params {:forward-query-params [:file-id :object-id]}))
|
||||||
|
|
||||||
(defmethod command :export-binfile
|
(defmethod command :export-binfile
|
||||||
[id params]
|
[id params]
|
||||||
(send-command! id params {:response-type :blob}))
|
(send-command! id params {:response-type :blob}))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue