Voeg Api.AndreaSlopFotografie toe met setup-token, proxy-bewuste limiters en ASF-admin-thema

- Core: opt-in ForwardedHeaders:KnownProxies en rate limiters per clientadres
  (zonder configuratie ongewijzigd gedrag)
- Identity: optioneel setup-token (X-Setup-Token), beide setup-endpoints onder de
  login-limiter, beveiligingsgebeurtenis setup_token_rejected (5007)
- Nieuw client-project SlpModularCms.Api.AndreaSlopFotografie (Identity + Availability)
  met bijbehorende tests
- Frontend: thema asf (VITE_THEME), VITE_DEFAULT_LANGUAGE, tokenveld op de setup-pagina
- CI: jobs publish/deploy-asf-test achter ASF_TEST_DEPLOY_ENABLED
- Fix U1: 301-Location wordt nu percent-encoded (gevonden door de property-test)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-07 01:16:34 +01:00
co-authored by Claude Sonnet 5.5
parent e523e670ad
commit 88f5d20a78
55 changed files with 1828 additions and 67 deletions
+13
View File
@@ -0,0 +1,13 @@
import { describe, expect, it } from 'vitest';
import { languageDetection } from '@/i18n/config';
describe('languageDetection', () => {
it('without a default language keeps the old order: stored choice, then browser, fallback English', () => {
expect(languageDetection(undefined)).toEqual({ order: ['localStorage', 'navigator'], fallbackLng: 'en' });
});
it('with a default language: stored choice first, then that default, and the browser is not consulted', () => {
expect(languageDetection('nl')).toEqual({ order: ['localStorage'], fallbackLng: 'nl' });
expect(languageDetection('en')).toEqual({ order: ['localStorage'], fallbackLng: 'en' });
});
});
+15 -2
View File
@@ -3,6 +3,7 @@ import { initReactI18next } from 'react-i18next';
import LanguageDetector from 'i18next-browser-languagedetector';
import enTranslation from './locales/en/translation.json';
import nlTranslation from './locales/nl/translation.json';
import { getAppConfig } from '@/lib/config';
export const SUPPORTED_LANGUAGES = ['en', 'nl'] as const;
export type SupportedLanguage = (typeof SUPPORTED_LANGUAGES)[number];
@@ -12,6 +13,18 @@ export const LANGUAGE_LABELS: Record<SupportedLanguage, string> = {
nl: 'Nederlands',
};
/**
* Language resolution order: a stored user choice always wins; otherwise the build-time
* VITE_DEFAULT_LANGUAGE; otherwise the browser language (the behaviour before this option existed).
*/
export function languageDetection(defaultLanguage: SupportedLanguage | undefined) {
return defaultLanguage === undefined
? { order: ['localStorage', 'navigator'], fallbackLng: 'en' }
: { order: ['localStorage'], fallbackLng: defaultLanguage };
}
const detectionSetup = languageDetection(getAppConfig().defaultLanguage);
// Both supported locales are bundled eagerly so the detected language is
// available immediately on init — no async gap that would cause an English flash.
void i18n
@@ -22,12 +35,12 @@ void i18n
en: { translation: enTranslation },
nl: { translation: nlTranslation },
},
fallbackLng: 'en',
fallbackLng: detectionSetup.fallbackLng,
supportedLngs: SUPPORTED_LANGUAGES as unknown as string[],
nonExplicitSupportedLngs: true,
interpolation: { escapeValue: false },
detection: {
order: ['localStorage', 'navigator'],
order: detectionSetup.order,
caches: ['localStorage'],
},
react: { useSuspense: false },
@@ -43,6 +43,10 @@
"passwordLabel": "Password",
"confirmPasswordLabel": "Confirm password",
"languageLabel": "Language preference",
"tokenLabel": "Setup token",
"tokenHelp": "Required to create the first administrator. You received it from whoever installed this site.",
"tokenRequiredError": "Enter the setup token.",
"tokenInvalid": "The setup token is missing or incorrect.",
"submitButton": "Create owner account",
"successMessage": "Account created. You can now sign in."
},
@@ -43,6 +43,10 @@
"passwordLabel": "Wachtwoord",
"confirmPasswordLabel": "Wachtwoord bevestigen",
"languageLabel": "Taalkeuze",
"tokenLabel": "Setup-token",
"tokenHelp": "Nodig om de eerste beheerder aan te maken. Je hebt het ontvangen van degene die deze site heeft geïnstalleerd.",
"tokenRequiredError": "Vul het setup-token in.",
"tokenInvalid": "Het setup-token ontbreekt of is onjuist.",
"submitButton": "Owner-account aanmaken",
"successMessage": "Account aangemaakt. Je kunt nu inloggen."
},