diff --git a/frontend/gulpfile.js b/frontend/gulpfile.js index 27ce62ce9..baf508914 100644 --- a/frontend/gulpfile.js +++ b/frontend/gulpfile.js @@ -150,22 +150,27 @@ function templatePipeline(options) { return function() { const input = options.input; const output = options.output; + const ts = Math.floor(new Date()); - const th = process.env.UXBOX_THEME || "default"; - const deployDate = process.env.UXBOX_DEPLOY_DATE; - const deployCommit = process.env.UXBOX_DEPLOY_COMMIT; - const themes = ["default"]; + const locales = readLocales(); const manifest = readManifest(); - const defaultConf = `var uxboxConfig = {demoWarning: false, googleClientID: null, loginWithLDAP: null, publicURI: null};` - fs.writeFileSync(__dirname + "/resources/public/js/config.js", defaultConf) + const defaultConf = [ + "var appDemoWarning = null;", + "var appLoginWithLDAP = null;", + "var appPublicURI = null;", + "var appGoogleClientID = null;", + "var appDeployDate = null;", + "var appDeployCommit = null;" + ]; + + fs.writeFileSync(__dirname + "/resources/public/js/config.js", + defaultConf.join("\n")); const tmpl = mustache({ - deployCommit, - deployDate, ts: ts, th: th, manifest: manifest, diff --git a/frontend/resources/templates/index.mustache b/frontend/resources/templates/index.mustache index 566ca82e6..ec4ef388f 100644 --- a/frontend/resources/templates/index.mustache +++ b/frontend/resources/templates/index.mustache @@ -12,14 +12,12 @@
{{# manifest}} - + diff --git a/frontend/src/uxbox/config.cljs b/frontend/src/uxbox/config.cljs index a404cef69..dc1803b1c 100644 --- a/frontend/src/uxbox/config.cljs +++ b/frontend/src/uxbox/config.cljs @@ -11,17 +11,15 @@ (:require [uxbox.util.object :as obj])) (this-as global - (let [config (obj/get global "uxboxConfig" {}) - wuri (obj/get global "uxboxWorkerURI" "/js/worker.js")] - (def default-language "en") - (def demo-warning (obj/get config "demoWarning" false)) - (def google-client-id (obj/get config "googleClientID")) - (def login-with-ldap (obj/get config "loginWithLDAP" false)) - (def worker-uri wuri) - (def public-uri (or (obj/get config "publicURI") - (.-origin ^js js/location))) - (def media-uri (str public-uri "/media")) - (def default-theme "default"))) + (def default-language "en") + (def demo-warning (obj/get global "appDemoWarning" false)) + (def google-client-id (obj/get global "appGoogleClientID" nil)) + (def login-with-ldap (obj/get global "appLoginWithLDAP" false)) + (def worker-uri (obj/get global "appWorkerURI" "/js/worker.js")) + (def public-uri (or (obj/get global "appPublicURI") + (.-origin ^js js/location))) + (def media-uri (str public-uri "/media")) + (def default-theme "default")) (defn resolve-media-path [path] diff --git a/frontend/src/uxbox/main.cljs b/frontend/src/uxbox/main.cljs index 51ae872da..aaf64adb8 100644 --- a/frontend/src/uxbox/main.cljs +++ b/frontend/src/uxbox/main.cljs @@ -12,7 +12,6 @@ [hashp.core :include-macros true] [cljs.spec.alpha :as s] [beicon.core :as rx] - [goog.object :as gobj] [rumext.alpha :as mf] [uxbox.common.uuid :as uuid] [uxbox.main.data.auth :refer [logout]] @@ -64,8 +63,8 @@ (defn ^:export init [] - (let [translations (obj/get js/window "uxboxTranslations") - themes (gobj/get js/window "uxboxThemes")] + (let [translations (obj/get js/window "appTranslations") + themes (obj/get js/window "appThemes")] (i18n/init! translations) (theme/init! themes) (st/init)