Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

refactor: keep the preview CSP injector private to the staging module

[._.]/ Adam Eivyb5e89a79e440
diff --git a/server/services/generatedPreview/codeAnimationPage.js b/server/services/generatedPreview/codeAnimationPage.js
index b685bcbd11..53449268aa 100644
--- a/server/services/generatedPreview/codeAnimationPage.js
+++ b/server/services/generatedPreview/codeAnimationPage.js
@@ -13,7 +13,7 @@ const IDENT = /^[A-Za-z_$][A-Za-z0-9_$]{0,63}$/;
const SCRATCH_DIR = 'music-video-song-renders';
// Any CSP the generated page declares is replaced: the host's policy is the only one.
-export function injectPolicy(html, { csp, audioGlobal, audioDataUrl }) {
+function injectPolicy(html, { csp, audioGlobal, audioDataUrl }) {
const stripped = String(html).replace(/<meta\b[^>]*http-equiv\s*=\s*["']?Content-Security-Policy["']?[^>]*>/gi, '');
const audio = audioDataUrl && IDENT.test(String(audioGlobal || ''))
? `<script>window[${JSON.stringify(audioGlobal)}] = ${JSON.stringify(audioDataUrl).replace(/</g, '\\u003c')};</script>`