diff --git a/Dockerfile b/Dockerfile index dc3f73f4..8c028681 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,6 +4,8 @@ FROM nginx:alpine # PERF-019: Only copy necessary web files (exclude .git, desktop-app, wiki, etc.) COPY index.html /usr/share/nginx/html/ COPY workspace-storage.js /usr/share/nginx/html/ +COPY visual-settings-adapters.js /usr/share/nginx/html/ +COPY visual-settings-store.js /usr/share/nginx/html/ COPY script.js /usr/share/nginx/html/ COPY styles.css /usr/share/nginx/html/ COPY sw.js /usr/share/nginx/html/ @@ -12,6 +14,8 @@ COPY manifest.json /usr/share/nginx/html/ COPY robots.txt /usr/share/nginx/html/ COPY sitemap.xml /usr/share/nginx/html/ COPY assets/ /usr/share/nginx/html/assets/ +COPY seo/locales.mjs /usr/share/nginx/html/seo/ +COPY seo/welcome-content.mjs /usr/share/nginx/html/seo/ # Create a custom nginx configuration with compression and security # PERF-020: Added gzip compression for text-based assets diff --git a/desktop-app/prepare.js b/desktop-app/prepare.js index b265bf44..2027b792 100644 --- a/desktop-app/prepare.js +++ b/desktop-app/prepare.js @@ -49,6 +49,15 @@ console.log("✓ Copied script.js → resources/js/script.js"); fs.copyFileSync(path.join(ROOT_DIR, "workspace-storage.js"), path.join(jsDest, "workspace-storage.js")); console.log("✓ Copied workspace-storage.js → resources/js/workspace-storage.js"); +if (fs.existsSync(path.join(ROOT_DIR, "visual-settings-store.js"))) { + fs.copyFileSync(path.join(ROOT_DIR, "visual-settings-store.js"), path.join(jsDest, "visual-settings-store.js")); + console.log("✓ Copied visual-settings-store.js → resources/js/visual-settings-store.js"); +} +if (fs.existsSync(path.join(ROOT_DIR, "visual-settings-adapters.js"))) { + fs.copyFileSync(path.join(ROOT_DIR, "visual-settings-adapters.js"), path.join(jsDest, "visual-settings-adapters.js")); + console.log("✓ Copied visual-settings-adapters.js → resources/js/visual-settings-adapters.js"); +} + fs.copyFileSync(path.join(ROOT_DIR, "preview-worker.js"), path.join(jsDest, "preview-worker.js")); console.log("Copied preview-worker.js to resources/js/preview-worker.js"); @@ -262,9 +271,9 @@ async function prepareOfflineDependencies() { hash: null }, { - url: "https://cdnjs.cloudflare.com/ajax/libs/mathjax/3.2.2/es5/tex-mml-chtml.min.js", - dest: path.join(LIBS_DIR, "tex-mml-chtml.min.js"), - hash: null + url: "https://cdn.jsdelivr.net/npm/mathjax@4.0.0-beta.7/tex-mml-chtml.js", + dest: path.join(LIBS_DIR, "tex-mml-chtml.js"), + hash: "sha384-2f5bAKjuFIbbQ+0O9aSu5W1OyLA4q80QrDEvjXDwJexjU9VqoJhMgw19pYVpSJab" }, { url: "https://cdnjs.cloudflare.com/ajax/libs/jspdf/2.5.1/jspdf.umd.min.js", @@ -305,6 +314,12 @@ async function prepareOfflineDependencies() { // Wait for all downloads and cryptographic validations to finish try { await Promise.all(downloads); + // Keep backwards-compatible copy for tex-mml-chtml.min.js + const mathjaxDest = path.join(LIBS_DIR, "tex-mml-chtml.js"); + const mathjaxMinDest = path.join(LIBS_DIR, "tex-mml-chtml.min.js"); + if (fs.existsSync(mathjaxDest)) { + fs.copyFileSync(mathjaxDest, mathjaxMinDest); + } console.log("✓ All offline libraries successfully downloaded and cryptographically validated."); } catch (err) { console.error("✗ Critical Security Error: Dependency integrity check failed!", err.message); @@ -320,6 +335,8 @@ async function prepareOfflineDependencies() { html = html.replace(/href="assets\//g, 'href="/assets/'); html = html.replace(/href="styles\.css"/g, 'href="/styles.css"'); html = html.replace(/href="workspace-storage\.js"/g, 'href="/js/workspace-storage.js"'); + html = html.replace(/href="visual-settings-adapters\.js"/g, 'href="/js/visual-settings-adapters.js"'); + html = html.replace(/href="visual-settings-store\.js"/g, 'href="/js/visual-settings-store.js"'); html = html.replace(/href="script\.js"/g, 'href="/js/script.js"'); // PERF-034: Strip web-specific SEO tags, canonical, hreflang, preconnect, manifest and JSON-LD structured data for desktop build @@ -333,8 +350,18 @@ async function prepareOfflineDependencies() { // Inject Neutralino script tags html = html.replace( - /]*><\/script>\s*]*><\/script>/i, - '\n \n \n ', + /]*><\/script>(?:\s*]*><\/script>)?(?:\s*]*><\/script>)?\s*]*><\/script>/i, + (match) => { + let tags = '\n \n '; + if (match.includes('visual-settings-adapters.js')) { + tags += '\n '; + } + if (match.includes('visual-settings-store.js')) { + tags += '\n '; + } + tags += '\n '; + return tags; + } ); // Inject app-info element diff --git a/desktop-app/resources/index.html b/desktop-app/resources/index.html index e4192e2f..f101008c 100644 --- a/desktop-app/resources/index.html +++ b/desktop-app/resources/index.html @@ -7,6 +7,8 @@ + + @@ -121,6 +123,10 @@

Markdown Viewer - Online Markd + +