aprs.me/lib/aprsme_web/components/layouts/root.html.heex
Graham McIntire dade93ee5c
Implement Sentry JavaScript integration with proper CSP configuration
- Restored Sentry JavaScript SDK script tag
- Created custom ContentSecurityPolicy plug to allow Sentry domains
- Added proper CSP headers allowing:
  - js.sentry-cdn.com for the SDK
  - *.ingest.sentry.io and *.sentry.io for error reporting
- Initialized Sentry in app.js with:
  - Proper DSN configuration
  - Browser tracing integration
  - 10% transaction sampling rate
  - Filter for non-critical ResizeObserver errors
- Added CSP plug to router pipeline after put_secure_browser_headers

This properly integrates Sentry for JavaScript error tracking while
maintaining security through explicit CSP configuration.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-18 15:17:35 -05:00

73 lines
2.3 KiB
Text

<!DOCTYPE html>
<html lang="en" data-theme="light">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="csrf-token" content={get_csrf_token()} />
<script>
(function() {
try {
var theme = (typeof localStorage !== 'undefined' && localStorage.getItem('theme')) || 'auto';
if(theme === 'auto') {
if(window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) {
document.documentElement.setAttribute('data-theme', 'dark');
} else {
document.documentElement.setAttribute('data-theme', 'light');
}
} else {
document.documentElement.setAttribute('data-theme', theme);
}
} catch(e) {
document.documentElement.setAttribute('data-theme', 'light');
}
})();
</script>
<.live_title suffix=" · aprs.me">
{assigns[:page_title] || "Aprs"}
</.live_title>
<link phx-track-static rel="stylesheet" href={~p"/assets/css/app.css"} />
<link
rel="stylesheet"
href="https://unpkg.com/leaflet@1.9.4/dist/leaflet.css"
integrity="sha256-p4NxAoJBhIIN+hmNHrzRCf9tD/miZyoHS5obTRR9BMY="
crossorigin=""
/>
<script
defer
phx-track-static
type="text/javascript"
src="https://unpkg.com/leaflet@1.9.4/dist/leaflet.js"
data-source-map="false"
>
</script>
<%!-- Load Leaflet.heat after Leaflet is loaded --%>
<script
defer
phx-track-static
type="text/javascript"
src="https://cdn.jsdelivr.net/npm/leaflet.heat@0.2.0/dist/leaflet-heat.js"
>
</script>
<script
defer
phx-track-static
type="text/javascript"
src="https://cdn.jsdelivr.net/npm/chart.js@4.5.0/dist/chart.umd.js"
>
</script>
<script
defer
phx-track-static
type="text/javascript"
src="https://cdn.jsdelivr.net/npm/chartjs-adapter-date-fns@3.0.0/dist/chartjs-adapter-date-fns.bundle.min.js"
>
</script>
<script defer phx-track-static type="text/javascript" src={~p"/assets/app.js"}>
</script>
<script src="https://js.sentry-cdn.com/be4b53768e7c243cc72fa78ee7b7ec8c.min.js" crossorigin="anonymous">
</script>
</head>
<body class={body_class(assigns)}>
{@inner_content}
</body>
</html>