mirror of
https://github.com/Memo-2023/mana-monorepo.git
synced 2026-05-16 18:39:41 +02:00
Remove standalone app Umami website IDs from .env.development and generate-env.mjs. Remove injectUmamiAnalytics from all 21 standalone app hooks.server.ts files. All analytics now flow through the single ManaCore unified app website ID with module-level segmentation. Landing page IDs are preserved (separate Astro sites). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
27 lines
1 KiB
TypeScript
27 lines
1 KiB
TypeScript
import type { Handle } from '@sveltejs/kit';
|
|
import { setSecurityHeaders } from '@manacore/shared-utils/security-headers';
|
|
|
|
const PUBLIC_MANA_CORE_AUTH_URL_CLIENT =
|
|
process.env.PUBLIC_MANA_CORE_AUTH_URL_CLIENT || process.env.PUBLIC_MANA_CORE_AUTH_URL || '';
|
|
const PUBLIC_BACKEND_URL_CLIENT =
|
|
process.env.PUBLIC_BACKEND_URL_CLIENT || process.env.PUBLIC_BACKEND_URL || '';
|
|
const PUBLIC_GLITCHTIP_DSN = process.env.PUBLIC_GLITCHTIP_DSN || '';
|
|
|
|
export const handle: Handle = async ({ event, resolve }) => {
|
|
const response = await resolve(event, {
|
|
transformPageChunk: ({ html }) => {
|
|
const envScript = `<script>
|
|
window.__PUBLIC_MANA_CORE_AUTH_URL__ = ${JSON.stringify(PUBLIC_MANA_CORE_AUTH_URL_CLIENT)};
|
|
window.__PUBLIC_BACKEND_URL__ = ${JSON.stringify(PUBLIC_BACKEND_URL_CLIENT)};
|
|
window.__PUBLIC_GLITCHTIP_DSN__ = ${JSON.stringify(PUBLIC_GLITCHTIP_DSN)};
|
|
</script>`;
|
|
return html.replace('<head>', `<head>${envScript}`);
|
|
},
|
|
});
|
|
|
|
setSecurityHeaders(response, {
|
|
connectSrc: [PUBLIC_MANA_CORE_AUTH_URL_CLIENT, PUBLIC_BACKEND_URL_CLIENT],
|
|
});
|
|
|
|
return response;
|
|
};
|