mirror of
https://github.com/penpot/penpot.git
synced 2025-05-11 02:06:37 +02:00
🔧 Minor changes on frontend build config.
This commit is contained in:
parent
70108a0aa7
commit
aa57083afc
3 changed files with 25 additions and 26 deletions
|
@ -101,13 +101,18 @@ function readLocales() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function readConfig() {
|
function readConfig() {
|
||||||
const apiUrl = process.env.UXBOX_API_URL;
|
const backendURL = process.env.UXBOX_BACKEND_URL;
|
||||||
const demoWarn = process.env.UXBOX_DEMO_WARNING;
|
const demoWarn = process.env.UXBOX_DEMO_WARNING;
|
||||||
|
|
||||||
return JSON.stringify({
|
let cfg = {
|
||||||
apiUrl: (apiUrl === undefined ? "http://localhost:6060" : apiUrl.trim()),
|
demoWarning: demoWarn === "true"
|
||||||
demoWarning: demoWarn === "true",
|
};
|
||||||
});
|
|
||||||
|
if (backendURL !== undefined) {
|
||||||
|
cfg.backendURL = backendURL;
|
||||||
|
}
|
||||||
|
|
||||||
|
return JSON.stringify(cfg);
|
||||||
}
|
}
|
||||||
|
|
||||||
function templatePipeline(options) {
|
function templatePipeline(options) {
|
||||||
|
|
|
@ -10,7 +10,19 @@
|
||||||
(ns uxbox.config
|
(ns uxbox.config
|
||||||
(:require [goog.object :as gobj]))
|
(:require [goog.object :as gobj]))
|
||||||
|
|
||||||
(let [config (gobj/get goog.global "uxboxConfig")]
|
(defn- get-current-origin
|
||||||
|
[]
|
||||||
|
(let [location (gobj/get goog.global "location")]
|
||||||
|
(gobj/get location "origin")))
|
||||||
|
|
||||||
|
(let [config (gobj/get goog.global "uxboxConfig")
|
||||||
|
backend-url (gobj/get config "backendURL" "http://localhost:6060")]
|
||||||
|
|
||||||
(def default-language "en")
|
(def default-language "en")
|
||||||
(def url (gobj/get config "apiUrl" "http://localhost:6060/"))
|
(def demo-warning (gobj/get config "demoWarning" true))
|
||||||
(def demo-warning (gobj/get config "demoWarning" true)))
|
|
||||||
|
(def url
|
||||||
|
(if (= backend-url "samesite")
|
||||||
|
(get-current-origin)
|
||||||
|
backend-url)))
|
||||||
|
|
||||||
|
|
|
@ -64,24 +64,6 @@
|
||||||
|
|
||||||
["/workspace/:file-id" :workspace]])
|
["/workspace/:file-id" :workspace]])
|
||||||
|
|
||||||
(defn- parse-team-id
|
|
||||||
[route profile]
|
|
||||||
(let [team-id (get-in route [:params :path :team-id])]
|
|
||||||
(cond
|
|
||||||
(uuid-str? team-id) (uuid team-id)
|
|
||||||
(= "self" team-id) (:default-team-id profile)
|
|
||||||
:else (ex/raise :type :validation
|
|
||||||
:code :invalid-team-id))))
|
|
||||||
|
|
||||||
(defn- parse-project-id
|
|
||||||
[route profile]
|
|
||||||
(let [project-id (get-in route [:params :path :project-id])]
|
|
||||||
(cond
|
|
||||||
(uuid-str? project-id) (uuid project-id)
|
|
||||||
(= "drafts" project-id) (:default-project-id profile)
|
|
||||||
:else (ex/raise :type :validation
|
|
||||||
:code :invalid-project-id))))
|
|
||||||
|
|
||||||
|
|
||||||
(mf/defc app
|
(mf/defc app
|
||||||
[props]
|
[props]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue