mirror of
https://github.com/penpot/penpot.git
synced 2025-06-07 06:31:37 +02:00
✨ Improve public-uri handling
This enables use penpot under subdirectory
This commit is contained in:
parent
ee1058950e
commit
a1fccd46ff
16 changed files with 73 additions and 58 deletions
|
@ -43,8 +43,6 @@
|
|||
:status status
|
||||
:data body})))
|
||||
|
||||
(def ^:private base-uri cf/public-uri)
|
||||
|
||||
(defn- send-query!
|
||||
"A simple helper for send and receive transit data on the penpot
|
||||
query api."
|
||||
|
@ -56,7 +54,7 @@
|
|||
http/conditional-error-decode-transit
|
||||
http/conditional-decode-transit)]
|
||||
(->> (http/send! {:method :get
|
||||
:uri (u/join base-uri "api/rpc/query/" (name id))
|
||||
:uri (u/join @cf/public-uri "api/rpc/query/" (name id))
|
||||
:credentials "include"
|
||||
:query params})
|
||||
(rx/map decode-transit)
|
||||
|
@ -67,7 +65,7 @@
|
|||
data to the penpot mutation api."
|
||||
[id params]
|
||||
(->> (http/send! {:method :post
|
||||
:uri (u/join base-uri "api/rpc/mutation/" (name id))
|
||||
:uri (u/join @cf/public-uri "api/rpc/mutation/" (name id))
|
||||
:credentials "include"
|
||||
:body (http/transit-data params)})
|
||||
(rx/map http/conditional-decode-transit)
|
||||
|
@ -78,7 +76,7 @@
|
|||
data to the penpot mutation api."
|
||||
[id params {:keys [response-type form-data?]}]
|
||||
(->> (http/send! {:method :post
|
||||
:uri (u/join base-uri "api/rpc/command/" (name id))
|
||||
:uri (u/join @cf/public-uri "api/rpc/command/" (name id))
|
||||
:credentials "include"
|
||||
:body (if form-data? (http/form-data params) (http/transit-data params))
|
||||
:response-type (or response-type :text)})
|
||||
|
@ -133,7 +131,7 @@
|
|||
|
||||
(defmethod command :login-with-oidc
|
||||
[_ {:keys [provider] :as params}]
|
||||
(let [uri (u/join base-uri "api/auth/oauth/" (d/name provider))
|
||||
(let [uri (u/join @cf/public-uri "api/auth/oauth/" (d/name provider))
|
||||
params (dissoc params :provider)]
|
||||
(->> (http/send! {:method :post
|
||||
:uri uri
|
||||
|
@ -145,7 +143,7 @@
|
|||
(defmethod command :send-feedback
|
||||
[_ params]
|
||||
(->> (http/send! {:method :post
|
||||
:uri (u/join base-uri "api/feedback")
|
||||
:uri (u/join @cf/public-uri "api/feedback")
|
||||
:credentials "include"
|
||||
:body (http/transit-data params)})
|
||||
(rx/map http/conditional-decode-transit)
|
||||
|
@ -154,7 +152,7 @@
|
|||
(defn- send-export
|
||||
[{:keys [blob?] :as params}]
|
||||
(->> (http/send! {:method :post
|
||||
:uri (u/join base-uri "api/export")
|
||||
:uri (u/join @cf/public-uri "api/export")
|
||||
:body (http/transit-data (dissoc params :blob?))
|
||||
:credentials "include"
|
||||
:response-type (if blob? :blob :text)})
|
||||
|
@ -173,7 +171,7 @@
|
|||
(defmethod mutation ::multipart-upload
|
||||
[id params]
|
||||
(->> (http/send! {:method :post
|
||||
:uri (u/join base-uri "api/rpc/mutation/" (name id))
|
||||
:uri (u/join @cf/public-uri "api/rpc/mutation/" (name id))
|
||||
:credentials "include"
|
||||
:body (http/form-data params)})
|
||||
(rx/map http/conditional-decode-transit)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue