mirror of
https://github.com/penpot/penpot.git
synced 2025-07-17 04:27:15 +02:00
🎉 Add version string parsing.
This commit is contained in:
parent
ac2310f71f
commit
28a2df96ff
6 changed files with 72 additions and 29 deletions
|
@ -6,21 +6,27 @@
|
|||
<title>PENPOT - The Open-Source prototyping tool</title>
|
||||
<link id="theme" href="/css/main-{{& th}}.css?ts={{& ts}}"
|
||||
rel="stylesheet" type="text/css" />
|
||||
|
||||
<link rel="icon" href="/images/favicon.png" />
|
||||
</head>
|
||||
<body>
|
||||
{{>../public/images/sprites/symbol/svg/sprite.symbol.svg}}
|
||||
<section id="app" tabindex="1"></section>
|
||||
<section id="modal"></section>
|
||||
|
||||
<script>
|
||||
window.appTranslations = JSON.parse({{& translations}});
|
||||
window.appThemes = {{& themes}};
|
||||
window.appTranslations = JSON.parse({{& translations}});
|
||||
window.appThemes = {{& themes}};
|
||||
window.appVersion = "%version%";
|
||||
</script>
|
||||
|
||||
{{# manifest}}
|
||||
<script>window.appWorkerURI="{{& worker}}"</script>
|
||||
<script src="{{& config}}"></script>
|
||||
<script src="{{& polyfills}}"></script>
|
||||
{{/manifest}}
|
||||
|
||||
</head>
|
||||
<body>
|
||||
{{>../public/images/sprites/symbol/svg/sprite.symbol.svg}}
|
||||
<section id="app" tabindex="1"></section>
|
||||
<section id="modal"></section>
|
||||
{{# manifest}}
|
||||
<script src="{{& shared}}"></script>
|
||||
<script src="{{& main}}"></script>
|
||||
{{/manifest}}
|
||||
|
|
|
@ -10,15 +10,19 @@
|
|||
(ns app.config
|
||||
(:require
|
||||
[clojure.spec.alpha :as s]
|
||||
[app.common.data :as d]
|
||||
[app.common.spec :as us]
|
||||
[app.common.version :as v]
|
||||
[app.util.object :as obj]
|
||||
[app.util.dom :as dom]
|
||||
[cuerdas.core :as str]))
|
||||
|
||||
;; --- Auxiliar Functions
|
||||
|
||||
(s/def ::platform #{:windows :linux :macos :other})
|
||||
(s/def ::browser #{:chrome :mozilla :safari :edge :other})
|
||||
|
||||
(defn parse-browser
|
||||
(defn- parse-browser
|
||||
[]
|
||||
(let [user-agent (-> (dom/get-user-agent) str/lower)
|
||||
check-chrome? (fn [] (str/includes? user-agent "chrom"))
|
||||
|
@ -32,7 +36,7 @@
|
|||
(check-safari?) :safari
|
||||
:else :other)))
|
||||
|
||||
(defn parse-platform
|
||||
(defn- parse-platform
|
||||
[]
|
||||
(let [user-agent (-> (dom/get-user-agent) str/lower)
|
||||
check-windows? (fn [] (str/includes? user-agent "windows"))
|
||||
|
@ -44,6 +48,10 @@
|
|||
(check-macos?) :macos
|
||||
:else :other)))
|
||||
|
||||
;; --- Globar Config Vars
|
||||
|
||||
(def default-theme "default")
|
||||
|
||||
(this-as global
|
||||
(def default-language "en")
|
||||
(def demo-warning (obj/get global "appDemoWarning" false))
|
||||
|
@ -53,10 +61,18 @@
|
|||
(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")
|
||||
(def browser (parse-browser))
|
||||
(def platform (parse-platform)))
|
||||
(def version (v/parse (obj/get global "appVersion"))))
|
||||
|
||||
|
||||
(def media-uri (str public-uri "/media"))
|
||||
(def browser (parse-browser))
|
||||
(def platform (parse-platform))
|
||||
|
||||
(js/console.log
|
||||
(str/format "Welcome to pentpot! Version: '%s'" (:full version)))
|
||||
|
||||
;; --- Helper Functions
|
||||
|
||||
|
||||
(defn ^boolean check-browser? [candidate]
|
||||
(us/verify ::browser candidate)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue