From 638ce8011375dc90e23ec4e9209dd79b38772e10 Mon Sep 17 00:00:00 2001 From: FloatingGhost Date: Mon, 2 Jan 2023 15:16:42 +0000 Subject: [PATCH] Make everything work with a strict CSP --- index.html | 1 + package.json | 2 +- src/App.scss | 3 ++- src/boot/after_store.js | 2 ++ src/components/pinch_zoom/pinch_zoom.js | 2 +- src/services/style_setter/style_setter.js | 4 +--- static/theme-holder.css | 1 + yarn.lock | 14 +++++++------- 8 files changed, 16 insertions(+), 13 deletions(-) create mode 100644 static/theme-holder.css diff --git a/index.html b/index.html index 79613dd2..fda91b0f 100644 --- a/index.html +++ b/index.html @@ -10,6 +10,7 @@ + diff --git a/package.json b/package.json index e712cffd..5fb3ae8c 100644 --- a/package.json +++ b/package.json @@ -22,7 +22,7 @@ "@fortawesome/free-regular-svg-icons": "^6.1.2", "@fortawesome/free-solid-svg-icons": "^6.2.0", "@fortawesome/vue-fontawesome": "3.0.1", - "@kazvmoe-infra/pinch-zoom-element": "1.2.0", + "@floatingghost/pinch-zoom-element": "^1.3.1", "@vuelidate/core": "^2.0.0", "@vuelidate/validators": "^2.0.0", "body-scroll-lock": "2.7.1", diff --git a/src/App.scss b/src/App.scss index 7e6d0dfc..38574cab 100644 --- a/src/App.scss +++ b/src/App.scss @@ -1,6 +1,7 @@ // stylelint-disable rscss/class-format @import './_variables.scss'; - +@import '@fortawesome/fontawesome-svg-core/styles.css'; +@import '@floatingghost/pinch-zoom-element/dist/pinch-zoom.css'; :root { --navbar-height: 3.5rem; --post-line-height: 1.4; diff --git a/src/boot/after_store.js b/src/boot/after_store.js index 4bafca1d..36b087a5 100644 --- a/src/boot/after_store.js +++ b/src/boot/after_store.js @@ -4,6 +4,8 @@ import { createRouter, createWebHistory } from 'vue-router' import vClickOutside from 'click-outside-vue3' import { FontAwesomeIcon, FontAwesomeLayers } from '@fortawesome/vue-fontawesome' +import { config } from '@fortawesome/fontawesome-svg-core'; +config.autoAddCss = false import App from '../App.vue' import routes from './routes' diff --git a/src/components/pinch_zoom/pinch_zoom.js b/src/components/pinch_zoom/pinch_zoom.js index 82670ddf..b7e8f673 100644 --- a/src/components/pinch_zoom/pinch_zoom.js +++ b/src/components/pinch_zoom/pinch_zoom.js @@ -1,4 +1,4 @@ -import PinchZoom from '@kazvmoe-infra/pinch-zoom-element' +import PinchZoom from '@floatingghost/pinch-zoom-element' export default { methods: { diff --git a/src/services/style_setter/style_setter.js b/src/services/style_setter/style_setter.js index d5bf8749..9e691261 100644 --- a/src/services/style_setter/style_setter.js +++ b/src/services/style_setter/style_setter.js @@ -4,12 +4,10 @@ import { getColors, computeDynamicColor, getOpacitySlot } from '../theme_data/th export const applyTheme = (input) => { const { rules } = generatePreset(input) - const head = document.head const body = document.body body.classList.add('hidden') - const styleEl = document.createElement('style') - head.appendChild(styleEl) + const styleEl = document.getElementById('theme-holder') const styleSheet = styleEl.sheet styleSheet.toString() diff --git a/static/theme-holder.css b/static/theme-holder.css new file mode 100644 index 00000000..3e884036 --- /dev/null +++ b/static/theme-holder.css @@ -0,0 +1 @@ +// This file intentionally left blank diff --git a/yarn.lock b/yarn.lock index bbceba0b..d960fc8c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1350,6 +1350,13 @@ minimatch "^3.0.4" strip-json-comments "^3.1.1" +"@floatingghost/pinch-zoom-element@^1.3.1": + version "1.3.1" + resolved "https://registry.yarnpkg.com/@floatingghost/pinch-zoom-element/-/pinch-zoom-element-1.3.1.tgz#5f327ad17ddf1f56777098aca088fdbf99cbd049" + integrity sha512-KnE7aBQdd/Fj1TzU5uzgwD9YAQ58DTMUks/PoTEBFW4zi0lBM9cN/j45wzcnzsT2VXG1S6qM7NMmq7NGm2//Fg== + dependencies: + pointer-tracker "^2.0.3" + "@fortawesome/fontawesome-common-types@6.2.0": version "6.2.0" resolved "https://registry.npmjs.org/@fortawesome/fontawesome-common-types/-/fontawesome-common-types-6.2.0.tgz" @@ -1516,13 +1523,6 @@ "@jridgewell/resolve-uri" "^3.0.3" "@jridgewell/sourcemap-codec" "^1.4.10" -"@kazvmoe-infra/pinch-zoom-element@1.2.0": - version "1.2.0" - resolved "https://registry.npmjs.org/@kazvmoe-infra/pinch-zoom-element/-/pinch-zoom-element-1.2.0.tgz" - integrity sha512-HBrhH5O/Fsp2bB7EGTXzCsBAVcMjknSagKC5pBdGpKsF8meHISR0kjDIdw4YoE0S+0oNMwJ6ZUZyIBrdywxPPw== - dependencies: - pointer-tracker "^2.0.3" - "@nicolo-ribaudo/eslint-scope-5-internals@5.1.1-v1": version "5.1.1-v1" resolved "https://registry.yarnpkg.com/@nicolo-ribaudo/eslint-scope-5-internals/-/eslint-scope-5-internals-5.1.1-v1.tgz#dbf733a965ca47b1973177dc0bb6c889edcfb129"