Skip to content

Commit

Permalink
improve(electron): adapt some remote resources to local
Browse files Browse the repository at this point in the history
  • Loading branch information
xyhp915 committed Jan 26, 2021
1 parent 361e84b commit 9cb8bdd
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 45 deletions.
78 changes: 39 additions & 39 deletions resources/css/inter.css
Expand Up @@ -3,152 +3,152 @@
font-style: normal;
font-weight: 100;
font-display: swap;
src: url("/static/fonts/inter/Inter-Thin.woff2?v=3.15") format("woff2"),
url("/static/fonts/inter/Inter-Thin.woff?v=3.15") format("woff");
src: url("../fonts/inter/Inter-Thin.woff2?v=3.15") format("woff2"),
url("../fonts/inter/Inter-Thin.woff?v=3.15") format("woff");
}
@font-face {
font-family: 'Inter';
font-style: italic;
font-weight: 100;
font-display: swap;
src: url("/static/fonts/inter/Inter-ThinItalic.woff2?v=3.15") format("woff2"),
url("/static/fonts/inter/Inter-ThinItalic.woff?v=3.15") format("woff");
src: url("../fonts/inter/Inter-ThinItalic.woff2?v=3.15") format("woff2"),
url("../fonts/inter/Inter-ThinItalic.woff?v=3.15") format("woff");
}

@font-face {
font-family: 'Inter';
font-style: normal;
font-weight: 200;
font-display: swap;
src: url("/static/fonts/inter/Inter-ExtraLight.woff2?v=3.15") format("woff2"),
url("/static/fonts/inter/Inter-ExtraLight.woff?v=3.15") format("woff");
src: url("../fonts/inter/Inter-ExtraLight.woff2?v=3.15") format("woff2"),
url("../fonts/inter/Inter-ExtraLight.woff?v=3.15") format("woff");
}
@font-face {
font-family: 'Inter';
font-style: italic;
font-weight: 200;
font-display: swap;
src: url("/static/fonts/inter/Inter-ExtraLightItalic.woff2?v=3.15") format("woff2"),
url("/static/fonts/inter/Inter-ExtraLightItalic.woff?v=3.15") format("woff");
src: url("../fonts/inter/Inter-ExtraLightItalic.woff2?v=3.15") format("woff2"),
url("../fonts/inter/Inter-ExtraLightItalic.woff?v=3.15") format("woff");
}

@font-face {
font-family: 'Inter';
font-style: normal;
font-weight: 300;
font-display: swap;
src: url("/static/fonts/inter/Inter-Light.woff2?v=3.15") format("woff2"),
url("/static/fonts/inter/Inter-Light.woff?v=3.15") format("woff");
src: url("../fonts/inter/Inter-Light.woff2?v=3.15") format("woff2"),
url("../fonts/inter/Inter-Light.woff?v=3.15") format("woff");
}
@font-face {
font-family: 'Inter';
font-style: italic;
font-weight: 300;
font-display: swap;
src: url("/static/fonts/inter/Inter-LightItalic.woff2?v=3.15") format("woff2"),
url("/static/fonts/inter/Inter-LightItalic.woff?v=3.15") format("woff");
src: url("../fonts/inter/Inter-LightItalic.woff2?v=3.15") format("woff2"),
url("../fonts/inter/Inter-LightItalic.woff?v=3.15") format("woff");
}

@font-face {
font-family: 'Inter';
font-style: normal;
font-weight: 400;
font-display: swap;
src: url("/static/fonts/inter/Inter-Regular.woff2?v=3.15") format("woff2"),
url("/static/fonts/inter/Inter-Regular.woff?v=3.15") format("woff");
src: url("../fonts/inter/Inter-Regular.woff2?v=3.15") format("woff2"),
url("../fonts/inter/Inter-Regular.woff?v=3.15") format("woff");
}
@font-face {
font-family: 'Inter';
font-style: italic;
font-weight: 400;
font-display: swap;
src: url("/static/fonts/inter/Inter-Italic.woff2?v=3.15") format("woff2"),
url("/static/fonts/inter/Inter-Italic.woff?v=3.15") format("woff");
src: url("../fonts/inter/Inter-Italic.woff2?v=3.15") format("woff2"),
url("../fonts/inter/Inter-Italic.woff?v=3.15") format("woff");
}

@font-face {
font-family: 'Inter';
font-style: normal;
font-weight: 500;
font-display: swap;
src: url("/static/fonts/inter/Inter-Medium.woff2?v=3.15") format("woff2"),
url("/static/fonts/inter/Inter-Medium.woff?v=3.15") format("woff");
src: url("../fonts/inter/Inter-Medium.woff2?v=3.15") format("woff2"),
url("../fonts/inter/Inter-Medium.woff?v=3.15") format("woff");
}
@font-face {
font-family: 'Inter';
font-style: italic;
font-weight: 500;
font-display: swap;
src: url("/static/fonts/inter/Inter-MediumItalic.woff2?v=3.15") format("woff2"),
url("/static/fonts/inter/Inter-MediumItalic.woff?v=3.15") format("woff");
src: url("../fonts/inter/Inter-MediumItalic.woff2?v=3.15") format("woff2"),
url("../fonts/inter/Inter-MediumItalic.woff?v=3.15") format("woff");
}

@font-face {
font-family: 'Inter';
font-style: normal;
font-weight: 600;
font-display: swap;
src: url("/static/fonts/inter/Inter-SemiBold.woff2?v=3.15") format("woff2"),
url("/static/fonts/inter/Inter-SemiBold.woff?v=3.15") format("woff");
src: url("../fonts/inter/Inter-SemiBold.woff2?v=3.15") format("woff2"),
url("../fonts/inter/Inter-SemiBold.woff?v=3.15") format("woff");
}
@font-face {
font-family: 'Inter';
font-style: italic;
font-weight: 600;
font-display: swap;
src: url("/static/fonts/inter/Inter-SemiBoldItalic.woff2?v=3.15") format("woff2"),
url("/static/fonts/inter/Inter-SemiBoldItalic.woff?v=3.15") format("woff");
src: url("../fonts/inter/Inter-SemiBoldItalic.woff2?v=3.15") format("woff2"),
url("../fonts/inter/Inter-SemiBoldItalic.woff?v=3.15") format("woff");
}

@font-face {
font-family: 'Inter';
font-style: normal;
font-weight: 700;
font-display: swap;
src: url("/static/fonts/inter/Inter-Bold.woff2?v=3.15") format("woff2"),
url("/static/fonts/inter/Inter-Bold.woff?v=3.15") format("woff");
src: url("../fonts/inter/Inter-Bold.woff2?v=3.15") format("woff2"),
url("../fonts/inter/Inter-Bold.woff?v=3.15") format("woff");
}
@font-face {
font-family: 'Inter';
font-style: italic;
font-weight: 700;
font-display: swap;
src: url("/static/fonts/inter/Inter-BoldItalic.woff2?v=3.15") format("woff2"),
url("/static/fonts/inter/Inter-BoldItalic.woff?v=3.15") format("woff");
src: url("../fonts/inter/Inter-BoldItalic.woff2?v=3.15") format("woff2"),
url("../fonts/inter/Inter-BoldItalic.woff?v=3.15") format("woff");
}

@font-face {
font-family: 'Inter';
font-style: normal;
font-weight: 800;
font-display: swap;
src: url("/static/fonts/inter/Inter-ExtraBold.woff2?v=3.15") format("woff2"),
url("/static/fonts/inter/Inter-ExtraBold.woff?v=3.15") format("woff");
src: url("../fonts/inter/Inter-ExtraBold.woff2?v=3.15") format("woff2"),
url("../fonts/inter/Inter-ExtraBold.woff?v=3.15") format("woff");
}
@font-face {
font-family: 'Inter';
font-style: italic;
font-weight: 800;
font-display: swap;
src: url("/static/fonts/inter/Inter-ExtraBoldItalic.woff2?v=3.15") format("woff2"),
url("/static/fonts/inter/Inter-ExtraBoldItalic.woff?v=3.15") format("woff");
src: url("../fonts/inter/Inter-ExtraBoldItalic.woff2?v=3.15") format("woff2"),
url("../fonts/inter/Inter-ExtraBoldItalic.woff?v=3.15") format("woff");
}

@font-face {
font-family: 'Inter';
font-style: normal;
font-weight: 900;
font-display: swap;
src: url("/static/fonts/inter/Inter-Black.woff2?v=3.15") format("woff2"),
url("/static/fonts/inter/Inter-Black.woff?v=3.15") format("woff");
src: url("../fonts/inter/Inter-Black.woff2?v=3.15") format("woff2"),
url("../fonts/inter/Inter-Black.woff?v=3.15") format("woff");
}
@font-face {
font-family: 'Inter';
font-style: italic;
font-weight: 900;
font-display: swap;
src: url("/static/fonts/inter/Inter-BlackItalic.woff2?v=3.15") format("woff2"),
url("/static/fonts/inter/Inter-BlackItalic.woff?v=3.15") format("woff");
src: url("../fonts/inter/Inter-BlackItalic.woff2?v=3.15") format("woff2"),
url("../fonts/inter/Inter-BlackItalic.woff?v=3.15") format("woff");
}

/* -------------------------------------------------------
Expand All @@ -166,15 +166,15 @@ Usage:
font-display: swap;
font-style: normal;
font-named-instance: 'Regular';
src: url("/static/fonts/inter/Inter-roman.var.woff2?v=3.15") format("woff2");
src: url("../fonts/inter/Inter-roman.var.woff2?v=3.15") format("woff2");
}
@font-face {
font-family: 'Inter var';
font-weight: 100 900;
font-display: swap;
font-style: italic;
font-named-instance: 'Italic';
src: url("/static/fonts/inter/Inter-italic.var.woff2?v=3.15") format("woff2");
src: url("../fonts/inter/Inter-italic.var.woff2?v=3.15") format("woff2");
}


Expand All @@ -196,5 +196,5 @@ explicitly, e.g.
font-weight: 100 900;
font-display: swap;
font-style: oblique 0deg 10deg;
src: url("/static/fonts/inter/Inter.var.woff2?v=3.15") format("woff2");
src: url("../fonts/inter/Inter.var.woff2?v=3.15") format("woff2");
}
4 changes: 2 additions & 2 deletions resources/css/style.css
Expand Up @@ -9,6 +9,6 @@
@import "./table.css";
@import "./datepicker.css";
@import "./highlight.css";
@import "../../static/css/tailwind.core.css"; /* Build by gulp. Check `_buildTailwind` for more detail */
@import "./tailwind.core.css"; /* Build by gulp. Check `_buildTailwind` for more detail */
@import "./common.css";
@import "../../static/css/tailwind.build.css"; /* Build by gulp. Check `_buildTailwind` for more detail */
@import "./tailwind.build.css"; /* Build by gulp. Check `_buildTailwind` for more detail */
4 changes: 2 additions & 2 deletions resources/forge.config.js
Expand Up @@ -2,7 +2,7 @@ const path = require('path')

module.exports = {
packagerConfig: {
icon: './icons/logseq.icns'
icon: './icons/logseq_big_sur.icns'
},

makers: [
Expand All @@ -17,7 +17,7 @@ module.exports = {
config: {
background: './img/dmg-bg.png',
format: 'ULFO',
icon: './icons/logseq.icns',
icon: './icons/logseq_big_sur.icns',
name: 'Logseq'
}
},
Expand Down
6 changes: 4 additions & 2 deletions src/main/frontend/config.cljs
Expand Up @@ -31,8 +31,10 @@

(defn asset-uri
[path]
(if dev? path
(str asset-domain path)))
(if (util/file-protocol?)
(string/replace path "/static/" "./")
(if dev? path
(str asset-domain path))))

(goog-define GITHUB_APP_NAME "logseq-test")

Expand Down
5 changes: 5 additions & 0 deletions src/main/frontend/util.cljc
Expand Up @@ -56,6 +56,11 @@
(let [ua (string/lower-case js/navigator.userAgent)]
(string/includes? ua " electron"))))

#?(:cljs
(defn file-protocol?
[]
(string/starts-with? js/window.location.href "file://")))

(defn format
[fmt & args]
#?(:cljs (apply gstring/format fmt args)
Expand Down

0 comments on commit 9cb8bdd

Please sign in to comment.