Compare commits

...
2 Commits
Author SHA1 Message Date
ben f65c816464 Default the UI appearance to dark mode for new visitors.
Keep the Flux light/dark/system toggle; persist system explicitly so the app default can stay dark.
2026-08-12 22:12:52 +02:00
ben d60851bb53 Trust reverse proxies so HTTPS asset URLs work behind CPM.
Without TrustProxies, Laravel generated http:// links after TLS termination and browsers blocked CSS/JS as mixed content.
2026-08-12 22:06:22 +02:00
2 changed files with 43 additions and 1 deletions
+10
View File
@@ -13,6 +13,16 @@ return Application::configure(basePath: dirname(__DIR__))
health: '/up',
)
->withMiddleware(function (Middleware $middleware): void {
// CPM/Caddy terminates TLS; trust forwarded proto/host so asset() URLs stay https.
$middleware->trustProxies(
at: '*',
headers: Request::HEADER_X_FORWARDED_FOR
| Request::HEADER_X_FORWARDED_HOST
| Request::HEADER_X_FORWARDED_PORT
| Request::HEADER_X_FORWARDED_PROTO
| Request::HEADER_X_FORWARDED_PREFIX,
);
$middleware->redirectGuestsTo(fn () => route('login'));
$middleware->redirectUsersTo(fn () => route('recordings.index'));
})
+33 -1
View File
@@ -11,4 +11,36 @@
<link href="https://fonts.bunny.net/css?family=inter:400,500,600&display=swap" rel="stylesheet" />
@vite(['resources/css/app.css', 'resources/js/app.js'])
@fluxAppearance
{{-- Flux appearance with dark as the default (Flux ships with "system"). --}}
<style>
:root.dark {
color-scheme: dark;
}
</style>
<script>
window.Flux = {
applyAppearance (appearance) {
let applyDark = () => document.documentElement.classList.add('dark')
let applyLight = () => document.documentElement.classList.remove('dark')
if (appearance === 'system') {
let media = window.matchMedia('(prefers-color-scheme: dark)')
// Persist "system" explicitly so a missing key can mean "use app default (dark)".
window.localStorage.setItem('flux.appearance', 'system')
media.matches ? applyDark() : applyLight()
} else if (appearance === 'dark') {
window.localStorage.setItem('flux.appearance', 'dark')
applyDark()
} else if (appearance === 'light') {
window.localStorage.setItem('flux.appearance', 'light')
applyLight()
}
}
}
window.Flux.applyAppearance(window.localStorage.getItem('flux.appearance') || 'dark')
</script>