mirror of
https://github.com/penpot/penpot.git
synced 2025-02-10 09:08:31 -05: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
|
@ -8,9 +8,12 @@
|
||||||
(:require
|
(:require
|
||||||
[app.common.geom.matrix :as gmt]
|
[app.common.geom.matrix :as gmt]
|
||||||
[app.common.geom.point :as gpt]
|
[app.common.geom.point :as gpt]
|
||||||
|
[app.common.uri :as uri]
|
||||||
[cognitect.transit :as t]
|
[cognitect.transit :as t]
|
||||||
|
[lambdaisland.uri :as luri]
|
||||||
[linked.core :as lk]
|
[linked.core :as lk]
|
||||||
[linked.set :as lks]
|
[linked.set :as lks]
|
||||||
|
|
||||||
#?(:cljs ["luxon" :as lxn]))
|
#?(:cljs ["luxon" :as lxn]))
|
||||||
#?(:clj
|
#?(:clj
|
||||||
(:import
|
(:import
|
||||||
|
@ -19,9 +22,10 @@
|
||||||
java.io.ByteArrayInputStream
|
java.io.ByteArrayInputStream
|
||||||
java.io.ByteArrayOutputStream
|
java.io.ByteArrayOutputStream
|
||||||
java.io.File
|
java.io.File
|
||||||
java.time.Instant
|
|
||||||
java.time.Duration
|
java.time.Duration
|
||||||
|
java.time.Instant
|
||||||
java.time.OffsetDateTime
|
java.time.OffsetDateTime
|
||||||
|
lambdaisland.uri.URI
|
||||||
linked.set.LinkedSet)))
|
linked.set.LinkedSet)))
|
||||||
|
|
||||||
;; --- MISC
|
;; --- MISC
|
||||||
|
@ -121,6 +125,16 @@
|
||||||
(constantly "m")
|
(constantly "m")
|
||||||
(fn [v] (str (inst-ms v)))))
|
(fn [v] (str (inst-ms v)))))
|
||||||
|
|
||||||
|
;; --- URI
|
||||||
|
|
||||||
|
(def uri-read-handler
|
||||||
|
(t/read-handler uri/uri))
|
||||||
|
|
||||||
|
(def uri-write-handler
|
||||||
|
(t/write-handler
|
||||||
|
(constantly "uri")
|
||||||
|
(fn [v] (str v))))
|
||||||
|
|
||||||
;; --- HANDLERS
|
;; --- HANDLERS
|
||||||
|
|
||||||
(def +read-handlers+
|
(def +read-handlers+
|
||||||
|
@ -129,6 +143,7 @@
|
||||||
"point" point-read-handler
|
"point" point-read-handler
|
||||||
"duration" duration-read-handler
|
"duration" duration-read-handler
|
||||||
"m" instant-read-handler
|
"m" instant-read-handler
|
||||||
|
"uri" uri-read-handler
|
||||||
#?@(:cljs ["n" bigint-read-handler
|
#?@(:cljs ["n" bigint-read-handler
|
||||||
"u" uuid-read-handler])
|
"u" uuid-read-handler])
|
||||||
})
|
})
|
||||||
|
@ -139,7 +154,7 @@
|
||||||
Point point-write-handler
|
Point point-write-handler
|
||||||
Instant instant-write-handler
|
Instant instant-write-handler
|
||||||
LinkedSet ordered-set-write-handler
|
LinkedSet ordered-set-write-handler
|
||||||
|
URI uri-write-handler
|
||||||
File file-write-handler
|
File file-write-handler
|
||||||
OffsetDateTime instant-write-handler}
|
OffsetDateTime instant-write-handler}
|
||||||
:cljs
|
:cljs
|
||||||
|
@ -147,7 +162,8 @@
|
||||||
gpt/Point point-write-handler
|
gpt/Point point-write-handler
|
||||||
lxn/DateTime instant-write-handler
|
lxn/DateTime instant-write-handler
|
||||||
lxn/Duration duration-write-handler
|
lxn/Duration duration-write-handler
|
||||||
lks/LinkedSet ordered-set-write-handler}
|
lks/LinkedSet ordered-set-write-handler
|
||||||
|
luri/URI uri-write-handler}
|
||||||
))
|
))
|
||||||
|
|
||||||
;; --- Low-Level Api
|
;; --- Low-Level Api
|
||||||
|
|
|
@ -102,17 +102,19 @@
|
||||||
(def terms-of-service-uri (obj/get global "penpotTermsOfServiceURI" nil))
|
(def terms-of-service-uri (obj/get global "penpotTermsOfServiceURI" nil))
|
||||||
(def privacy-policy-uri (obj/get global "penpotPrivacyPolicyURI" nil))
|
(def privacy-policy-uri (obj/get global "penpotPrivacyPolicyURI" nil))
|
||||||
|
|
||||||
(defn get-public-uri
|
(defn- normalize-uri
|
||||||
[]
|
[uri-str]
|
||||||
(let [uri (u/uri (or (obj/get global "penpotPublicURI")
|
(let [uri (u/uri uri-str)]
|
||||||
(.-origin ^js location)))]
|
|
||||||
;; Ensure that the path always ends with "/"; this ensures that
|
;; Ensure that the path always ends with "/"; this ensures that
|
||||||
;; all path join operations works as expected.
|
;; all path join operations works as expected.
|
||||||
(cond-> uri
|
(cond-> uri
|
||||||
(not (str/ends-with? (:path uri) "/"))
|
(not (str/ends-with? (:path uri) "/"))
|
||||||
(update :path #(str % "/")))))
|
(update :path #(str % "/")))))
|
||||||
|
|
||||||
(def public-uri (get-public-uri))
|
(def public-uri
|
||||||
|
(atom
|
||||||
|
(normalize-uri (or (obj/get global "penpotPublicURI")
|
||||||
|
(.-origin ^js location)))))
|
||||||
|
|
||||||
;; --- Helper Functions
|
;; --- Helper Functions
|
||||||
|
|
||||||
|
@ -128,18 +130,18 @@
|
||||||
[{:keys [photo-id fullname name] :as profile}]
|
[{:keys [photo-id fullname name] :as profile}]
|
||||||
(if (nil? photo-id)
|
(if (nil? photo-id)
|
||||||
(avatars/generate {:name (or fullname name)})
|
(avatars/generate {:name (or fullname name)})
|
||||||
(str (u/join public-uri "assets/by-id/" photo-id))))
|
(str (u/join @public-uri "assets/by-id/" photo-id))))
|
||||||
|
|
||||||
(defn resolve-team-photo-url
|
(defn resolve-team-photo-url
|
||||||
[{:keys [photo-id name] :as team}]
|
[{:keys [photo-id name] :as team}]
|
||||||
(if (nil? photo-id)
|
(if (nil? photo-id)
|
||||||
(avatars/generate {:name name})
|
(avatars/generate {:name name})
|
||||||
(str (u/join public-uri "assets/by-id/" photo-id))))
|
(str (u/join @public-uri "assets/by-id/" photo-id))))
|
||||||
|
|
||||||
(defn resolve-file-media
|
(defn resolve-file-media
|
||||||
([media]
|
([media]
|
||||||
(resolve-file-media media false))
|
(resolve-file-media media false))
|
||||||
([{:keys [id] :as media} thumbnail?]
|
([{:keys [id] :as media} thumbnail?]
|
||||||
(str (cond-> (u/join public-uri "assets/by-file-media-id/")
|
(str (cond-> (u/join @public-uri "assets/by-file-media-id/")
|
||||||
(true? thumbnail?) (u/join (str id "/thumbnail"))
|
(true? thumbnail?) (u/join (str id "/thumbnail"))
|
||||||
(false? thumbnail?) (u/join (str id))))))
|
(false? thumbnail?) (u/join (str id))))))
|
||||||
|
|
|
@ -39,7 +39,7 @@
|
||||||
(log/info :message "Welcome to penpot"
|
(log/info :message "Welcome to penpot"
|
||||||
:version (:full @cf/version)
|
:version (:full @cf/version)
|
||||||
:build-date cf/build-date
|
:build-date cf/build-date
|
||||||
:public-uri (str cf/public-uri)))
|
:public-uri (str @cf/public-uri)))
|
||||||
|
|
||||||
(declare reinit)
|
(declare reinit)
|
||||||
|
|
||||||
|
|
|
@ -215,7 +215,7 @@
|
||||||
(defn- persist-events
|
(defn- persist-events
|
||||||
[events]
|
[events]
|
||||||
(if (seq events)
|
(if (seq events)
|
||||||
(let [uri (u/join cf/public-uri "api/audit/events")
|
(let [uri (u/join @cf/public-uri "api/audit/events")
|
||||||
params {:uri uri
|
params {:uri uri
|
||||||
:method :post
|
:method :post
|
||||||
:body (http/transit-data {:events events})}]
|
:body (http/transit-data {:events events})}]
|
||||||
|
|
|
@ -22,7 +22,8 @@
|
||||||
|
|
||||||
(defn- prepare-uri
|
(defn- prepare-uri
|
||||||
[params]
|
[params]
|
||||||
(let [base (-> (u/join cf/public-uri "ws/notifications")
|
(let [base (-> @cf/public-uri
|
||||||
|
(u/join "ws/notifications")
|
||||||
(assoc :query (u/map->query-string params)))]
|
(assoc :query (u/map->query-string params)))]
|
||||||
(cond-> base
|
(cond-> base
|
||||||
(= "https" (:scheme base))
|
(= "https" (:scheme base))
|
||||||
|
|
|
@ -141,7 +141,7 @@
|
||||||
context (dm/fmt "ns: '%'\nname: '%'\nfile: '%:%'"
|
context (dm/fmt "ns: '%'\nname: '%'\nfile: '%:%'"
|
||||||
(:ns error)
|
(:ns error)
|
||||||
(:name error)
|
(:name error)
|
||||||
(dm/str cf/public-uri "js/cljs-runtime/" (:file error))
|
(dm/str @cf/public-uri "js/cljs-runtime/" (:file error))
|
||||||
(:line error))]
|
(:line error))]
|
||||||
|
|
||||||
(ts/schedule
|
(ts/schedule
|
||||||
|
|
|
@ -162,7 +162,7 @@
|
||||||
|
|
||||||
(defn- asset-id->uri
|
(defn- asset-id->uri
|
||||||
[asset-id]
|
[asset-id]
|
||||||
(str (u/join cf/public-uri "assets/by-id/" asset-id)))
|
(str (u/join @cf/public-uri "assets/by-id/" asset-id)))
|
||||||
|
|
||||||
(defn generate-custom-font-variant-css
|
(defn generate-custom-font-variant-css
|
||||||
[family variant]
|
[family variant]
|
||||||
|
@ -294,7 +294,7 @@
|
||||||
:else
|
:else
|
||||||
(let [{:keys [weight style suffix] :as variant}
|
(let [{:keys [weight style suffix] :as variant}
|
||||||
(d/seek #(= (:id %) font-variant-id) variants)
|
(d/seek #(= (:id %) font-variant-id) variants)
|
||||||
font-data {:baseurl (str cf/public-uri)
|
font-data {:baseurl (str @cf/public-uri)
|
||||||
:family family
|
:family family
|
||||||
:style style
|
:style style
|
||||||
:suffix (or suffix font-variant-id)
|
:suffix (or suffix font-variant-id)
|
||||||
|
|
|
@ -43,8 +43,6 @@
|
||||||
:status status
|
:status status
|
||||||
:data body})))
|
:data body})))
|
||||||
|
|
||||||
(def ^:private base-uri cf/public-uri)
|
|
||||||
|
|
||||||
(defn- send-query!
|
(defn- send-query!
|
||||||
"A simple helper for send and receive transit data on the penpot
|
"A simple helper for send and receive transit data on the penpot
|
||||||
query api."
|
query api."
|
||||||
|
@ -56,7 +54,7 @@
|
||||||
http/conditional-error-decode-transit
|
http/conditional-error-decode-transit
|
||||||
http/conditional-decode-transit)]
|
http/conditional-decode-transit)]
|
||||||
(->> (http/send! {:method :get
|
(->> (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"
|
:credentials "include"
|
||||||
:query params})
|
:query params})
|
||||||
(rx/map decode-transit)
|
(rx/map decode-transit)
|
||||||
|
@ -67,7 +65,7 @@
|
||||||
data to the penpot mutation api."
|
data to the penpot mutation api."
|
||||||
[id params]
|
[id params]
|
||||||
(->> (http/send! {:method :post
|
(->> (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"
|
:credentials "include"
|
||||||
:body (http/transit-data params)})
|
:body (http/transit-data params)})
|
||||||
(rx/map http/conditional-decode-transit)
|
(rx/map http/conditional-decode-transit)
|
||||||
|
@ -78,7 +76,7 @@
|
||||||
data to the penpot mutation api."
|
data to the penpot mutation api."
|
||||||
[id params {:keys [response-type form-data?]}]
|
[id params {:keys [response-type form-data?]}]
|
||||||
(->> (http/send! {:method :post
|
(->> (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"
|
:credentials "include"
|
||||||
:body (if form-data? (http/form-data params) (http/transit-data params))
|
:body (if form-data? (http/form-data params) (http/transit-data params))
|
||||||
:response-type (or response-type :text)})
|
:response-type (or response-type :text)})
|
||||||
|
@ -133,7 +131,7 @@
|
||||||
|
|
||||||
(defmethod command :login-with-oidc
|
(defmethod command :login-with-oidc
|
||||||
[_ {:keys [provider] :as params}]
|
[_ {: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)]
|
params (dissoc params :provider)]
|
||||||
(->> (http/send! {:method :post
|
(->> (http/send! {:method :post
|
||||||
:uri uri
|
:uri uri
|
||||||
|
@ -145,7 +143,7 @@
|
||||||
(defmethod command :send-feedback
|
(defmethod command :send-feedback
|
||||||
[_ params]
|
[_ params]
|
||||||
(->> (http/send! {:method :post
|
(->> (http/send! {:method :post
|
||||||
:uri (u/join base-uri "api/feedback")
|
:uri (u/join @cf/public-uri "api/feedback")
|
||||||
:credentials "include"
|
:credentials "include"
|
||||||
:body (http/transit-data params)})
|
:body (http/transit-data params)})
|
||||||
(rx/map http/conditional-decode-transit)
|
(rx/map http/conditional-decode-transit)
|
||||||
|
@ -154,7 +152,7 @@
|
||||||
(defn- send-export
|
(defn- send-export
|
||||||
[{:keys [blob?] :as params}]
|
[{:keys [blob?] :as params}]
|
||||||
(->> (http/send! {:method :post
|
(->> (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?))
|
:body (http/transit-data (dissoc params :blob?))
|
||||||
:credentials "include"
|
:credentials "include"
|
||||||
:response-type (if blob? :blob :text)})
|
:response-type (if blob? :blob :text)})
|
||||||
|
@ -173,7 +171,7 @@
|
||||||
(defmethod mutation ::multipart-upload
|
(defmethod mutation ::multipart-upload
|
||||||
[id params]
|
[id params]
|
||||||
(->> (http/send! {:method :post
|
(->> (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"
|
:credentials "include"
|
||||||
:body (http/form-data params)})
|
:body (http/form-data params)})
|
||||||
(rx/map http/conditional-decode-transit)
|
(rx/map http/conditional-decode-transit)
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
(mf/defc template-item
|
(mf/defc template-item
|
||||||
[{:keys [name path image project-id]}]
|
[{:keys [name path image project-id]}]
|
||||||
(let [downloading? (mf/use-state false)
|
(let [downloading? (mf/use-state false)
|
||||||
link (str (assoc cf/public-uri :path path))
|
link (str (assoc @cf/public-uri :path path))
|
||||||
|
|
||||||
on-finish-import
|
on-finish-import
|
||||||
(fn []
|
(fn []
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
|
|
||||||
(defn prepare-params
|
(defn prepare-params
|
||||||
[{:keys [pages who-comment who-inspect]}]
|
[{:keys [pages who-comment who-inspect]}]
|
||||||
|
|
||||||
{:pages pages
|
{:pages pages
|
||||||
:who-comment who-comment
|
:who-comment who-comment
|
||||||
:who-inspect who-inspect})
|
:who-inspect who-inspect})
|
||||||
|
@ -145,7 +145,7 @@
|
||||||
(assoc qparams :zoom zoom-type))
|
(assoc qparams :zoom zoom-type))
|
||||||
|
|
||||||
href (rt/resolve router :viewer pparams qparams)]
|
href (rt/resolve router :viewer pparams qparams)]
|
||||||
(assoc cf/public-uri :fragment href)))]
|
(assoc @cf/public-uri :fragment href)))]
|
||||||
(reset! link (some-> href str)))))
|
(reset! link (some-> href str)))))
|
||||||
|
|
||||||
[:div.modal-overlay.transparent.share-modal
|
[:div.modal-overlay.transparent.share-modal
|
||||||
|
|
|
@ -6,17 +6,24 @@
|
||||||
|
|
||||||
(ns app.main.worker
|
(ns app.main.worker
|
||||||
(:require
|
(:require
|
||||||
[app.config :as cfg]
|
[app.config :as cf]
|
||||||
[app.main.errors :as err]
|
[app.main.errors :as err]
|
||||||
[app.util.worker :as uw]))
|
[app.util.worker :as uw]))
|
||||||
|
|
||||||
(defonce instance (atom nil))
|
(defonce instance (atom nil))
|
||||||
|
|
||||||
|
(defn- update-public-uri!
|
||||||
|
[instance val]
|
||||||
|
(uw/ask! instance {:cmd :configure
|
||||||
|
:key :public-uri
|
||||||
|
:val val}))
|
||||||
|
|
||||||
(defn init!
|
(defn init!
|
||||||
[]
|
[]
|
||||||
(reset!
|
(let [worker (uw/init cf/worker-uri err/on-error)]
|
||||||
instance
|
(update-public-uri! worker @cf/public-uri)
|
||||||
(uw/init cfg/worker-uri err/on-error)))
|
(add-watch cf/public-uri ::worker-public-uri (fn [_ _ _ val] (update-public-uri! worker val)))
|
||||||
|
(reset! instance worker)))
|
||||||
|
|
||||||
(defn ask!
|
(defn ask!
|
||||||
[message]
|
[message]
|
||||||
|
|
|
@ -11,7 +11,6 @@
|
||||||
[app.common.math :as mth]
|
[app.common.math :as mth]
|
||||||
[app.common.spec :as us]
|
[app.common.spec :as us]
|
||||||
[app.common.uri :as u]
|
[app.common.uri :as u]
|
||||||
[app.config :as cf]
|
|
||||||
[app.main.data.fonts :as df]
|
[app.main.data.fonts :as df]
|
||||||
[app.main.features :as features]
|
[app.main.features :as features]
|
||||||
[app.main.render :as render]
|
[app.main.render :as render]
|
||||||
|
@ -37,10 +36,6 @@
|
||||||
(declare ^:private render-components)
|
(declare ^:private render-components)
|
||||||
(declare ^:private render-objects)
|
(declare ^:private render-objects)
|
||||||
|
|
||||||
(l/info :hint "Welcome to penpot (Export)"
|
|
||||||
:version (:full @cf/version)
|
|
||||||
:public-uri (str cf/public-uri))
|
|
||||||
|
|
||||||
(defn- parse-params
|
(defn- parse-params
|
||||||
[loc]
|
[loc]
|
||||||
(let [href (unchecked-get loc "href")]
|
(let [href (unchecked-get loc "href")]
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
(:refer-clojure :exclude [resolve])
|
(:refer-clojure :exclude [resolve])
|
||||||
(:require
|
(:require
|
||||||
[app.common.uri :as u]
|
[app.common.uri :as u]
|
||||||
[app.config :as cfg]
|
[app.config :as cf]
|
||||||
[app.util.browser-history :as bhistory]
|
[app.util.browser-history :as bhistory]
|
||||||
[app.util.dom :as dom]
|
[app.util.dom :as dom]
|
||||||
[app.util.timers :as ts]
|
[app.util.timers :as ts]
|
||||||
|
@ -117,8 +117,7 @@
|
||||||
(let [router (:router state)
|
(let [router (:router state)
|
||||||
path (resolve router rname path-params query-params)
|
path (resolve router rname path-params query-params)
|
||||||
name (or name "_blank")
|
name (or name "_blank")
|
||||||
uri (-> (u/uri cfg/public-uri)
|
uri (assoc @cf/public-uri :fragment path)]
|
||||||
(assoc :fragment path))]
|
|
||||||
(dom/open-new-window uri name nil)))))
|
(dom/open-new-window uri name nil)))))
|
||||||
|
|
||||||
(defn nav-back
|
(defn nav-back
|
||||||
|
|
|
@ -8,8 +8,6 @@
|
||||||
"A lightweight layer on top of webworkers api."
|
"A lightweight layer on top of webworkers api."
|
||||||
(:require
|
(:require
|
||||||
[app.common.uuid :as uuid]
|
[app.common.uuid :as uuid]
|
||||||
[app.util.globals :refer [global]]
|
|
||||||
[app.util.object :as obj]
|
|
||||||
[app.worker.messages :as wm]
|
[app.worker.messages :as wm]
|
||||||
[beicon.core :as rx]))
|
[beicon.core :as rx]))
|
||||||
|
|
||||||
|
@ -83,11 +81,6 @@
|
||||||
(.addEventListener instance "message" handle-message)
|
(.addEventListener instance "message" handle-message)
|
||||||
(.addEventListener instance "error" handle-error)
|
(.addEventListener instance "error" handle-error)
|
||||||
|
|
||||||
(ask! worker
|
|
||||||
{:cmd :configure
|
|
||||||
:params
|
|
||||||
{"penpotPublicURI" (obj/get global "penpotPublicURI")}})
|
|
||||||
|
|
||||||
worker))
|
worker))
|
||||||
|
|
||||||
(defn- handle-response
|
(defn- handle-response
|
||||||
|
|
|
@ -6,12 +6,14 @@
|
||||||
|
|
||||||
(ns app.worker.impl
|
(ns app.worker.impl
|
||||||
(:require
|
(:require
|
||||||
|
[app.common.logging :as log]
|
||||||
[app.common.pages.changes :as ch]
|
[app.common.pages.changes :as ch]
|
||||||
[app.common.transit :as t]
|
[app.common.transit :as t]
|
||||||
[app.util.globals :refer [global]]
|
[app.config :as cf]
|
||||||
[app.util.object :as obj]
|
|
||||||
[okulary.core :as l]))
|
[okulary.core :as l]))
|
||||||
|
|
||||||
|
(log/set-level! :info)
|
||||||
|
|
||||||
(enable-console-print!)
|
(enable-console-print!)
|
||||||
|
|
||||||
(defonce state (l/atom {:pages-index {}}))
|
(defonce state (l/atom {:pages-index {}}))
|
||||||
|
@ -22,7 +24,7 @@
|
||||||
|
|
||||||
(defmethod handler :default
|
(defmethod handler :default
|
||||||
[message]
|
[message]
|
||||||
(println "Unexpected message:" message))
|
(log/warn :hint "unexpected message" :message message))
|
||||||
|
|
||||||
(defmethod handler :echo
|
(defmethod handler :echo
|
||||||
[message]
|
[message]
|
||||||
|
@ -55,6 +57,8 @@
|
||||||
(assoc :cmd :snaps/update-index))))))
|
(assoc :cmd :snaps/update-index))))))
|
||||||
|
|
||||||
(defmethod handler :configure
|
(defmethod handler :configure
|
||||||
[{:keys [params]}]
|
[{:keys [key val]}]
|
||||||
(doseq [[param-key param-value] params]
|
(log/info :hint "configure worker" :key key :val val)
|
||||||
(obj/set! global param-key param-value)))
|
(case key
|
||||||
|
:public-uri
|
||||||
|
(reset! cf/public-uri val)))
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
(:require
|
(:require
|
||||||
["react-dom/server" :as rds]
|
["react-dom/server" :as rds]
|
||||||
[app.common.uri :as u]
|
[app.common.uri :as u]
|
||||||
[app.config :as cfg]
|
[app.config :as cf]
|
||||||
[app.main.fonts :as fonts]
|
[app.main.fonts :as fonts]
|
||||||
[app.main.render :as render]
|
[app.main.render :as render]
|
||||||
[app.util.http :as http]
|
[app.util.http :as http]
|
||||||
|
@ -55,7 +55,7 @@
|
||||||
:strip-frames-with-thumbnails true
|
:strip-frames-with-thumbnails true
|
||||||
:components-v2 components-v2}
|
:components-v2 components-v2}
|
||||||
request {:method :get
|
request {:method :get
|
||||||
:uri (u/join (cfg/get-public-uri) path)
|
:uri (u/join @cf/public-uri path)
|
||||||
:credentials "include"
|
:credentials "include"
|
||||||
:query params}]
|
:query params}]
|
||||||
(->> (http/send! request)
|
(->> (http/send! request)
|
||||||
|
@ -68,7 +68,7 @@
|
||||||
params {:file-id file-id
|
params {:file-id file-id
|
||||||
:revn revn}
|
:revn revn}
|
||||||
request {:method :get
|
request {:method :get
|
||||||
:uri (u/join (cfg/get-public-uri) path)
|
:uri (u/join @cf/public-uri path)
|
||||||
:credentials "include"
|
:credentials "include"
|
||||||
:query params}]
|
:query params}]
|
||||||
|
|
||||||
|
@ -97,7 +97,7 @@
|
||||||
:props {:fonts fonts}
|
:props {:fonts fonts}
|
||||||
:data data}
|
:data data}
|
||||||
request {:method :post
|
request {:method :post
|
||||||
:uri (u/join (cfg/get-public-uri) path)
|
:uri (u/join @cf/public-uri path)
|
||||||
:credentials "include"
|
:credentials "include"
|
||||||
:body (http/transit-data params)}]
|
:body (http/transit-data params)}]
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue