mirror of
https://github.com/penpot/penpot.git
synced 2025-01-23 06:58:58 -05:00
🐛 Remove unused setting on exporter
That causes many troubles on configuring exporter on the onpremise instances but serves for nothing because it is completly unused.
This commit is contained in:
parent
248ab953b2
commit
fa06da36ac
6 changed files with 16 additions and 38 deletions
|
@ -25,15 +25,13 @@
|
|||
:host "devenv"
|
||||
:http-server-port 6061
|
||||
:http-server-host "localhost"
|
||||
:redis-uri "redis://redis/0"
|
||||
:domain-white-list #{"localhost:3449"}})
|
||||
:redis-uri "redis://redis/0"})
|
||||
|
||||
(s/def ::http-server-port ::us/integer)
|
||||
(s/def ::http-server-host ::us/string)
|
||||
(s/def ::public-uri ::us/uri)
|
||||
(s/def ::tenant ::us/string)
|
||||
(s/def ::host ::us/string)
|
||||
(s/def ::domain-white-list ::us/set-of-str)
|
||||
(s/def ::browser-pool-max ::us/integer)
|
||||
(s/def ::browser-pool-min ::us/integer)
|
||||
|
||||
|
@ -44,8 +42,7 @@
|
|||
::http-server-port
|
||||
::http-server-host
|
||||
::browser-pool-max
|
||||
::browser-pool-min
|
||||
::domain-white-list]))
|
||||
::browser-pool-min]))
|
||||
|
||||
(defn- read-env
|
||||
[prefix]
|
||||
|
|
|
@ -70,7 +70,6 @@
|
|||
(defmulti command-spec :cmd)
|
||||
|
||||
(s/def ::id ::us/string)
|
||||
(s/def ::uri ::us/uri)
|
||||
(s/def ::wait ::us/boolean)
|
||||
(s/def ::cmd ::us/keyword)
|
||||
|
||||
|
@ -80,24 +79,13 @@
|
|||
|
||||
(s/def ::params
|
||||
(s/and (s/keys :req-un [::cmd]
|
||||
:opt-un [::wait ::uri])
|
||||
:opt-un [::wait])
|
||||
(s/multi-spec command-spec :cmd)))
|
||||
|
||||
(defn validate-uri!
|
||||
[uri]
|
||||
(let [white-list (cf/get :domain-white-list #{})
|
||||
default (cf/get :public-uri)]
|
||||
(when-not (or (contains? white-list (u/get-domain uri))
|
||||
(= (u/get-domain default) (u/get-domain uri)))
|
||||
(ex/raise :type :validation
|
||||
:code :domain-not-allowed
|
||||
:hint "looks like the uri provided is not part of the white list"))))
|
||||
|
||||
(defn handler
|
||||
[{:keys [:request/params] :as exchange}]
|
||||
(let [{:keys [cmd uri] :as params} (us/conform ::params params)]
|
||||
(let [{:keys [cmd] :as params} (us/conform ::params params)]
|
||||
(l/debug :hint "process-request" :cmd cmd)
|
||||
(some-> uri validate-uri!)
|
||||
(case cmd
|
||||
:get-resource (resources/handler exchange)
|
||||
:export-shapes (export-shapes/handler exchange params)
|
||||
|
|
|
@ -29,7 +29,6 @@
|
|||
(s/def ::file-id ::us/uuid)
|
||||
(s/def ::page-id ::us/uuid)
|
||||
(s/def ::object-id ::us/uuid)
|
||||
(s/def ::uri ::us/uri)
|
||||
|
||||
(s/def ::export
|
||||
(s/keys :req-un [::file-id ::page-id ::object-id ::name]))
|
||||
|
@ -39,18 +38,18 @@
|
|||
|
||||
(s/def ::params
|
||||
(s/keys :req-un [::exports]
|
||||
:opt-un [::uri ::name]))
|
||||
:opt-un [::name]))
|
||||
|
||||
(defn handler
|
||||
[{:keys [:request/auth-token] :as exchange} {:keys [exports uri profile-id] :as params}]
|
||||
[{:keys [:request/auth-token] :as exchange} {:keys [exports profile-id] :as params}]
|
||||
;; NOTE: we need to have the `:type` prop because the exports
|
||||
;; datastructure preparation uses it for creating the groups.
|
||||
(let [exports (-> (map #(assoc % :type :pdf :scale 1 :suffix "") exports)
|
||||
(prepare-exports auth-token uri))]
|
||||
(prepare-exports auth-token))]
|
||||
(handle-export exchange (assoc params :exports exports))))
|
||||
|
||||
(defn handle-export
|
||||
[exchange {:keys [exports wait uri name profile-id] :as params}]
|
||||
[exchange {:keys [exports wait name profile-id] :as params}]
|
||||
(let [total (count exports)
|
||||
topic (str profile-id)
|
||||
resource (rsc/create :pdf (or name (-> exports first :name)))
|
||||
|
|
|
@ -34,7 +34,6 @@
|
|||
(s/def ::scale ::us/number)
|
||||
(s/def ::suffix ::us/string)
|
||||
(s/def ::type ::us/keyword)
|
||||
(s/def ::uri ::us/uri)
|
||||
(s/def ::wait ::us/boolean)
|
||||
|
||||
(s/def ::export
|
||||
|
@ -45,11 +44,11 @@
|
|||
|
||||
(s/def ::params
|
||||
(s/keys :req-un [::exports ::profile-id]
|
||||
:opt-un [::uri ::wait ::name]))
|
||||
:opt-un [::wait ::name]))
|
||||
|
||||
(defn handler
|
||||
[{:keys [:request/auth-token] :as exchange} {:keys [exports uri] :as params}]
|
||||
(let [exports (prepare-exports exports auth-token uri)]
|
||||
[{:keys [:request/auth-token] :as exchange} {:keys [exports] :as params}]
|
||||
(let [exports (prepare-exports exports auth-token)]
|
||||
(if (and (= 1 (count exports))
|
||||
(= 1 (count (-> exports first :objects))))
|
||||
(handle-single-export exchange (-> params
|
||||
|
@ -58,7 +57,7 @@
|
|||
(handle-multiple-export exchange (assoc params :exports exports)))))
|
||||
|
||||
(defn- handle-single-export
|
||||
[exchange {:keys [export wait uri profile-id name] :as params}]
|
||||
[exchange {:keys [export wait profile-id name] :as params}]
|
||||
(let [topic (str profile-id)
|
||||
resource (rsc/create (:type export) (or name (:name export)))
|
||||
|
||||
|
@ -98,7 +97,7 @@
|
|||
(assoc exchange :response/body (dissoc resource :path)))))
|
||||
|
||||
(defn- handle-multiple-export
|
||||
[exchange {:keys [exports wait uri profile-id name] :as params}]
|
||||
[exchange {:keys [exports wait profile-id name] :as params}]
|
||||
(let [resource (rsc/create :zip (or name (-> exports first :name)))
|
||||
total (count exports)
|
||||
topic (str profile-id)
|
||||
|
@ -185,7 +184,7 @@
|
|||
default-partition-size 50)
|
||||
|
||||
(defn prepare-exports
|
||||
[exports token uri]
|
||||
[exports token]
|
||||
(letfn [(process-group [group]
|
||||
(sequence (comp (partition-all default-partition-size)
|
||||
(map process-partition))
|
||||
|
@ -196,7 +195,6 @@
|
|||
:page-id (:page-id part1)
|
||||
:name (:name part1)
|
||||
:token token
|
||||
:uri uri
|
||||
:type (:type part1)
|
||||
:scale (:scale part1)
|
||||
:objects (mapv part-entry->object part)})
|
||||
|
|
|
@ -20,7 +20,6 @@
|
|||
(s/def ::file-id ::us/uuid)
|
||||
(s/def ::scale ::us/number)
|
||||
(s/def ::token ::us/string)
|
||||
(s/def ::uri ::us/uri)
|
||||
(s/def ::filename ::us/string)
|
||||
|
||||
(s/def ::object
|
||||
|
@ -30,8 +29,7 @@
|
|||
(s/coll-of ::object :min-count 1))
|
||||
|
||||
(s/def ::render-params
|
||||
(s/keys :req-un [::file-id ::page-id ::scale ::token ::type ::objects]
|
||||
:opt-un [::uri]))
|
||||
(s/keys :req-un [::file-id ::page-id ::scale ::token ::type ::objects]))
|
||||
|
||||
(defn- render
|
||||
[{:keys [type] :as params} on-object]
|
||||
|
|
|
@ -130,9 +130,7 @@
|
|||
|
||||
(defmethod query :exporter
|
||||
[_ params]
|
||||
(let [default {:wait false
|
||||
:blob? false
|
||||
:uri (str base-uri)}]
|
||||
(let [default {:wait false :blob? false}]
|
||||
(send-export (merge default params))))
|
||||
|
||||
(derive :upload-file-media-object ::multipart-upload)
|
||||
|
|
Loading…
Add table
Reference in a new issue