web/README.md promised this was "three lines in router.tsx plus deleting the banner". It was nearly true. Every route is now behind RequireAuth: the gallery for any signed-in user, Devices and System for admin (SPEC 3.1). Roles are listed per route rather than granting admin everything implicitly, so widening one route cannot silently widen another - the same reasoning as api/userauth.require_role. The parts the README did not anticipate: A sign-out control. signOut() existed in AuthProvider and nothing called it, which was fine while the app was ungated and is not fine now: enforcing auth without a way to leave strands whoever signs in. It sits in the header with the theme and language switchers, and only renders when there is a session to end. lib/api.ts now carries the CSRF token, and fixing that surfaced a real bug in the scaffold. The fetch options spread `...init` AFTER `headers:`, so any caller passing headers replaced the whole object instead of merging into it. apiPost always sets Content-Type, so Accept was already being dropped on every POST - harmless, and invisible, because the server does not care. It stops being harmless the moment a header has to be there: the CSRF token would have been dropped on exactly the mutating requests that require one, and every POST would have answered 403 with nothing in the client to explain it. `...init` goes first now, with the reason written next to it. RequireAuth no longer shows the login form for the "unavailable" state. That state means the server answered 404 to /auth/session, which now only happens when a newer UI is served by an older server - so offering a form that 404s is the wrong answer. It says the versions do not match instead. auth.notEnforced is deleted from both catalogues rather than left unused, and .banner went with it, since that notice was its only caller. auth.failed was reworded: the server answers every sign-in failure identically - wrong password, unknown user, bad code, deactivated account - so the message has to cover all of them rather than inventing a distinction the server refuses to make. New keys in both en.ts and de.ts, which is enforced at build time. Verified through the Vite dev proxy, which is the path a browser actually takes rather than the one the tests take: 401 signed out, 401 for an admin without a TOTP code, 200 with one, both cookies arriving through the proxy, 403 on logout without the CSRF header with the session still alive after it, 204 with the header, 401 after. And POST /ingest still answers 401 rather than 403, because a camera sends no cookies and must never need a CSRF token. Docs brought in line: web/README.md said authentication was built but not enforced, which is now the opposite of true, and it now also says the two things needed before anyone can sign in - a user, and POORBIRD_SESSION_COOKIE_SECURE=false for plain-http development. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
76 lines
2.7 KiB
TypeScript
76 lines
2.7 KiB
TypeScript
import type { Catalogue } from "./en";
|
|
|
|
/* Typed as Catalogue, so a missing or misspelled key fails `npm run build`.
|
|
* That is the whole reason this file is hand-written rather than loaded as
|
|
* JSON at runtime: a missing German string should never reach a browser. */
|
|
export const de: Catalogue = {
|
|
"app.name": "poorBird",
|
|
"app.tagline": "Gartenvogel-Kamera",
|
|
|
|
"nav.gallery": "Galerie",
|
|
"nav.devices": "Geräte",
|
|
"nav.system": "System",
|
|
|
|
"common.loading": "Wird geladen…",
|
|
"common.retry": "Erneut versuchen",
|
|
"common.error": "Etwas ist schiefgelaufen",
|
|
"common.notMeasured": "—",
|
|
"common.yes": "Ja",
|
|
"common.no": "Nein",
|
|
|
|
"theme.label": "Design",
|
|
"theme.light": "Hell",
|
|
"theme.dark": "Dunkel",
|
|
"theme.blue": "Blau",
|
|
|
|
"lang.label": "Sprache",
|
|
"lang.en": "Englisch",
|
|
"lang.de": "Deutsch",
|
|
|
|
"auth.signIn": "Anmelden",
|
|
"auth.signOut": "Abmelden",
|
|
"auth.signedInAs": "Angemeldet als {username}",
|
|
"auth.username": "Benutzername",
|
|
"auth.password": "Passwort",
|
|
"auth.totp": "Bestätigungscode",
|
|
"auth.totpHint": "Sechs Ziffern aus deiner Authenticator-App",
|
|
"auth.signingIn": "Anmeldung läuft…",
|
|
"auth.failed": "Anmeldung fehlgeschlagen. Benutzername, Passwort und Code prüfen.",
|
|
"auth.forbidden": "Dein Konto hat keinen Zugriff auf diese Seite.",
|
|
"auth.unavailable":
|
|
"Dieser Server hat keinen Anmelde-Endpunkt. UI- und Server-Version passen nicht zusammen.",
|
|
|
|
"gallery.title": "Galerie",
|
|
"gallery.empty.title": "Noch keine Aufnahmen",
|
|
"gallery.empty.body":
|
|
"Die Kamera hat noch nichts hochgeladen. Der Upload kommt in Phase 2; bis dahin bleibt diese Liste leer.",
|
|
|
|
"devices.title": "Geräte",
|
|
"devices.empty.title": "Keine Geräte registriert",
|
|
"devices.empty.body":
|
|
"Eine Kamera erscheint hier, sobald sie sich registriert hat. Das kommt in Phase 2.",
|
|
|
|
"system.title": "System",
|
|
"system.status": "Status",
|
|
"system.status.ok": "In Ordnung",
|
|
"system.status.degraded": "Eingeschränkt",
|
|
"system.version": "Version",
|
|
"system.uptime": "Laufzeit",
|
|
"system.database": "Datenbank",
|
|
"system.database.ok": "Verbunden",
|
|
"system.database.down": "Nicht erreichbar",
|
|
"system.devices": "Geräte",
|
|
"system.captures": "Aufnahmen",
|
|
"system.lastBackup": "Letzte Sicherung",
|
|
"system.lastBackup.never": "Nie",
|
|
"system.disk": "Bildspeicher",
|
|
"system.disk.free": "{free} frei von {total}",
|
|
"system.disk.unavailable": "Pfad nicht verfügbar",
|
|
"system.enrollSecret": "Registrierungs-Secret",
|
|
"system.enrollSecret.set": "Konfiguriert",
|
|
"system.enrollSecret.unset": "Nicht gesetzt",
|
|
"system.unreachable.title": "Server nicht erreichbar",
|
|
"system.unreachable.body":
|
|
"Die API hat nicht geantwortet. Läuft sie auf Port 8090?",
|
|
};
|