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
+41 -3
View File
@@ -1,15 +1,51 @@
/// <reference types="vitest/config" />
import path from 'node:path';
import { defineConfig } from 'vite';
import fs from 'node:fs';
import { defineConfig, loadEnv, type Plugin } from 'vite';
import react from '@vitejs/plugin-react';
import tailwindcss from '@tailwindcss/vite';
import { version } from './package.json';
import { resolveTheme } from './themes/resolveTheme';
/** VITE_THEME selects themes/<name>/theme.css at build time (unset = today's admin, unchanged). */
function themeFor(mode: string) {
return resolveTheme({ ...loadEnv(mode, process.cwd(), 'VITE_'), ...process.env }.VITE_THEME);
}
/**
* Per-site favicon (VITE_THEME): the page links the theme favicon instead of the default one.
* Build emits it as an asset; the dev server serves it from the theme folder.
*/
function themeFavicon(faviconPath: string | null): Plugin {
const publicName = 'favicon-theme.svg';
return {
name: 'cms-theme-favicon',
// 'post': Vite has already prefixed the base path (/admin/) by then, so match any prefix.
transformIndexHtml: {
order: 'post',
handler(html) {
return faviconPath === null ? html : html.replace(/href="([^"]*)favicon\.svg"/, `href="$1${publicName}"`);
},
},
configureServer(server) {
if (faviconPath === null) return;
server.middlewares.use(`/${publicName}`, (_req, res) => {
res.setHeader('Content-Type', 'image/svg+xml');
res.end(fs.readFileSync(faviconPath));
});
},
generateBundle() {
if (faviconPath === null) return;
this.emitFile({ type: 'asset', fileName: publicName, source: fs.readFileSync(faviconPath) });
},
};
}
// https://vite.dev/config/
export default defineConfig(({ command }) => ({
export default defineConfig(({ command, mode }) => ({
// Production builds are deployed under /admin (see Program.cs); the dev server keeps serving from '/'.
base: command === 'build' ? '/admin/' : '/',
plugins: [react(), tailwindcss()],
plugins: [react(), tailwindcss(), themeFavicon(themeFor(mode).favicon)],
define: {
// Injected at build time, used as the Sentry `release` tag (see src/lib/sentry.ts).
__APP_VERSION__: JSON.stringify(version),
@@ -17,6 +53,8 @@ export default defineConfig(({ command }) => ({
resolve: {
alias: {
'@': path.resolve(__dirname, './src'),
// The selected theme's CSS (or an empty file); imported once from main.tsx.
'@theme': themeFor(mode).css,
},
},
server: {