From 902a2300955b29a9dae48d3d9d2b87bd58a9862f Mon Sep 17 00:00:00 2001 From: chrox Date: Wed, 11 Dec 2024 03:43:56 +0100 Subject: [PATCH] Fix background image color and font server csp --- apps/readest-app/src-tauri/tauri.conf.json | 2 +- apps/readest-app/src/utils/style.ts | 15 +++++++-------- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/apps/readest-app/src-tauri/tauri.conf.json b/apps/readest-app/src-tauri/tauri.conf.json index bd2740cd..9883d617 100644 --- a/apps/readest-app/src-tauri/tauri.conf.json +++ b/apps/readest-app/src-tauri/tauri.conf.json @@ -13,7 +13,7 @@ "windows": [], "security": { "csp": { - "default-src": "'self' 'unsafe-inline' blob: customprotocol: asset: http://asset.localhost ipc: http://ipc.localhost https://fonts.gstatic.com", + "default-src": "'self' 'unsafe-inline' blob: customprotocol: asset: http://asset.localhost ipc: http://ipc.localhost https://fonts.gstatic.com https://db.onlinewebfonts.com", "connect-src": "'self' blob: asset: http://asset.localhost ipc: http://ipc.localhost https://*.sentry.io https://*.posthog.com https://*.deepl.com https://*.wikipedia.org https://*.wiktionary.org", "img-src": "'self' blob: data: asset: http://asset.localhost", "style-src": "'self' 'unsafe-inline' blob: asset: http://asset.localhost", diff --git a/apps/readest-app/src/utils/style.ts b/apps/readest-app/src/utils/style.ts index 3f798af9..ad30b13a 100644 --- a/apps/readest-app/src/utils/style.ts +++ b/apps/readest-app/src/utils/style.ts @@ -50,12 +50,12 @@ const getAdditionalFontFaces = () => ` } @font-face { font-family: "Heiti"; - src: url("https://db.onlinewebfonts.com/t/881ef4472a9f34e6d8beb1cad649d168.eot"); - src: url("https://db.onlinewebfonts.com/t/881ef4472a9f34e6d8beb1cad649d168.eot?#iefix")format("embedded-opentype"), - url("https://db.onlinewebfonts.com/t/881ef4472a9f34e6d8beb1cad649d168.woff2")format("woff2"), - url("https://db.onlinewebfonts.com/t/881ef4472a9f34e6d8beb1cad649d168.woff")format("woff"), - url("https://db.onlinewebfonts.com/t/881ef4472a9f34e6d8beb1cad649d168.ttf")format("truetype"), - url("https://db.onlinewebfonts.com/t/881ef4472a9f34e6d8beb1cad649d168.svg#STHeiti SC Medium")format("svg"); + src: url("https://db.onlinewebfonts.com/t/a4948b9d43a91468825a5251df1ec58d.eot"); + src: url("https://db.onlinewebfonts.com/t/a4948b9d43a91468825a5251df1ec58d.eot?#iefix")format("embedded-opentype"), + url("https://db.onlinewebfonts.com/t/a4948b9d43a91468825a5251df1ec58d.woff2")format("woff2"), + url("https://db.onlinewebfonts.com/t/a4948b9d43a91468825a5251df1ec58d.woff")format("woff"), + url("https://db.onlinewebfonts.com/t/a4948b9d43a91468825a5251df1ec58d.ttf")format("truetype"), + url("https://db.onlinewebfonts.com/t/a4948b9d43a91468825a5251df1ec58d.svg#WenQuanYi Micro Hei")format("svg"); } `; @@ -108,14 +108,13 @@ const getLayoutStyles = ( color: ${fg}; zoom: ${zoomLevel}%; } - body * { + body *:not(#b1):not(#b1 *):not(#b2):not(#b2 *) { color: inherit; border-color: currentColor !important; ${bg === '#ffffff' ? '' : `background-color: ${bg} !important;`} } svg, img { background-color: transparent !important; - mix-blend-mode: multiply; } p, li, blockquote, dd { text-align: ${justify ? 'justify' : 'start'};