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
@@ -11,6 +11,10 @@ on:
description: 'Deploy to Production'
type: boolean
default: false
deploy_asf_test:
description: 'Deploy ASF test (Andrea Slop Fotografie)'
type: boolean
default: false
pull_request:
types: [opened, synchronize, reopened]
push:
@@ -514,3 +518,111 @@ jobs:
service_name: ${{ needs.config.outputs.service_name_production }}
health_check_url: ${{ needs.config.outputs.health_check_url_production }}
run_db_backup: true
# ==========================================================================================
# Andrea Slop Fotografie (ASF) test host. Deliberately SEPARATE jobs: nothing above (the
# SlpSoftware jobs, the env block, deploy-scp.yaml) is changed, a failure here never blocks the
# SlpSoftware deploy and vice versa.
#
# Everything below is switched on by ONE Gitea variable, ASF_TEST_DEPLOY_ENABLED == 'true'.
# While it is unset (or anything else) all three jobs are skipped and the pipeline behaves
# exactly as before. Secrets cannot be tested in an `if:`, hence an explicit variable; it is set
# only after the Pi and the other ASF_* variables exist.
# Runs: on every push to master (like the SlpSoftware test deploy) or manually with the
# "Deploy ASF test" box ticked. Test only: there is no production path for ASF.
# ==========================================================================================
config-asf:
if: ${{ vars.ASF_TEST_DEPLOY_ENABLED == 'true' }}
runs-on: ubuntu-latest
outputs:
deploy_path: ${{ steps.set.outputs.deploy_path }}
service_name: ${{ steps.set.outputs.service_name }}
health_check_url: ${{ steps.set.outputs.health_check_url }}
steps:
- id: set
env:
DEPLOY_PATH: ${{ vars.DEPLOY_PATH_ASF_TEST }}
SERVICE_NAME: ${{ vars.SERVICE_NAME_ASF_TEST }}
HEALTH_CHECK_URL: ${{ vars.HEALTH_CHECK_URL_ASF_TEST }}
run: |
for v in DEPLOY_PATH SERVICE_NAME HEALTH_CHECK_URL; do
if [ -z "${!v}" ]; then
echo "The Gitea variable for $v (…_ASF_TEST) is not set; set it or switch ASF_TEST_DEPLOY_ENABLED off."
exit 1
fi
done
echo "deploy_path=$DEPLOY_PATH" >> "$GITHUB_OUTPUT"
echo "service_name=$SERVICE_NAME" >> "$GITHUB_OUTPUT"
echo "health_check_url=$HEALTH_CHECK_URL" >> "$GITHUB_OUTPUT"
publish-asf-test:
needs: [changes, backend-build, backend-test, vulnerability-scan, frontend-build, frontend-test, frontend-lint]
# Same gate handling as publish-test (see there for why always() and explicit results), plus the
# ASF switch, and built only when it will actually be deployed.
if: |
always() &&
vars.ASF_TEST_DEPLOY_ENABLED == 'true' &&
needs.changes.result == 'success' &&
needs.backend-build.result != 'failure' && needs.backend-build.result != 'cancelled' &&
needs.backend-test.result != 'failure' && needs.backend-test.result != 'cancelled' &&
needs.vulnerability-scan.result != 'failure' && needs.vulnerability-scan.result != 'cancelled' &&
needs.frontend-build.result != 'failure' && needs.frontend-build.result != 'cancelled' &&
needs.frontend-test.result != 'failure' && needs.frontend-test.result != 'cancelled' &&
needs.frontend-lint.result != 'failure' && needs.frontend-lint.result != 'cancelled' &&
(needs.changes.outputs.backend == 'true' || needs.changes.outputs.frontend == 'true') &&
((github.event_name == 'workflow_dispatch' && github.event.inputs.deploy_asf_test == 'true') ||
(github.event_name == 'push' && github.ref == 'refs/heads/master'))
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
- uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}
- uses: pnpm/action-setup@v4
with:
version: ${{ env.PNPM_VERSION }}
# Admin SPA with the ASF theme and Dutch as the default language. Lands in wwwroot/admin
# BEFORE dotnet publish, for the same reason as in publish-test. No Umami for the admin.
- name: Build admin frontend (ASF theme)
working-directory: frontend
env:
VITE_APP_ENV: test
VITE_APP_TITLE: Andrea Slop Fotografie
VITE_THEME: asf
VITE_DEFAULT_LANGUAGE: nl
VITE_SENTRY_DSN: ${{ vars.VITE_SENTRY_DSN_ASF }}
run: |
pnpm install --frozen-lockfile
pnpm build
mkdir -p ../src/SlpModularCms.Api.AndreaSlopFotografie/wwwroot/admin
cp -r dist/. ../src/SlpModularCms.Api.AndreaSlopFotografie/wwwroot/admin/
- name: Publish (ASF test)
working-directory: src/SlpModularCms.Api.AndreaSlopFotografie
run: >
dotnet publish -c Release -r ${{ env.PUBLISH_RID }} --self-contained false
-o ${{ github.workspace }}/app-asf-test
- name: Upload publish artifact
uses: actions/upload-artifact@v3
with:
name: app-asf-test
path: app-asf-test
retention-days: 1
deploy-asf-test:
needs: [publish-asf-test, config-asf]
if: vars.ASF_TEST_DEPLOY_ENABLED == 'true' && ((github.event_name == 'workflow_dispatch' && github.event.inputs.deploy_asf_test == 'true') || (github.event_name == 'push' && github.ref == 'refs/heads/master'))
uses: ./.gitea/workflows/deploy-scp.yaml
secrets: inherit
with:
artifact_name: app-asf-test
environment: test
deploy_path: ${{ needs.config-asf.outputs.deploy_path }}
service_name: ${{ needs.config-asf.outputs.service_name }}
health_check_url: ${{ needs.config-asf.outputs.health_check_url }}
run_db_backup: false