fix(spa): clean up three CSP + manifest console errors on msp.a8n.systems #414
No reviewers
Labels
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
psa-systems/mokosh-apps!414
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/MAPPS-356-console-errors"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Every fresh page load logged three errors that were cosmetic (app rendered fine) but trained users to ignore the console and drowned any real error. All three are static-asset issues in this repo, no server-side change required.
Drop the Google Fonts .
assets/styles.css--font-sans/--font-monoalready declareInter/JetBrains Monofirst with a system-font fallback chain (ui-sans-serif, system-ui, -apple-system, ...), so users have been seeing the system fallback anyway - the SPA's CSPstyle-src 'self' 'unsafe-inline'refusesfonts.googleapis.com, so the stylesheet load was blocked at runtime. Removing the two<link rel="preconnect">lines and the stylesheet<link>deletes the console noise without changing the rendered look. If we want Inter shipped for real later, self-host underassets/fonts/(out of scope).Extract the FOUC-prevention theme applier from an inline
<script>block toassets/theme-init.jsand reference it as<script src="/assets/theme-init.js"></script>. Same-origin external scripts satisfyscript-src 'self' 'wasm-unsafe-eval'; the inline block was blocked at runtime, so the FOUC guard was doing nothing today. The extracted file also wraps its body in a try/catch so alocalStoragerefusal (private mode, ITP, third-party-cookie block) does not throw uncaught during head parse - falls back toprefers-color-schemeand gives up quietly if that also fails.Drop
favicon.svgfromassets/manifest.webmanifest'siconsarray. The file is a 409 KB<svg>wrapper around a base64 PNG, which browser manifest icon parsers reject as "not a valid image" (they want vector content, not embedded raster). The three PNG entries (192 / 512 / 512-maskable) remain and are what the PWA install actually uses.favicon.svgstays in place for the<link rel="icon" type="image/svg+xml" href="/favicon.svg">in<head>because the tab-icon parser tolerates the embedded-raster shape; only the manifest parser refuses it.#MAPPS-356