Turn any website into a lightweight desktop app with one command, on macOS, Windows and Linux.
Rust chatgptclaudeclidesktopdesktop-appelectron-alternativegeminilinuxmacosnativefierno-electronrusttauriweb-to-desktopwebsite-to-appwebviewwindowsyoutube
fix: use textContent instead of innerHTML for style injection to avoid CSP violations
九条涼果6350a184b288
diff --git a/bin/utils/combine.ts b/bin/utils/combine.tsindex 5f85ba0d..dc9c1ab1 100644--- a/bin/utils/combine.ts+++ b/bin/utils/combine.ts@@ -7,7 +7,7 @@ export default async function combineFiles(files: string[], output: string) {return `window.addEventListener('DOMContentLoaded', (_event) => {const css = ${JSON.stringify(fileContent)};const style = document.createElement('style');- style.innerHTML = css;+ style.textContent = css;document.head.appendChild(style);});`;}diff --git a/src-tauri/src/inject/style.js b/src-tauri/src/inject/style.jsindex c34a0e08..5b089211 100644--- a/src-tauri/src/inject/style.js+++ b/src-tauri/src/inject/style.js@@ -300,7 +300,7 @@ window.addEventListener("DOMContentLoaded", (_event) => {}`;const contentStyleElement = document.createElement("style");- contentStyleElement.innerHTML = contentCSS;+ contentStyleElement.textContent = contentCSS;document.head.appendChild(contentStyleElement);// Top spacing adapts to head-hiding scenarios@@ -474,7 +474,7 @@ window.addEventListener("DOMContentLoaded", (_event) => {const isMac = navigator.platform.toUpperCase().indexOf("MAC") >= 0;if (window["pakeConfig"]?.hide_title_bar && isMac) {const topPaddingStyleElement = document.createElement("style");- topPaddingStyleElement.innerHTML = topPaddingCSS;+ topPaddingStyleElement.textContent = topPaddingCSS;document.head.appendChild(topPaddingStyleElement);}});