Author SHA1 Message Date
SluijsensandClaude Sonnet 5.5 16f0d323b9 Production upload over FTPS (explicit TLS, no fallback) instead of plain FTP
Continuous Integration / check (pull_request) Successful in 2m9s
Continuous Integration / build-test (pull_request) Skipped
Continuous Integration / deploy-test (pull_request) Skipped
Continuous Integration / lighthouse (pull_request) Successful in 9m9s
Continuous Integration / deploy-production (pull_request) Skipped
The hosting partner offers FTP over TLS after all. upload-production.sh now forces
AUTH TLS (ssl-force, protect-data, protect-list), verifies the certificate and stays
passive; the three rounds and the folder restrictions are unchanged. Docs, workflow
comments and the lftp tests follow.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-19 00:09:03 +01:00
Sluijsens 4c539f0207 Merge pull request 'Redirects of the old WordPress addresses (redirects.json)' (#25) from feature/asf-old-url-redirects into master
Continuous Integration / check (push) Successful in 2m32s
Continuous Integration / build-test (push) Successful in 1m19s
Continuous Integration / deploy-test (push) Successful in 1m30s
Continuous Integration / lighthouse (push) Successful in 9m45s
Continuous Integration / deploy-production (push) Skipped
2026-11-18 23:03:44 +01:00
SluijsensandClaude Sonnet 5.5 94ce5d2659 Upload tests: the valid build has redirects.json
Continuous Integration / check (pull_request) Successful in 3m55s
Continuous Integration / build-test (pull_request) Skipped
Continuous Integration / deploy-test (pull_request) Skipped
Continuous Integration / lighthouse (pull_request) Successful in 9m58s
Continuous Integration / deploy-production (pull_request) Skipped
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-18 22:21:31 +01:00
SluijsensandClaude Sonnet 5.5 88fa60daf8 Deployment check (CMS mode): the redirects of the old addresses work and redirects.json is not served
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-18 22:18:31 +01:00
SluijsensandClaude Sonnet 5.5 5ba6ac8579 Redirects of the old WordPress addresses as redirects.json (format of the CMS host)
The list is in config/redirectRules.ts (exact paths, from the old sitemap),
written into dist/client by the build; check-artifact.sh requires it.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-18 22:15:21 +01:00
Sluijsens 93a8b31eb2 Merge pull request 'Production upload: plain FTP, no web.config from this repo' (#24) from feature/asf-prod-plain-ftp into master
Continuous Integration / check (push) Successful in 2m59s
Continuous Integration / build-test (push) Successful in 1m31s
Continuous Integration / deploy-test (push) Successful in 1m31s
Continuous Integration / lighthouse (push) Successful in 1h0m4s
Continuous Integration / deploy-production (push) Skipped
2026-11-18 22:14:18 +01:00
Sluijsens 39c2ae6024 Merge pull request 'Pipeline: new names for variables and secrets, monitoring from the build environment, SSH key login' (#23) from feature/asf-pipeline-names into master
Continuous Integration / check (push) Successful in 4m21s
Continuous Integration / build-test (push) Successful in 1m41s
Continuous Integration / lighthouse (push) Successful in 10m20s
Continuous Integration / deploy-production (push) Skipped
Continuous Integration / deploy-test (push) Successful in 1m31s
2026-11-18 21:23:37 +01:00
SluijsensandClaude Sonnet 5.5 1f087581d4 Production upload: plain FTP (no FTPS), no web.config from this repo, optional port
Continuous Integration / check (pull_request) Successful in 4m12s
Continuous Integration / build-test (pull_request) Skipped
Continuous Integration / deploy-test (pull_request) Skipped
Continuous Integration / lighthouse (pull_request) Successful in 44m28s
Continuous Integration / deploy-production (pull_request) Skipped
The production package only offers plain FTP. The upload goes into the
prerendered-pages folder of the CMS host; the host and its web.config come from
the CMS pipeline.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-18 21:17:04 +01:00
SluijsensandClaude Sonnet 5.5 2147fcec35 deploy-test: SSH key login (TEST_HOST_*) instead of the PI_MAIN_* password with sshpass
Continuous Integration / check (pull_request) Successful in 2m24s
Continuous Integration / build-test (pull_request) Skipped
Continuous Integration / deploy-test (pull_request) Skipped
Continuous Integration / lighthouse (pull_request) Successful in 11m38s
Continuous Integration / deploy-production (pull_request) Skipped
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-18 20:20:31 +01:00
SluijsensandClaude Sonnet 5.5 d99b909f9f Deployment check: the CMS host must offer Offerings and Hero (the site uses them)
The old rule said Offerings must be off for ASF; since the packages feature the
site needs it. The check was never run in CMS mode on ASF-test before.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-18 19:30:50 +01:00
SluijsensandClaude Sonnet 5.5 49b1d5f0ba Monitoring settings (Sentry, Umami) and the CSP origins come from the build environment
One build per environment: PROD_* variables for the production artifact,
TEST_* for the test build and the CSP check. The build fails when a variable
is empty. Tests use the production values from config/monitoringTestEnv.ts.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-18 19:29:51 +01:00
SluijsensandClaude Sonnet 5.5 6475696709 Pipeline: new names for repo variables and secrets; no OFFERINGS_URL; the post-deploy check always runs as CMS host
TEST_DEPLOY_PATH, TEST_HEALTH_URL, PROD_HEALTH_URL, PROD_DEPLOY_PATH and
PROD_HOST_* replace the old names (decision of Bryan, 2026-11-18). The test
build no longer fetches packages (the host injects them) and ASF_TEST_SERVED_BY_CMS
is gone: test is always served by the CMS host. PI_MAIN_* stay until the
TEST_HOST_* secrets and the SSH key exist.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-18 19:20:19 +01:00
Sluijsens 440a298cc7 Hero: no pause on hover, slow zoom on the first photo
Continuous Integration / check (push) Successful in 2m4s
Continuous Integration / build-test (push) Successful in 1m1s
Continuous Integration / deploy-test (push) Successful in 1m17s
Continuous Integration / lighthouse (push) Successful in 9m10s
Continuous Integration / deploy-production (push) Skipped
2026-11-17 11:17:47 +01:00
SluijsensandClaude Sonnet 5.5 8050072ce5 Hero: slow zoom on the first photo without replacing the plain HTML
Continuous Integration / check (pull_request) Successful in 1m57s
Continuous Integration / build-test (pull_request) Skipped
Continuous Integration / deploy-test (pull_request) Skipped
Continuous Integration / lighthouse (pull_request) Successful in 9m0s
Continuous Integration / deploy-production (pull_request) Skipped
The plain HTML is painted at scale 1.06 and the slider zooms it out to 1
after hydration, like the other photos: same first frame (no CLS), and the
LCP does not wait for hydration. Assumptions 15 and 16 recorded.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-17 10:31:22 +01:00
SluijsensandClaude Sonnet 5.5 20806692bb Hero: no pause on mouse hover (Bryan, 2026-11-17)
The pause button, reduced motion, hidden tab and keyboard focus on the
controls still pause.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-17 10:31:21 +01:00
Sluijsens 78d3f594e5 Hero uit het CMS met ingebakken terugval
Continuous Integration / check (push) Successful in 23m36s
Continuous Integration / build-test (push) Successful in 58s
Continuous Integration / deploy-test (push) Successful in 1m20s
Continuous Integration / lighthouse (push) Successful in 9m53s
Continuous Integration / deploy-production (push) Skipped
2026-11-17 10:26:37 +01:00
31 changed files with 927 additions and 202 deletions
+70 -42
View File
@@ -84,13 +84,23 @@ jobs:
run: pnpm test run: pnpm test
# Sentry toont bij elke fout uit welke commit de build komt # Sentry toont bij elke fout uit welke commit de build komt
# Dit artefact (dist) is ook wat naar productie gaat: bewust zonder # Dit artefact (dist) is ook wat naar productie gaat: met de gecommitte
# OFFERINGS_URL, dus met de gecommitte pakketlijst. De testbuild met de # pakketlijst (snapshot), zonder testadres en met dicht formulier. De
# pakketten uit het CMS is job build-test. # CMS-host schrijft de actuele gegevens bij elk verzoek in de HTML.
- name: Build - name: Build
run: pnpm build run: |
# Zonder deze waarden meet de site stilletjes niets: liever een rode build
for name in VITE_SENTRY_DSN VITE_UMAMI_SCRIPT_URL VITE_UMAMI_WEBSITE_ID; do
[ -n "${!name}" ] || { echo "$name ontbreekt: stel de Gitea-variabele PROD_${name#VITE_} in"; exit 1; }
done
pnpm build
env: env:
VITE_RELEASE: ${{ github.sha }} VITE_RELEASE: ${{ github.sha }}
# Monitoring van de productiesite (src/monitoring/config.ts)
VITE_APP_ENV: production
VITE_SENTRY_DSN: ${{ vars.PROD_SENTRY_DSN }}
VITE_UMAMI_SCRIPT_URL: ${{ vars.PROD_UMAMI_SCRIPT_URL }}
VITE_UMAMI_WEBSITE_ID: ${{ vars.PROD_UMAMI_WEBSITE_ID }}
- name: Audit (productiepakketten, blokkerend) - name: Audit (productiepakketten, blokkerend)
run: pnpm audit:deps run: pnpm audit:deps
@@ -105,10 +115,10 @@ jobs:
path: web/dist/client/ path: web/dist/client/
retention-days: 7 retention-days: 7
# De build voor de testsite: zelfde code als dist, maar met de pakketten uit # De build voor de testsite: zelfde code als dist, maar met het eigen adres
# het CMS van de testomgeving (OFFERINGS_URL uit de repo-variabele # van de testsite en het formulier open. De pakketten komen niet meer uit
# ASF_OFFERINGS_URL_TEST). Productie krijgt dit artefact nooit: die blijft op # het CMS bij de build: de CMS-host injecteert ze bij elk verzoek.
# dist met de gecommitte lijst tot er een productie-CMS is. # Productie krijgt dit artefact nooit.
build-test: build-test:
needs: check needs: check
if: (github.event_name == 'workflow_dispatch' && github.event.inputs.deploy_test == 'true') || (github.event_name == 'push' && github.ref == 'refs/heads/master') if: (github.event_name == 'workflow_dispatch' && github.event.inputs.deploy_test == 'true') || (github.event_name == 'push' && github.ref == 'refs/heads/master')
@@ -137,11 +147,20 @@ jobs:
- name: Install dependencies - name: Install dependencies
run: pnpm install --frozen-lockfile run: pnpm install --frozen-lockfile
- name: Build (testomgeving, pakketten uit het CMS) - name: Build (testomgeving)
run: pnpm build run: |
# Zonder deze waarden meet de site stilletjes niets: liever een rode build
for name in VITE_SENTRY_DSN VITE_UMAMI_SCRIPT_URL VITE_UMAMI_WEBSITE_ID; do
[ -n "${!name}" ] || { echo "$name ontbreekt: stel de Gitea-variabele TEST_${name#VITE_} in"; exit 1; }
done
pnpm build
env: env:
VITE_RELEASE: ${{ github.sha }} VITE_RELEASE: ${{ github.sha }}
OFFERINGS_URL: ${{ vars.ASF_OFFERINGS_URL_TEST }} # Monitoring van de testsite (src/monitoring/config.ts)
VITE_APP_ENV: test
VITE_SENTRY_DSN: ${{ vars.TEST_SENTRY_DSN }}
VITE_UMAMI_SCRIPT_URL: ${{ vars.TEST_UMAMI_SCRIPT_URL }}
VITE_UMAMI_WEBSITE_ID: ${{ vars.TEST_UMAMI_WEBSITE_ID }}
# De testsite staat op zichzelf: canonical, og:url, og:image, # De testsite staat op zichzelf: canonical, og:url, og:image,
# JSON-LD en sitemap wijzen naar het eigen adres, zodat een gedeelde # JSON-LD en sitemap wijzen naar het eigen adres, zodat een gedeelde
# link (WhatsApp, Discord) ook zijn eigen plaatje toont. Alleen in # link (WhatsApp, Discord) ook zijn eigen plaatje toont. Alleen in
@@ -193,18 +212,26 @@ jobs:
- name: Upload naar de testserver - name: Upload naar de testserver
env: env:
# Secrets via env, zodat bash tekens als $ of ` niet nog eens uitlegt # Secrets via env, zodat bash tekens als $ of ` niet nog eens uitlegt
SSHPASS: ${{ secrets.PI_MAIN_PASSWORD }} SSH_KEY: ${{ secrets.TEST_HOST_SSH_KEY }}
SSH_PORT: ${{ secrets.PI_MAIN_PORT }} SSH_PORT: ${{ secrets.TEST_HOST_PORT }}
SSH_USER: ${{ secrets.PI_MAIN_USERNAME }} SSH_USER: ${{ secrets.TEST_HOST_USERNAME }}
SSH_HOST: ${{ secrets.PI_MAIN_ADDRESS }} SSH_HOST: ${{ secrets.TEST_HOST_ADDRESS }}
DEPLOY_PATH: ${{ vars.DEPLOY_PATH_TEST }} DEPLOY_PATH: ${{ vars.TEST_DEPLOY_PATH }}
run: | run: |
case "$DEPLOY_PATH" in case "$DEPLOY_PATH" in
''|'/'|*' '*) echo "DEPLOY_PATH_TEST ontbreekt of is ongeldig: '$DEPLOY_PATH'"; exit 1 ;; ''|'/'|*' '*) echo "TEST_DEPLOY_PATH ontbreekt of is ongeldig: '$DEPLOY_PATH'"; exit 1 ;;
esac esac
sudo apt-get update && sudo apt-get install -y sshpass for name in SSH_KEY SSH_PORT SSH_USER SSH_HOST; do
SSH="sshpass -e ssh -p $SSH_PORT -o StrictHostKeyChecking=accept-new $SSH_USER@$SSH_HOST" [ -n "${!name}" ] || { echo "Secret TEST_HOST_${name#SSH_} ontbreekt"; exit 1; }
$SSH "set -e done
# Inloggen met de deploysleutel, geen wachtwoord. De sleutel gaat naar
# een tijdelijk bestand dat na afloop verdwijnt.
KEY_FILE="$(mktemp)"
trap 'rm -f "$KEY_FILE"' EXIT
printf '%s\n' "$SSH_KEY" > "$KEY_FILE"
chmod 600 "$KEY_FILE"
SSH_OPTS=(-i "$KEY_FILE" -o IdentitiesOnly=yes -o BatchMode=yes -o StrictHostKeyChecking=accept-new)
ssh -p "$SSH_PORT" "${SSH_OPTS[@]}" "$SSH_USER@$SSH_HOST" "set -e
if [ -e '$DEPLOY_PATH/wp-config.php' ] || [ -d '$DEPLOY_PATH/wp-content' ]; then if [ -e '$DEPLOY_PATH/wp-config.php' ] || [ -d '$DEPLOY_PATH/wp-content' ]; then
echo 'Geweigerd: $DEPLOY_PATH bevat WordPress'; exit 1 echo 'Geweigerd: $DEPLOY_PATH bevat WordPress'; exit 1
fi fi
@@ -215,7 +242,7 @@ jobs:
# mag. Zo zijn groeps-schrijfrechten op de doelmap genoeg. # mag. Zo zijn groeps-schrijfrechten op de doelmap genoeg.
# dotglob: ook bestanden die met een punt beginnen gaan mee. # dotglob: ook bestanden die met een punt beginnen gaan mee.
shopt -s dotglob shopt -s dotglob
sshpass -e scp -P "$SSH_PORT" -o StrictHostKeyChecking=accept-new -r dist/* "$SSH_USER@$SSH_HOST:$DEPLOY_PATH/" scp -P "$SSH_PORT" "${SSH_OPTS[@]}" -r dist/* "$SSH_USER@$SSH_HOST:$DEPLOY_PATH/"
echo "Gedeployd naar test: ${GITHUB_REF_NAME} (${GITHUB_SHA::7})" echo "Gedeployd naar test: ${GITHUB_REF_NAME} (${GITHUB_SHA::7})"
# Vergelijkt wat de server teruggeeft met dist. Met de oude nginx-config # Vergelijkt wat de server teruggeeft met dist. Met de oude nginx-config
@@ -223,18 +250,17 @@ jobs:
# dus staan voor de deploy (zie pi-install-instructions.md). # dus staan voor de deploy (zie pi-install-instructions.md).
- name: Controle na deploy - name: Controle na deploy
env: env:
HEALTH_URL: ${{ vars.HEALTH_CHECK_URL_TEST }} HEALTH_URL: ${{ vars.TEST_HEALTH_URL }}
# 'true' zodra test.andreaslop.nl door de CMS-host (Api.AndreaSlopFotografie) # De CSP komt uit dezelfde bron als de build (Umami en Sentry)
# wordt bediend in plaats van nginx: dan controleert het script ook de VITE_APP_ENV: test
# exacte CSP en de CMS-routes. Zet hem om samen met de proxy-route. VITE_SENTRY_DSN: ${{ vars.TEST_SENTRY_DSN }}
SERVED_BY_CMS: ${{ vars.ASF_TEST_SERVED_BY_CMS }} VITE_UMAMI_SCRIPT_URL: ${{ vars.TEST_UMAMI_SCRIPT_URL }}
VITE_UMAMI_WEBSITE_ID: ${{ vars.TEST_UMAMI_WEBSITE_ID }}
run: | run: |
if [ -z "$HEALTH_URL" ]; then echo "Geen HEALTH_CHECK_URL_TEST ingesteld; overgeslagen"; exit 0; fi if [ -z "$HEALTH_URL" ]; then echo "Geen TEST_HEALTH_URL ingesteld; overgeslagen"; exit 0; fi
if [ "$SERVED_BY_CMS" = "true" ]; then # test.andreaslop.nl wordt door de CMS-host bediend: het script
# controleert ook de exacte CSP en de CMS-routes
EXPECTED_CSP="$(node config/printCsp.ts)" bash deploy/verify-deployment.sh "$HEALTH_URL" dist --test --cms EXPECTED_CSP="$(node config/printCsp.ts)" bash deploy/verify-deployment.sh "$HEALTH_URL" dist --test --cms
else
bash deploy/verify-deployment.sh "$HEALTH_URL" dist --test
fi
echo "Test bereikbaar en gelijk aan de build" echo "Test bereikbaar en gelijk aan de build"
# Lighthouse tegen de gebouwde site (mobiel en desktop) # Lighthouse tegen de gebouwde site (mobiel en desktop)
@@ -343,17 +369,19 @@ jobs:
name: dist name: dist
path: web/dist path: web/dist
# FTP met TLS (verplicht) naar de webhoster, in drie rondes (zie # FTP over TLS (FTPS, explicit, zonder terugval) naar de map met
# deploy/upload-production.sh): eerst alles behalve HTML en web.config, # voorgerenderde pagina's van de CMS-host, in drie rondes (zie
# dan web.config en alle HTML, en pas daarna oude bestanden opruimen. Zo # deploy/upload-production.sh): eerst alles behalve HTML, dan alle HTML,
# verwijst een bezoeker nooit naar een bestand dat er nog niet staat. # en pas daarna oude bestanden opruimen. Zo verwijst een bezoeker nooit
# Deze job kan pas draaien als er een webhost is. # naar een bestand dat er nog niet staat. De host zelf en zijn web.config
# komen uit de CMS-pijplijn. Deze job kan pas draaien als er een webhost is.
- name: Upload naar productie (FTPS) - name: Upload naar productie (FTPS)
env: env:
FTP_HOST: ${{ secrets.FTP_HOST }} FTP_HOST: ${{ secrets.PROD_HOST_ADDRESS }}
FTP_USER: ${{ secrets.FTP_USERNAME }} FTP_PORT: ${{ secrets.PROD_HOST_PORT }}
LFTP_PASSWORD: ${{ secrets.FTP_PASSWORD }} FTP_USER: ${{ secrets.PROD_HOST_USERNAME }}
FTP_DIR: ${{ vars.FTP_REMOTE_DIR || 'wwwroot' }} LFTP_PASSWORD: ${{ secrets.PROD_HOST_PASSWORD }}
FTP_DIR: ${{ vars.PROD_DEPLOY_PATH || 'wwwroot' }}
run: | run: |
sudo apt-get update && sudo apt-get install -y lftp sudo apt-get update && sudo apt-get install -y lftp
bash deploy/upload-production.sh dist "$FTP_DIR" bash deploy/upload-production.sh dist "$FTP_DIR"
@@ -361,8 +389,8 @@ jobs:
- name: Controle na deploy - name: Controle na deploy
env: env:
HEALTH_URL: ${{ vars.HEALTH_CHECK_URL_PRODUCTION }} HEALTH_URL: ${{ vars.PROD_HEALTH_URL }}
run: | run: |
if [ -z "$HEALTH_URL" ]; then echo "Geen HEALTH_CHECK_URL_PRODUCTION ingesteld; overgeslagen"; exit 0; fi if [ -z "$HEALTH_URL" ]; then echo "Geen PROD_HEALTH_URL ingesteld; overgeslagen"; exit 0; fi
bash deploy/verify-deployment.sh "$HEALTH_URL" dist bash deploy/verify-deployment.sh "$HEALTH_URL" dist
echo "Productie bereikbaar en gelijk aan de build" echo "Productie bereikbaar en gelijk aan de build"
@@ -3,7 +3,7 @@
Written while Bryan was away; he decides later. Each point: question, assumption, what changes with another answer, where in the code. Written while Bryan was away; he decides later. Each point: question, assumption, what changes with another answer, where in the code.
| # | Question | Assumption | If the answer differs | Where | | # | Question | Assumption | If the answer differs | Where |
| --- | -------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------- | ------------------------------------------------------------------------------ | | --- | -------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------- | ------------------------------------------------------------------------------ |
| 1 | Focus points of the 8 photos | Estimates from the seed (e.g. hero-8 0.50/0.55) | Change x/y in the seed (CMS) and in the baked values | `web/src/content/heroContent.ts`, `web/contract/host-injection/hero/seed.json` | | 1 | Focus points of the 8 photos | Estimates from the seed (e.g. hero-8 0.50/0.55) | Change x/y in the seed (CMS) and in the baked values | `web/src/content/heroContent.ts`, `web/contract/host-injection/hero/seed.json` |
| 2 | Is the baked hero cropped around the focus point too? | Yes: object-position from the estimates, so baked and live look the same | Pass `focus: null` for the baked slides to get plain centre crop | `heroContent.ts` | | 2 | Is the baked hero cropped around the focus point too? | Yes: object-position from the estimates, so baked and live look the same | Pass `focus: null` for the baked slides to get plain centre crop | `heroContent.ts` |
| 3 | Button target `#anchor` and https: plain link, `/path`: router link | As said | Make all plain links | `web/src/components/Hero/HeroButton.tsx` | | 3 | Button target `#anchor` and https: plain link, `/path`: router link | As said | Make all plain links | `web/src/components/Hero/HeroButton.tsx` |
@@ -18,6 +18,8 @@ Written while Bryan was away; he decides later. Each point: question, assumption
| 12 | Planning (from/to dates) and a hero-wide on/off switch | Deliberately not built: the hero is always there, a hero without usable slides keeps the baked one | Add in the CMS; the site already handles a 204 and an empty hero | CMS (module), `useHero.ts` | | 12 | Planning (from/to dates) and a hero-wide on/off switch | Deliberately not built: the hero is always there, a hero without usable slides keeps the baked one | Add in the CMS; the site already handles a 204 and an empty hero | CMS (module), `useHero.ts` |
| 13 | Content of the ASF test seed | The 8 existing photos with focus estimates (#1), texts like the baked ones | Edit in the CMS admin; update `heroContent.ts` if the baked fallback should match | `web/contract/host-injection/hero/seed.json` | | 13 | Content of the ASF test seed | The 8 existing photos with focus estimates (#1), texts like the baked ones | Edit in the CMS admin; update `heroContent.ts` if the baked fallback should match | `web/contract/host-injection/hero/seed.json` |
| 14 | Baked hero after a CMS change | The baked hero is only a fallback and is not rebuilt from the CMS any more (no nightly build) | Re-bake by hand in `heroContent.ts` when the real hero changes for good | `heroContent.ts` | | 14 | Baked hero after a CMS change | The baked hero is only a fallback and is not rebuilt from the CMS any more (no nightly build) | Re-bake by hand in `heroContent.ts` when the real hero changes for good | `heroContent.ts` |
| 15 | Pause on mouse hover | Removed on purpose (Bryan, 2026-11-17): a full-screen hero almost always has the pointer over it. Kept: the explicit pause button (WCAG 2.2.2), no autoplay with `prefers-reduced-motion`, pause when the tab is hidden, and pause while keyboard focus is on the controls (a deliberate action; a click on an arrow does not pause). Touch and swipe do not pause either: a swipe restarts the progress bar of the new slide | Add hover back: `onPointerEnter`/`onPointerLeave` in `useHeroSlider.ts` | `web/src/components/Hero/useHeroSlider.ts` |
| 16 | Slow zoom on the first photo (supersedes #11 in part; Bryan chose the full slider render, 2026-11-17) | The first photo zooms like the others, without replacing the plain HTML: the plain HTML is painted at scale 1.06 (CSS `.cms-hero-image`), the slider sets `data-zoom` after hydration and it zooms out to 1 over 9 s. Same first frame before and after hydration, so no CLS, and the LCP does not wait for hydration (replacing the nodes made the LCP 5.3 s in the first design). Reduced motion: no scale at all | Replace the nodes at hydration (one component); measure LCP first | `theme.ts`, `Hero.tsx` |
## What Bryan has to check later ## What Bryan has to check later
+3 -4
View File
@@ -51,7 +51,7 @@ The hero of the homepage comes from the CMS hero module (`GET /api/v1/hero`); th
Decision (Bryan, 2026-11-15): the hosting package has one entry per website. The CMS host (Kestrel) is that entry and serves the website itself (the prerendered pages), `/admin` and `/api/v1/*`. In production IIS (or the proxy) therefore passes **all** requests to the CMS host, not only `/api/v1/*`, and serves no static files or HTML cache of its own. This holds for the test host and for ASF production alike. Decision (Bryan, 2026-11-15): the hosting package has one entry per website. The CMS host (Kestrel) is that entry and serves the website itself (the prerendered pages), `/admin` and `/api/v1/*`. In production IIS (or the proxy) therefore passes **all** requests to the CMS host, not only `/api/v1/*`, and serves no static files or HTML cache of its own. This holds for the test host and for ASF production alike.
- **Test (ASF):** nginx on the proxy Pi forwards everything for `test.andreaslop.nl` to the CMS host (`web/deploy/nginx/test.andreaslop.nl.proxy.conf`), which serves the site files and the API. Nothing to add. - **Test (ASF):** nginx on the proxy Pi forwards everything for `test.andreaslop.nl` to the CMS host (`web/deploy/nginx/test.andreaslop.nl.proxy.conf`), which serves the site files and the API. Nothing to add.
- **Production: not in place yet.** The generated `web/deploy/iis/web.config` and the FTP upload of static files (`web/deploy/upload-production.sh`) still describe the old idea of IIS serving the files. They have to change with the production hosting: IIS keeps only the redirects (www, HTTPS) and the pass-through to the CMS host, and the prerendered `dist/` goes to the CMS host's prerendered-pages folder as on test. Security headers then come from the CMS host (as on test). This is part of the production hosting work, not of the packages feature. Until then production builds use the committed snapshot and the live calls fail safely (the baked list stays; the browser console shows a 404 for the API). Change generated server files only in `web/config/serverConfig.ts` and run `pnpm server-config`. - **Production: not in place yet.** The FTP upload (`web/deploy/upload-production.sh`) is FTPS (explicit TLS, no fallback) into the CMS host's prerendered-pages folder and no longer puts a `web.config` on the server (the host's own `web.config` comes from the CMS pipeline). The generated `web/deploy/iis/web.config` still describes the old idea of IIS serving the files and has to change with the production hosting: IIS keeps only the redirects (www, HTTPS) and the pass-through to the CMS host, and the prerendered `dist/` goes to the CMS host's prerendered-pages folder as on test. Security headers then come from the CMS host (as on test). This is part of the production hosting work, not of the packages feature. Until then production builds use the committed snapshot and the live calls fail safely (the baked list stays; the browser console shows a 404 for the API). Change generated server files only in `web/config/serverConfig.ts` and run `pnpm server-config`.
- **Host injection (built in the site; the host side is the CMS repo's work):** the build leaves markers in the prerendered pages and the CMS host fills them from live data, so a CMS change is visible to search engines at once without a rebuild. Contract and plan: `aidlc-docs/features/asf-cms-host-injection/plan.md`; golden files for the list HTML: `web/contract/host-injection/`. - **Host injection (built in the site; the host side is the CMS repo's work):** the build leaves markers in the prerendered pages and the CMS host fills them from live data, so a CMS change is visible to search engines at once without a rebuild. Contract and plan: `aidlc-docs/features/asf-cms-host-injection/plan.md`; golden files for the list HTML: `web/contract/host-injection/`.
- Markers: `<!--CMS:DATA-->` + `<script type="application/json" id="cms-data">` (root document, every page), `<!--CMS:OFFERINGS-HTML-->`, `<!--CMS:BANNER-TOP-HTML-->` and `<!--CMS:BANNER-BOTTOM-HTML-->` regions (home page), `<!--CMS:OFFER-JSON-LD slug="...">` before the ld+json block of the newborn, zwangerschap and gezin pages, and `<span data-cms-price="slug">` in their price block. - Markers: `<!--CMS:DATA-->` + `<script type="application/json" id="cms-data">` (root document, every page), `<!--CMS:OFFERINGS-HTML-->`, `<!--CMS:BANNER-TOP-HTML-->` and `<!--CMS:BANNER-BOTTOM-HTML-->` regions (home page), `<!--CMS:OFFER-JSON-LD slug="...">` before the ld+json block of the newborn, zwangerschap and gezin pages, and `<span data-cms-price="slug">` in their price block.
- In the page: `CmsRegion` renders the plain HTML between the markers (`lib/cmsHtml.ts`, styled by `.cms-*` rules in `theme.ts`) and React leaves it alone until hydration, so a host that wrote different data causes no hydration mismatch; after hydration the styled components take over. `PackagesProvider` reads the data block in the first render after hydration (`hostCmsData`); a block with `"source":"build"` is the baked one and counts as "no host data", so the page asks the API as before. The site address comes from `siteUrl` in the block (`setSiteUrl` in `client.tsx`), because the script files cannot be rewritten per host. - In the page: `CmsRegion` renders the plain HTML between the markers (`lib/cmsHtml.ts`, styled by `.cms-*` rules in `theme.ts`) and React leaves it alone until hydration, so a host that wrote different data causes no hydration mismatch; after hydration the styled components take over. `PackagesProvider` reads the data block in the first render after hydration (`hostCmsData`); a block with `"source":"build"` is the baked one and counts as "no host data", so the page asks the API as before. The site address comes from `siteUrl` in the block (`setSiteUrl` in `client.tsx`), because the script files cannot be rewritten per host.
@@ -60,11 +60,10 @@ Decision (Bryan, 2026-11-15): the hosting package has one entry per website. The
## Environment and variables ## Environment and variables
| Name | Where | Meaning | | Name | Where | Meaning |
| --------------------------- | ------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | --------------------------- | --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `OFFERINGS_URL` | build env | Site address that serves the API (for example `https://test.andreaslop.nl`). Unset gives the snapshot. | | `OFFERINGS_URL` | build env | Site address that serves the API (for example `https://test.andreaslop.nl`). Unset gives the snapshot. |
| `ASF_OFFERINGS_URL_TEST` | Gitea repo variable | Value of `OFFERINGS_URL` for the test build. Set by SLS, not by feature sessions. |
| `API_PROXY_TARGET` | dev env | Forwards `/api` in `pnpm dev` to a CMS host. | | `API_PROXY_TARGET` | dev env | Forwards `/api` in `pnpm dev` to a CMS host. |
| `VITE_SITE_URL` | build env | Address the site presents itself under (canonical, og:*, JSON-LD, sitemap). Only the test build sets it (`https://test.andreaslop.nl`); unset gives `https://andreaslop.nl`. | | `VITE_SITE_URL` | build env | Address the site presents itself under (canonical, og:*, JSON-LD, sitemap). Only the test build sets it (`https://test.andreaslop.nl`); unset gives `https://andreaslop.nl`. |
| `VITE_CONTACT_FORM_ENABLED` | build env | Opens the contact form when exactly `true`. Only the test build sets it; unset keeps the form closed (production). Opening it in production needs Bryan's explicit go, after the captcha decision ([go-live-checklist.md](go-live-checklist.md)). | | `VITE_CONTACT_FORM_ENABLED` | build env | Opens the contact form when exactly `true`. Only the test build sets it; unset keeps the form closed (production). Opening it in production needs Bryan's explicit go, after the captcha decision ([go-live-checklist.md](go-live-checklist.md)). |
The production artifact is built without `OFFERINGS_URL` on purpose: production must never carry the prices of the test CMS. No build sets `OFFERINGS_URL` any more (since the host injection, 2026-11-18): the CMS host writes the current data into the HTML. The variable stays supported for a local build against a CMS. The production artifact never carries the prices of the test CMS.
+26 -3
View File
@@ -20,8 +20,8 @@ Dispatch from the CLI (the token comes from your git credentials, never print it
## Jobs ## Jobs
1. `check`: lint, format, unit/property/axe tests (coverage threshold 100% on `src/lib/**`), build **without** `OFFERINGS_URL` (so with the committed snapshot), audit. Uploads artifact `dist` (this is what production gets). 1. `check`: lint, format, unit/property/axe tests (coverage threshold 100% on `src/lib/**`), build (with the committed package snapshot), audit. Uploads artifact `dist` (this is what production gets).
2. `build-test`: builds again with `OFFERINGS_URL=${{ vars.ASF_OFFERINGS_URL_TEST }}` (packages and banners from the test CMS) and `VITE_SITE_URL=https://test.andreaslop.nl` (see "Own address of the test site") and uploads `dist-test`. 2. `build-test`: builds again with `VITE_CONTACT_FORM_ENABLED=true` and `VITE_SITE_URL=https://test.andreaslop.nl` (see "Own address of the test site") and uploads `dist-test`.
3. `deploy-test`: needs `check` and `build-test`, downloads `dist-test`, uploads to the ASF test host and runs the deployment check (served by the CMS host, admin files, POST status). 3. `deploy-test`: needs `check` and `build-test`, downloads `dist-test`, uploads to the ASF test host and runs the deployment check (served by the CMS host, admin files, POST status).
4. `lighthouse`: against the built site with the preview stub (`--audit-route --contact-stub`). 4. `lighthouse`: against the built site with the preview stub (`--audit-route --contact-stub`).
5. `deploy-production`: manual, from `release/*` only, uses artifact `dist`. 5. `deploy-production`: manual, from `release/*` only, uses artifact `dist`.
@@ -52,4 +52,27 @@ The test site stands on its own: in the test build `VITE_SITE_URL` is `https://t
There used to be a nightly test build (`schedule`, 03:15 UTC) that baked the CMS data into the HTML for search engines. It is gone: the CMS host writes the packages, banners and hero into the first HTML of every request (cache 60 s, refreshed at once on a change; NFR-10), so a content change is visible without a rebuild. A rebuild is only needed for code and design. The nightly run also put `master` over ASF-test every night, which would undo a feature branch deployed there. There used to be a nightly test build (`schedule`, 03:15 UTC) that baked the CMS data into the HTML for search engines. It is gone: the CMS host writes the packages, banners and hero into the first HTML of every request (cache 60 s, refreshed at once on a change; NFR-10), so a content change is visible without a rebuild. A rebuild is only needed for code and design. The nightly run also put `master` over ASF-test every night, which would undo a feature branch deployed there.
The production site gets the same only when the ASF production site is served by the CMS host (the IIS pipeline, later; see [go-live-checklist.md](go-live-checklist.md)). Until then production shows the committed snapshot. The test build still sets `OFFERINGS_URL`; removing that (and `VITE_SITE_URL`) is a separate follow-up once host injection is confirmed end to end. The production site gets the same only when the ASF production site is served by the CMS host (the IIS pipeline, later; see [go-live-checklist.md](go-live-checklist.md)). Until then production shows the committed snapshot. The test build no longer sets `OFFERINGS_URL` (removed 2026-11-18, once the host injection was confirmed on ASF-test); it still sets `VITE_SITE_URL` (own address of the test site) and `VITE_CONTACT_FORM_ENABLED`.
## Names of the repo variables and secrets
Format `{ENV}_{GROUP}_{NAME}` with `ENV` = `TEST` or `PROD`, no app part (this repo only deploys the ASF site) and no `VITE` (the pipeline maps a value to `VITE_...` in the build). Decision of Bryan, 2026-11-18; the full list is in the SLS repo (`aidlc-docs/_shared/gitea-naamgeving-variabelen.md`). Repo variables and secrets are created by SLS, not by feature sessions.
| Name | Kind | Used by |
| -------------------------------------------------------------------------------- | -------- | --------------------------------------------------------------------------------------------------------------------------------------------- |
| `TEST_DEPLOY_PATH` | variable | `deploy-test`: target folder on the Pi |
| `TEST_HEALTH_URL` | variable | `deploy-test`: check after the deploy |
| `PROD_DEPLOY_PATH` | variable | `deploy-production`: remote folder (default `wwwroot`) |
| `PROD_HEALTH_URL` | variable | `deploy-production`: check after the deploy |
| `TEST_SENTRY_DSN`, `TEST_UMAMI_SCRIPT_URL`, `TEST_UMAMI_WEBSITE_ID` | variable | `build-test` and the CSP check in `deploy-test` (as `VITE_SENTRY_DSN`, `VITE_UMAMI_SCRIPT_URL`, `VITE_UMAMI_WEBSITE_ID`, `VITE_APP_ENV=test`) |
| `PROD_SENTRY_DSN`, `PROD_UMAMI_SCRIPT_URL`, `PROD_UMAMI_WEBSITE_ID` | variable | `check` (the production artifact; `VITE_APP_ENV=production`) |
| `PROD_HOST_ADDRESS`, `PROD_HOST_USERNAME`, `PROD_HOST_PASSWORD` | secrets | `deploy-production`: FTPS (explicit TLS) at the hosting partner |
| `TEST_HOST_ADDRESS`, `TEST_HOST_PORT`, `TEST_HOST_USERNAME`, `TEST_HOST_SSH_KEY` | secrets | `deploy-test`: SSH key login to the Pi (one shared deploy key; no password) |
Removed: `PI_MAIN_*` (the SSH password login; the old secrets are deleted by Bryan after a green run), `DEPLOY_PATH_TEST`, `HEALTH_CHECK_URL_TEST`, `HEALTH_CHECK_URL_PRODUCTION`, `FTP_REMOTE_DIR`, `FTP_HOST`, `FTP_USERNAME`, `FTP_PASSWORD` (renamed), `ASF_OFFERINGS_URL_TEST` and `ASF_TEST_SERVED_BY_CMS` (no longer needed). The old names in the repo are removed by SLS after a green run.
**Monitoring per build.** Sentry and Umami settings are no longer in the code (`src/monitoring/config.ts`): every build gets them for its own environment and measures only on that environment's host (production build on `andreaslop.nl`, test build on `test.andreaslop.nl`; any other host measures nothing). The CSP origins for Umami and Sentry (`config/securityHeaders.ts`) come from the same variables, so a build without them has neither a measurement nor those origins; the build steps fail when a variable is empty. Unit and browser tests use the production values from `config/monitoringTestEnv.ts` (public values, the same as the variables); `pnpm server-config` does too, so the committed generated files carry the production CSP. The CMS host has its own copy of the origins in its environment (CMS repo).
## FTPS to production
The production package offers FTP over TLS. `deploy/upload-production.sh` forces explicit FTPS (`AUTH TLS`): `ftp:ssl-force yes`, `ftp:ssl-protect-data yes` and `ftp:ssl-protect-list yes`, so login, listings and files are encrypted, and the session refuses to fall back to plain FTP. The certificate of the server is checked (`ssl:verify-certificate yes`); if the host turns out to have a non-public certificate, record what is needed (the CA file) and ask Bryan before relaxing anything. The mode is passive. Use a separate FTP account with rights only on the folder of the prerendered pages and a unique strong password that only exists as the secret `PROD_HOST_PASSWORD`. The script uploads in three rounds (everything except HTML, then all HTML, then cleaning up old files) into the prerendered-pages folder of the CMS host (`PROD_DEPLOY_PATH`, the exact folder is still open, see `aidlc-docs/features/asf-production-iis/plan.md`, A2). It does not put a `web.config` there and deletes nothing outside that folder; the host and its `web.config` come from the CMS pipeline. `PROD_HOST_PORT` is optional (default 21). The tests (`e2e/deployScripts.e2e.ts`) check the lftp settings with a fake lftp and the upload with a local `file:` target; the real FTPS connection is tested by Bryan with the `PROD_HOST_*` secrets.
+1 -1
View File
@@ -11,7 +11,7 @@ What must be true before the CMS-driven parts of the site go to production. Brya
- [ ] Production hosting in place with the CMS host as the one entry of the website: IIS passes ALL requests to the CMS host (not only `/api/v1/*`) and serves no static files itself; the prerendered `dist/` is deployed to the CMS host ([cms-integration.md](cms-integration.md), "Hosting"). The generated IIS config and the production upload script are updated for this. Without it production keeps the committed snapshot and the console shows a 404 per page view for the API. - [ ] Production hosting in place with the CMS host as the one entry of the website: IIS passes ALL requests to the CMS host (not only `/api/v1/*`) and serves no static files itself; the prerendered `dist/` is deployed to the CMS host ([cms-integration.md](cms-integration.md), "Hosting"). The generated IIS config and the production upload script are updated for this. Without it production keeps the committed snapshot and the console shows a 404 per page view for the API.
- [ ] `web/src/content/offerings.snapshot.json` holds the real, current packages (production builds use it). - [ ] `web/src/content/offerings.snapshot.json` holds the real, current packages (production builds use it).
- [ ] The production CMS holds the real packages. The test CMS prices must never end up in the production artifact (it is built without `OFFERINGS_URL`). - [ ] The production CMS holds the real packages. The test CMS prices must never end up in the production artifact (no build fetches packages from a CMS any more).
## Hero ## Hero
+48
View File
@@ -0,0 +1,48 @@
# Redirects of the old WordPress addresses (redirects.json)
The old site of andreaslop.nl was a WordPress site. Its addresses that are still indexed get a redirect (or "gone") on the new site. The site is the source of the list; the CMS host reads it and applies it the same on test and on production. The inventory of the old addresses is in `aidlc-docs/features/asf-production-iis/oude-urls.md`.
## Where it comes from
- The list is in code: `web/config/redirectRules.ts` (with tests in `redirectRules.test.ts`).
- `pnpm build` ends with `web/config/writeRedirects.ts`, which writes `dist/client/redirects.json`, next to `index.html`. The deploy puts it in the prerendered-pages folder of the host (on test with the rest of `dist-test`, on production with the FTP upload). `deploy/check-artifact.sh` refuses a build without it.
- Change the list only in `redirectRules.ts`; the file is never edited by hand.
## Format (agreed with the CMS session, design of 2026-11-18)
```json
{
"version": 1,
"redirects": [
{ "from": "/portfolio-item/decoration", "to": "/portfolio", "status": 301 },
{ "from": "/feed", "status": 410 }
]
}
```
- `from`: a path with one leading slash, without query string, fragment or `..`. The first segment is never `admin`, `health` or `api`. The host matches it case insensitive and with or without a slash at the end, so a path is given once (both forms count as a duplicate).
- `status`: `301`, `404` or `410`.
- `to`: required for a 301 (a path of this site, or an absolute `https://` address; this list only uses paths) and not allowed for 404 and 410. It is never the same as `from`, and never itself a rule (no chains).
- No patterns, no wildcards, no query-string rules (decision of Bryan: only plain paths). At most 5000 rules and 1 MB.
- The host answers a 301 with `Location` and `Cache-Control: max-age=3600`, a 404 or 410 with the 404 page of the site as the body. A rule wins over an existing file. Only GET and HEAD. `redirects.json` itself is not served.
## What is in the list
| Old address | Answer |
| ---------------------------------------------------------------------------------------- | --------------------- |
| `/sitemap_index.xml`, `/wp-sitemap.xml` and the five old sub-sitemaps | 301 to `/sitemap.xml` |
| `/portfolio-item` and the 15 items of the old sitemap | 301 to `/portfolio` |
| `/portfolio-tag/{homepage,portfolio-gallerij,simple}` | 301 to `/portfolio` |
| `/testimonials-category/photo` | 301 to `/` |
| `/masonry-gallery-category/test-masonry-gallery` (theme demo), `/feed`, `/comments/feed` | 410 |
Not in the list on purpose:
- The real pages (`/over-mij/`, `/portfolio/`, `/soorten-fotoshoots/`, `/contact/`): the host redirects the slash, case and `.html` variants canonically (`web/config/canonicalUrls.ts`); the slugs are the same as on the new site.
- Query-string addresses (`/?page_id=17`, `/?s=...`): decision of Bryan.
- Addresses that are a 404 anyway: `/wp-admin`, `/wp-login.php`, `/xmlrpc.php`, `/wp-json`, `/wp-content`, `/category`, `/tag`, `/author`. A path without a rule gives the 404 page already.
## Open
- Whether to check Google Search Console and external links (Instagram, Google Business Profile) for other old addresses before the old site is switched off; if there are any, add them to `redirectRules.ts`.
- After the host reads the file (CMS repo, small PR of SMC): add a check to `deploy/verify-deployment.sh --cms` that `/portfolio-item/decoration/` gives a 301 to `/portfolio`.
+12
View File
@@ -0,0 +1,12 @@
// De monitoringinstellingen die de tests als productiebuild zien. De echte
// waarden komen in de pipeline uit de Gitea-variabelen PROD_SENTRY_DSN,
// PROD_UMAMI_SCRIPT_URL en PROD_UMAMI_WEBSITE_ID (en TEST_...); deze openbare
// waarden zijn er hetzelfde als, zodat de gegenereerde serverconfiguratie en de
// CSP in de tests vergelijkbaar blijven. Zie src/monitoring/config.ts.
export const monitoringTestEnv = {
VITE_APP_ENV: 'production',
VITE_SENTRY_DSN:
'https://12ec77dcc3216a98b96d3fb3dac13f66@o4511795618185216.ingest.de.sentry.io/4512282287472720',
VITE_UMAMI_SCRIPT_URL: 'https://analytics.slpsoftware.nl/script.js',
VITE_UMAMI_WEBSITE_ID: '3edbb7d1-4388-4f2d-9cef-11ade88ace96',
};
+173
View File
@@ -0,0 +1,173 @@
import { describe, expect, it } from 'vitest';
import {
MAX_REDIRECTS,
REDIRECT_FORMAT_VERSION,
redirectProblems,
redirectRules,
redirectTargets,
redirectsJson,
type RedirectRule,
} from './redirectRules';
// What the host does with the file (the format is in docs/redirect-rules.md);
// the host has its own implementation and tests
function resolve(rules: readonly RedirectRule[], rawPath: string) {
const path = rawPath.toLowerCase().replace(/\/+$/, '') || '/';
return rules.find((rule) => rule.from.toLowerCase() === path);
}
describe('redirectRules', () => {
it('has no problems', () => {
expect(redirectProblems(redirectRules)).toEqual([]);
});
it('sends every 301 to a page of the site or the sitemap', () => {
for (const rule of redirectRules.filter((r) => r.status === 301)) {
expect(redirectTargets).toContain(rule.to);
}
});
it.each([
['/sitemap_index.xml', 301, '/sitemap.xml'],
['/wp-sitemap.xml', 301, '/sitemap.xml'],
['/page-sitemap.xml', 301, '/sitemap.xml'],
['/portfolio-item-sitemap.xml', 301, '/sitemap.xml'],
['/masonry-gallery-category-sitemap.xml', 301, '/sitemap.xml'],
['/portfolio-tag-sitemap.xml', 301, '/sitemap.xml'],
['/testimonials-category-sitemap.xml', 301, '/sitemap.xml'],
['/portfolio-item/', 301, '/portfolio'],
['/portfolio-item/decoration/', 301, '/portfolio'],
['/portfolio-item/wedding-dress/', 301, '/portfolio'],
['/portfolio-item/best-girls/', 301, '/portfolio'],
['/portfolio-item/mm-1/', 301, '/portfolio'],
['/portfolio-item/wedding-cake/', 301, '/portfolio'],
['/portfolio-item/mm2/', 301, '/portfolio'],
['/portfolio-item/cake-smash-1/', 301, '/portfolio'],
['/portfolio-item/hairstyles/', 301, '/portfolio'],
['/portfolio-item/360/', 301, '/portfolio'],
['/portfolio-item/366/', 301, '/portfolio'],
['/portfolio-item/353/', 301, '/portfolio'],
['/portfolio-item/homepage-foto/', 301, '/portfolio'],
['/portfolio-item/getting-ready/', 301, '/portfolio'],
['/portfolio-item/m1/', 301, '/portfolio'],
['/portfolio-item/f1/', 301, '/portfolio'],
['/Portfolio-Item/MM1', undefined, undefined],
['/portfolio-item/MM-1', 301, '/portfolio'],
['/portfolio-tag/homepage/', 301, '/portfolio'],
['/portfolio-tag/portfolio-gallerij/', 301, '/portfolio'],
['/portfolio-tag/simple/', 301, '/portfolio'],
['/testimonials-category/photo/', 301, '/'],
['/masonry-gallery-category/test-masonry-gallery/', 410, undefined],
['/feed/', 410, undefined],
['/comments/feed/', 410, undefined],
])('%s gives %s %s', (path, status, to) => {
const rule = resolve(redirectRules, path);
expect(rule?.status).toBe(status);
expect(rule?.to).toBe(to);
});
it('leaves the real pages and their canonical variants to the host', () => {
for (const path of [
'/',
'/over-mij',
'/over-mij/',
'/portfolio',
'/soorten-fotoshoots/newborn',
'/contact',
'/robots.txt',
'/sitemap.xml',
'/assets/index-abc.js',
'/admin/',
'/api/v1/offerings',
'/wp-login.php',
]) {
expect(resolve(redirectRules, path)).toBeUndefined();
}
});
});
describe('redirectProblems', () => {
const rule = (extra: Partial<RedirectRule>): RedirectRule => ({
from: '/a',
to: '/b',
status: 301,
...extra,
});
it.each([
[rule({ from: 'a' }), 'not a usable path'],
[rule({ from: '/' }), 'not a usable path'],
[rule({ from: '//a' }), 'not a usable path'],
[rule({ from: '/a/../b' }), 'not a usable path'],
[rule({ from: '/a?x=1' }), 'not a usable path'],
[rule({ from: '/a#b' }), 'not a usable path'],
[rule({ from: '/Admin/x' }), 'answered by the host'],
[rule({ from: '/api/v1' }), 'answered by the host'],
[rule({ from: '/health' }), 'answered by the host'],
[rule({ to: undefined }), 'needs a path'],
[rule({ to: 'https://evil.example/' }), 'needs a path'],
[rule({ to: '//evil.example' }), 'needs a path'],
[rule({ to: '/A/' }), 'the same'],
[rule({ status: 410 }), 'only a 301 has a target'],
[rule({ status: 404 }), 'only a 301 has a target'],
])('flags %j', (bad, text) => {
expect(redirectProblems([bad]).join()).toContain(text);
});
it('flags a duplicate, also in another case or with a slash', () => {
expect(redirectProblems([rule({}), rule({})]).join()).toContain(
'duplicate',
);
expect(
redirectProblems([
rule({ from: '/A' }),
rule({ from: '/a/' }),
]).join(),
).toContain('duplicate');
});
it('flags a chain', () => {
expect(
redirectProblems([
rule({ from: '/a', to: '/b' }),
rule({ from: '/b', to: '/c' }),
]).join(),
).toContain('is a rule too');
});
it('flags too many rules', () => {
const many = Array.from({ length: MAX_REDIRECTS + 1 }, (_, i) =>
rule({ from: `/p${i}`, to: '/x' }),
);
expect(redirectProblems(many).join()).toContain('more than');
});
it('accepts a 404 and a 410 without a target', () => {
expect(
redirectProblems([
rule({ status: 404, to: undefined }),
rule({ from: '/b', status: 410, to: undefined }),
]),
).toEqual([]);
});
});
describe('redirectsJson', () => {
it('writes the version and the redirects', () => {
const parsed = JSON.parse(redirectsJson());
expect(parsed.version).toBe(REDIRECT_FORMAT_VERSION);
expect(parsed.redirects).toEqual(redirectRules);
expect(Object.keys(parsed)).toEqual(['version', 'redirects']);
expect(redirectsJson().endsWith('\n')).toBe(true);
});
it('stays far below the size limit of the host', () => {
expect(redirectsJson().length).toBeLessThan(100_000);
});
it('refuses a list with problems', () => {
expect(() => redirectsJson([{ from: 'x', status: 404 }])).toThrow(
'Invalid redirect rules',
);
});
});
+155
View File
@@ -0,0 +1,155 @@
// Redirects for the old WordPress addresses of andreaslop.nl (decision of
// Bryan, 2026-11-18; the inventory is aidlc-docs/features/asf-production-iis/
// oude-urls.md). The site is the source: this list is written into the build
// as redirects.json and the CMS host reads it, the same on test and on
// production. The format is the one of the host (design of SMC, 2026-11-18):
// exact paths only, no patterns; see docs/redirect-rules.md.
//
// Not in this list: the slash, case and .html variants of the real pages
// (/over-mij/ and so on; the host redirects those canonically, see
// config/canonicalUrls.ts), query-string addresses (?page_id=, decision of
// Bryan) and addresses that are a 404 anyway (/wp-admin, /wp-login.php,
// /xmlrpc.php, /wp-json, /wp-content, /category, /tag, /author, /?s=): an
// unknown path gives the 404 page without a rule.
import { pagePaths } from './canonicalUrls.ts';
export type RedirectStatus = 301 | 404 | 410;
export interface RedirectRule {
// A path with one leading slash. The host matches it case insensitive and
// with or without a slash at the end (so give it once).
from: string;
// Only for 301: a path of this site
to?: string;
status: RedirectStatus;
}
export const REDIRECT_FORMAT_VERSION = 1;
export const MAX_REDIRECTS = 5000;
// The host answers these paths itself; a rule there would never be read
const RESERVED_FIRST_SEGMENTS = ['admin', 'health', 'api'];
const permanent = (from: string, to: string): RedirectRule => ({
from,
to,
status: 301,
});
const gone = (from: string): RedirectRule => ({ from, status: 410 });
// The old sitemaps: search engines find the new one
const sitemaps = [
'/sitemap_index.xml',
'/wp-sitemap.xml',
'/page-sitemap.xml',
'/portfolio-item-sitemap.xml',
'/masonry-gallery-category-sitemap.xml',
'/portfolio-tag-sitemap.xml',
'/testimonials-category-sitemap.xml',
];
// The gallery items of the theme (from the old sitemap, 2026-11-18): the
// portfolio is the nearest page
const portfolioItems = [
'decoration',
'wedding-dress',
'best-girls',
'mm-1',
'wedding-cake',
'mm2',
'cake-smash-1',
'hairstyles',
'360',
'366',
'353',
'homepage-foto',
'getting-ready',
'm1',
'f1',
];
const portfolioTags = ['homepage', 'portfolio-gallerij', 'simple'];
export const redirectRules: readonly RedirectRule[] = [
...sitemaps.map((from) => permanent(from, '/sitemap.xml')),
permanent('/portfolio-item', '/portfolio'),
...portfolioItems.map((name) =>
permanent(`/portfolio-item/${name}`, '/portfolio'),
),
...portfolioTags.map((name) =>
permanent(`/portfolio-tag/${name}`, '/portfolio'),
),
// The theme archive of testimonials: they are on the home page
permanent('/testimonials-category/photo', '/'),
// Theme demo content and the feeds: no equivalent and no berichten
gone('/masonry-gallery-category/test-masonry-gallery'),
gone('/feed'),
gone('/comments/feed'),
];
const pathPattern = /^\/[A-Za-z0-9._~/%-]*$/;
const isPath = (value: string): boolean =>
pathPattern.test(value) && !value.startsWith('//') && !value.includes('..');
// What the host compares: lower case, without a slash at the end
const key = (path: string): string =>
path.toLowerCase().replace(/\/+$/, '') || '/';
// The reasons a rule list is not usable; empty when it is. The host validates
// the file again; the tests check this list and what is written from it.
export function redirectProblems(rules: readonly RedirectRule[]): string[] {
const problems: string[] = [];
if (rules.length > MAX_REDIRECTS) {
problems.push(`more than ${MAX_REDIRECTS} rules`);
}
const froms = new Map<string, RedirectRule>();
rules.forEach((rule, index) => {
const label = `rule ${index + 1} (${rule.from})`;
if (!isPath(rule.from) || rule.from === '/') {
problems.push(`${label}: from is not a usable path`);
return;
}
const first = key(rule.from).split('/')[1];
if (RESERVED_FIRST_SEGMENTS.includes(first)) {
problems.push(`${label}: ${first} is answered by the host itself`);
}
if (froms.has(key(rule.from))) problems.push(`${label}: duplicate`);
froms.set(key(rule.from), rule);
if (rule.status === 301) {
if (!rule.to || !isPath(rule.to)) {
problems.push(
`${label}: a 301 needs a path of this site in to`,
);
} else if (key(rule.to) === key(rule.from)) {
problems.push(`${label}: from and to are the same`);
}
} else if (rule.to !== undefined) {
problems.push(`${label}: only a 301 has a target`);
}
});
// No chains: a target is never itself a rule (the host would flatten it,
// or it is gone)
for (const rule of rules) {
if (rule.status === 301 && rule.to && froms.has(key(rule.to))) {
problems.push(
`rule ${rule.from}: the target ${rule.to} is a rule too`,
);
}
}
return problems;
}
// The pages a 301 may point to: every page of the site and the sitemap
export const redirectTargets: readonly string[] = [
...pagePaths,
'/sitemap.xml',
];
export function redirectsJson(
rules: readonly RedirectRule[] = redirectRules,
): string {
const problems = redirectProblems(rules);
if (problems.length > 0) {
throw new Error(`Invalid redirect rules:\n${problems.join('\n')}`);
}
return `${JSON.stringify({ version: REDIRECT_FORMAT_VERSION, redirects: rules }, null, 2)}\n`;
}
+11 -1
View File
@@ -1,4 +1,4 @@
import { describe, expect, it } from 'vitest'; import { afterEach, describe, expect, it, vi } from 'vitest';
import { contentSecurityPolicy, securityHeaders } from './securityHeaders'; import { contentSecurityPolicy, securityHeaders } from './securityHeaders';
const umami = 'https://analytics.slpsoftware.nl'; const umami = 'https://analytics.slpsoftware.nl';
@@ -12,7 +12,17 @@ const captchaFrames = [
const directive = (csp: string, name: string) => const directive = (csp: string, name: string) =>
csp.split('; ').find((d) => d.startsWith(name + ' ')) ?? ''; csp.split('; ').find((d) => d.startsWith(name + ' ')) ?? '';
afterEach(() => vi.unstubAllEnvs());
describe('securityHeaders', () => { describe('securityHeaders', () => {
it('noemt Umami en Sentry niet zonder monitoringinstellingen in de build', () => {
vi.stubEnv('VITE_SENTRY_DSN', '');
const csp = contentSecurityPolicy('production');
expect(csp).not.toContain(umami);
expect(csp).not.toContain(sentry);
expect(directive(csp, 'script-src')).toBe("script-src 'self'");
});
it('productie-CSP heeft geen onveilige uitzonderingen voor scripts', () => { it('productie-CSP heeft geen onveilige uitzonderingen voor scripts', () => {
const csp = contentSecurityPolicy('production'); const csp = contentSecurityPolicy('production');
expect(csp).not.toContain('unsafe-eval'); expect(csp).not.toContain('unsafe-eval');
+10 -5
View File
@@ -1,7 +1,7 @@
// HTTP-securityheaders voor de Vite dev- en preview-server. De productieset is // HTTP-securityheaders voor de Vite dev- en preview-server. De productieset is
// ook het voorschrift voor de toekomstige host (zie NFR-SEC-01/02). // ook het voorschrift voor de toekomstige host (zie NFR-SEC-01/02).
import { sentryIngestOrigin, umamiOrigin } from '../src/monitoring/config.ts'; import { monitoringOrigins } from '../src/monitoring/config.ts';
type Mode = 'production' | 'development'; type Mode = 'production' | 'development';
@@ -21,19 +21,24 @@ export const captchaFrameOrigins = [
'https://global1.frcapi.com', 'https://global1.frcapi.com',
]; ];
const productionCsp: Record<string, string[]> = { // De herkomsten van Umami en Sentry komen uit de build-omgeving (zie
// src/monitoring/config.ts); zonder die instellingen staan ze er niet in.
function productionCsp(): Record<string, string[]> {
const origins = monitoringOrigins();
return {
'default-src': ["'self'"], 'default-src': ["'self'"],
'script-src': ["'self'", umamiOrigin], 'script-src': ["'self'", ...origins.umami],
'style-src': ["'self'", "'unsafe-inline'"], 'style-src': ["'self'", "'unsafe-inline'"],
'img-src': ["'self'", 'data:'], 'img-src': ["'self'", 'data:'],
'font-src': ["'self'"], 'font-src': ["'self'"],
'connect-src': ["'self'", umamiOrigin, sentryIngestOrigin], 'connect-src': ["'self'", ...origins.umami, ...origins.sentry],
'frame-src': captchaFrameOrigins, 'frame-src': captchaFrameOrigins,
'object-src': ["'none'"], 'object-src': ["'none'"],
'base-uri': ["'self'"], 'base-uri': ["'self'"],
'form-action': ["'self'"], 'form-action': ["'self'"],
'frame-ancestors': ["'none'"], 'frame-ancestors': ["'none'"],
}; };
}
// Alleen wat de Vite dev-server zelf nodig heeft: een inline script voor // Alleen wat de Vite dev-server zelf nodig heeft: een inline script voor
// React Refresh en een websocket voor hot reload. // React Refresh en een websocket voor hot reload.
@@ -43,7 +48,7 @@ const developmentExtras: Record<string, string[]> = {
}; };
export function contentSecurityPolicy(mode: Mode): string { export function contentSecurityPolicy(mode: Mode): string {
return Object.entries(productionCsp) return Object.entries(productionCsp())
.map(([directive, sources]) => { .map(([directive, sources]) => {
const extra = const extra =
mode === 'development' mode === 'development'
+10
View File
@@ -0,0 +1,10 @@
// Writes redirects.json next to the pages of the build (the last step of
// pnpm build, after externalizeInlineScripts). Runs directly with Node.
import { mkdirSync, writeFileSync } from 'node:fs';
import { join } from 'node:path';
import { redirectsJson } from './redirectRules.ts';
const outDir = process.argv[2] ?? join('dist', 'client');
mkdirSync(outDir, { recursive: true });
writeFileSync(join(outDir, 'redirects.json'), redirectsJson());
console.log(`redirects.json written to ${outDir}`);
+7
View File
@@ -2,8 +2,15 @@
// Draait direct met Node (type stripping), zonder extra tooling. // Draait direct met Node (type stripping), zonder extra tooling.
import { mkdirSync, writeFileSync } from 'node:fs'; import { mkdirSync, writeFileSync } from 'node:fs';
import { dirname } from 'node:path'; import { dirname } from 'node:path';
import { monitoringTestEnv } from './monitoringTestEnv.ts';
import { serverConfigFiles } from './serverConfig.ts'; import { serverConfigFiles } from './serverConfig.ts';
// The committed files carry the CSP of the production build; the origins of
// Umami and Sentry come from the environment (src/monitoring/config.ts)
for (const [name, value] of Object.entries(monitoringTestEnv)) {
process.env[name] ??= value;
}
for (const [path, generate] of Object.entries(serverConfigFiles)) { for (const [path, generate] of Object.entries(serverConfigFiles)) {
mkdirSync(dirname(path), { recursive: true }); mkdirSync(dirname(path), { recursive: true });
writeFileSync(path, generate()); writeFileSync(path, generate());
+1 -1
View File
@@ -22,7 +22,7 @@ fail() {
failures=$((failures + 1)) failures=$((failures + 1))
} }
for file in index.html 404.html over-mij.html; do for file in index.html 404.html over-mij.html redirects.json; do
if [ -f "$dist/$file" ]; then if [ -f "$dist/$file" ]; then
echo "gevonden: $file" echo "gevonden: $file"
else else
+25 -13
View File
@@ -1,7 +1,14 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# Upload naar productie in drie rondes (BR-HST-14, 15; FR-PR-18). # Upload naar productie in drie rondes (BR-HST-14, 15; FR-PR-18).
# Gebruik: upload-production.sh <dist-map> <doelmap-op-de-server> # Gebruik: upload-production.sh <dist-map> <doelmap-op-de-server>
# Verbinding: FTP_HOST, FTP_USER en LFTP_PASSWORD uit de omgeving (FTPS). # De doelmap is de map met voorgerenderde pagina's van de CMS-host; de host
# (en zijn web.config) staat er los van en wordt door de CMS-pijplijn gedeployd.
# Verbinding: FTP_HOST, FTP_USER en LFTP_PASSWORD uit de omgeving, optioneel
# FTP_PORT. Alleen FTP over TLS (FTPS, explicit: AUTH TLS): de inlog en de
# bestanden gaan versleuteld, zonder terugval naar gewone FTP, en het
# certificaat van de server wordt gecontroleerd (zie docs/deploy-and-ci.md,
# "FTPS to production"). Gebruik een eigen FTP-account met rechten alleen op
# deze map.
# Alleen voor de test: LFTP_OPEN (bijvoorbeeld file:///) vervangt de # Alleen voor de test: LFTP_OPEN (bijvoorbeeld file:///) vervangt de
# verbinding, en UPLOAD_PASS=1|2|3 voert maar één ronde uit. # verbinding, en UPLOAD_PASS=1|2|3 voert maar één ronde uit.
set -euo pipefail set -euo pipefail
@@ -36,7 +43,6 @@ done
here="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" here="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
bash "$here/check-artifact.sh" "$dist" bash "$here/check-artifact.sh" "$dist"
cp "$here/iis/web.config" "$dist/web.config"
pass="${UPLOAD_PASS:-all}" pass="${UPLOAD_PASS:-all}"
case "$pass" in case "$pass" in
@@ -48,7 +54,10 @@ wants() { [ "$pass" = all ] || [ "$pass" = "$1" ]; }
# Geen back-ups: lftp zet standaard een kopie met een tijdstempel # Geen back-ups: lftp zet standaard een kopie met een tijdstempel
# (web.config~20261101221045~) naast elk bestand dat het overschrijft. Op de # (web.config~20261101221045~) naast elk bestand dat het overschrijft. Op de
# host zou elke deploy er een achterlaten, bereikbaar voor wie de naam raadt. # host zou elke deploy er een achterlaten, bereikbaar voor wie de naam raadt.
settings="set ftp:ssl-force true; set ftp:ssl-protect-data true; set net:max-retries 3; set xfer:make-backup no;" # TLS: explicit FTPS afdwingen (de sessie weigert inloggen zonder TLS, ook de
# datakanalen en de lijsten zijn versleuteld) en het certificaat controleren.
tls="set ftp:ssl-allow yes; set ftp:ssl-auth TLS; set ftp:ssl-force yes; set ftp:ssl-protect-data yes; set ftp:ssl-protect-list yes; set ssl:verify-certificate yes;"
settings="$tls set ftp:passive-mode on; set net:max-retries 3; set xfer:make-backup no;"
# Elke opdracht krijgt een eigen lftp-sessie, zodat het script bij een mislukte # Elke opdracht krijgt een eigen lftp-sessie, zodat het script bij een mislukte
# ronde stopt (set -e) voordat de volgende ronde begint: de HTML gaat nooit # ronde stopt (set -e) voordat de volgende ronde begint: de HTML gaat nooit
@@ -60,22 +69,25 @@ run_lftp() {
else else
: "${FTP_HOST:?FTP_HOST ontbreekt}" "${FTP_USER:?FTP_USER ontbreekt}" : "${FTP_HOST:?FTP_HOST ontbreekt}" "${FTP_USER:?FTP_USER ontbreekt}"
: "${LFTP_PASSWORD:?LFTP_PASSWORD ontbreekt}" : "${LFTP_PASSWORD:?LFTP_PASSWORD ontbreekt}"
lftp --env-password -u "$FTP_USER" "$FTP_HOST" -e "$commands" local port=()
if [ -n "${FTP_PORT:-}" ]; then
[[ "$FTP_PORT" =~ ^[0-9]+$ ]] || { echo "Ongeldige FTP_PORT" >&2; exit 2; }
port=(-p "$FTP_PORT")
fi
lftp --env-password -u "$FTP_USER" "${port[@]}" "ftp://$FTP_HOST" -e "$commands"
fi fi
} }
# Ronde 1: alles behalve HTML en web.config, dus ook /assets. Nieuwe # Ronde 1: alles behalve HTML, dus ook /assets. Nieuwe bestanden met hash in
# bestanden met hash in de naam storen de oude release niet. # de naam storen de oude release niet.
if wants 1; then if wants 1; then
echo "== Ronde 1: alles behalve HTML en web.config" echo "== Ronde 1: alles behalve HTML"
run_lftp "mirror --reverse --verbose --exclude-glob '*.html' --exclude-glob web.config $dist/ $remote/;" run_lftp "mirror --reverse --verbose --exclude-glob '*.html' $dist/ $remote/;"
fi fi
# Ronde 2: web.config vlak voor de HTML (de regels passen bij de nieuwe # Ronde 2: alle HTML, ook de geneste pagina's en 404.html. Pas nu verwijst
# bestanden), dan alle HTML, ook de geneste pagina's en 404.html. Pas nu # iets naar de nieuwe assets.
# verwijst iets naar de nieuwe assets.
if wants 2; then if wants 2; then
echo "== Ronde 2: web.config en alle HTML" echo "== Ronde 2: alle HTML"
run_lftp "put -O $remote $dist/web.config;"
run_lftp "mirror --reverse --verbose --include-glob '*.html' $dist/ $remote/;" run_lftp "mirror --reverse --verbose --include-glob '*.html' $dist/ $remote/;"
fi fi
# Ronde 3: opruimen als laatste, zodat bezoekers met de oude HTML hun oude # Ronde 3: opruimen als laatste, zodat bezoekers met de oude HTML hun oude
+25 -4
View File
@@ -11,7 +11,8 @@
# headers staan met de exacte waarde op elk antwoord (pagina, asset, # headers staan met de exacte waarde op elk antwoord (pagina, asset,
# 301, 404, robots.txt), cachebeleid, alleen gzip (nooit br), een # 301, 404, robots.txt), cachebeleid, alleen gzip (nooit br), een
# procentgecodeerd pad blijft gecodeerd, en /admin, /health en # procentgecodeerd pad blijft gecodeerd, en /admin, /health en
# /api/v1/System/capabilities (zonder Offerings) antwoorden. # /api/v1/System/capabilities (met Offerings en Hero) antwoorden, en de
# redirects van de oude WordPress-adressen werken.
set -euo pipefail set -euo pipefail
if [ "$#" -lt 2 ] || [ "$#" -gt 4 ]; then if [ "$#" -lt 2 ] || [ "$#" -gt 4 ]; then
@@ -272,7 +273,7 @@ if [ "$cms_mode" -eq 1 ]; then
fail "POST /: status $status, verwacht 405" fail "POST /: status $status, verwacht 405"
fi fi
# De CMS-routes: health, admin, API (zonder Offerings), onbekend API-pad # De CMS-routes: health, admin, API (met Offerings en Hero), onbekend API-pad
fetch /health fetch /health
if [ "$status" != "200" ]; then fail "/health: status $status, verwacht 200"; fi if [ "$status" != "200" ]; then fail "/health: status $status, verwacht 200"; fi
@@ -301,8 +302,13 @@ if [ "$cms_mode" -eq 1 ]; then
fetch /api/v1/System/capabilities fetch /api/v1/System/capabilities
if [ "$status" != "200" ]; then if [ "$status" != "200" ]; then
fail "/api/v1/System/capabilities: status $status, verwacht 200" fail "/api/v1/System/capabilities: status $status, verwacht 200"
elif grep -qi 'offerings' "$work/body"; then else
fail "/api/v1/System/capabilities noemt Offerings; die module hoort voor ASF uit te staan" # De site haalt pakketten, banners en de hero uit deze modules
for module in Offerings Hero; do
if ! grep -qi "\"$module\"" "$work/body"; then
fail "/api/v1/System/capabilities noemt $module niet; de site heeft die module nodig"
fi
done
fi fi
# Een onbekend API-pad is een API-404, nooit de website # Een onbekend API-pad is een API-404, nooit de website
@@ -312,6 +318,21 @@ if [ "$cms_mode" -eq 1 ]; then
elif grep -qi '<html' "$work/body"; then elif grep -qi '<html' "$work/body"; then
fail "/api/v1/onbekend-pad-voor-controle: antwoordt met HTML (SPA-fallback?)" fail "/api/v1/onbekend-pad-voor-controle: antwoordt met HTML (SPA-fallback?)"
fi fi
# De redirects van de oude WordPress-adressen (redirects.json in de build,
# door de host gelezen): een 301, een 410 met onze 404-pagina, en het
# bestand zelf is niet op te vragen
expect_redirect /portfolio-item/decoration/ /portfolio
fetch /feed
if [ "$status" != "410" ]; then
fail "/feed: status $status, verwacht 410"
elif ! grep -qi '<html' "$work/body"; then
fail "/feed: het 410-antwoord heeft de 404-pagina niet als body"
fi
fetch /redirects.json
if [ "$status" != "404" ]; then
fail "/redirects.json: status $status, verwacht 404"
fi
fi fi
if [ "$failures" -gt 0 ]; then if [ "$failures" -gt 0 ]; then
+64 -14
View File
@@ -139,6 +139,7 @@ const validFiles = [
'over-mij.html', 'over-mij.html',
'soorten-fotoshoots/newborn.html', 'soorten-fotoshoots/newborn.html',
'assets/a.js', 'assets/a.js',
'redirects.json',
'robots.txt', 'robots.txt',
]; ];
async function makeDist(): Promise<string> { async function makeDist(): Promise<string> {
@@ -157,7 +158,7 @@ describe.skipIf(toolsMissing)('check-artifact.sh', () => {
expect(run.stdout).toContain('over-mij.html'); expect(run.stdout).toContain('over-mij.html');
}); });
it.each(['index.html', '404.html', 'over-mij.html'])( it.each(['index.html', '404.html', 'over-mij.html', 'redirects.json'])(
'weigert een build zonder %s', 'weigert een build zonder %s',
async (file) => { async (file) => {
const dist = await makeDist(); const dist = await makeDist();
@@ -525,6 +526,7 @@ describe.skipIf(toolsMissing || lftpMissing)('upload-production.sh', () => {
expect(first.code).toBe(0); expect(first.code).toBe(0);
expect(await tree(target)).toEqual([ expect(await tree(target)).toEqual([
'assets/a.js', 'assets/a.js',
'redirects.json',
'robots.txt', 'robots.txt',
'stale.txt', 'stale.txt',
]); ]);
@@ -536,10 +538,10 @@ describe.skipIf(toolsMissing || lftpMissing)('upload-production.sh', () => {
'assets/a.js', 'assets/a.js',
'index.html', 'index.html',
'over-mij.html', 'over-mij.html',
'redirects.json',
'robots.txt', 'robots.txt',
'soorten-fotoshoots/newborn.html', 'soorten-fotoshoots/newborn.html',
'stale.txt', 'stale.txt',
'web.config',
]); ]);
const third = await upload(dist, target, '3'); const third = await upload(dist, target, '3');
@@ -549,9 +551,9 @@ describe.skipIf(toolsMissing || lftpMissing)('upload-production.sh', () => {
'assets/a.js', 'assets/a.js',
'index.html', 'index.html',
'over-mij.html', 'over-mij.html',
'redirects.json',
'robots.txt', 'robots.txt',
'soorten-fotoshoots/newborn.html', 'soorten-fotoshoots/newborn.html',
'web.config',
]); ]);
}); });
@@ -567,19 +569,18 @@ describe.skipIf(toolsMissing || lftpMissing)('upload-production.sh', () => {
); );
expect(rounds).toEqual(['1', '2', '3']); expect(rounds).toEqual(['1', '2', '3']);
const expected = [...validFiles, 'web.config'].sort(); const expected = [...validFiles].sort();
expect(await tree(target)).toEqual(expected); expect(await tree(target)).toEqual(expected);
}); });
it('laat bij een tweede deploy geen back-upbestanden met ~ achter', async () => { it('laat bij een tweede deploy geen back-upbestanden met ~ achter', async () => {
const { dist, target } = await setup(); const { dist, target } = await setup();
expect((await upload(dist, target)).code).toBe(0); expect((await upload(dist, target)).code).toBe(0);
// Nu bestaat web.config al op de host, en alles wordt overschreven // Nu bestaat alles al op de host en wordt het overschreven
await write(dist, 'robots.txt', 'nieuwe inhoud'); await write(dist, 'robots.txt', 'nieuwe inhoud');
expect((await upload(dist, target)).code).toBe(0); expect((await upload(dist, target)).code).toBe(0);
const files = await tree(target); const files = await tree(target);
expect(files.filter((file) => file.includes('~'))).toEqual([]); expect(files.filter((file) => file.includes('~'))).toEqual([]);
expect(files).toContain('web.config');
}); });
it('weigert een ongeldige build en uploadt dan niets', async () => { it('weigert een ongeldige build en uploadt dan niets', async () => {
@@ -590,13 +591,12 @@ describe.skipIf(toolsMissing || lftpMissing)('upload-production.sh', () => {
expect(await tree(target)).toEqual(['stale.txt']); expect(await tree(target)).toEqual(['stale.txt']);
}); });
it('neemt de web.config uit deploy/iis over', async () => { it('zet geen web.config op de server: die hoort bij de CMS-host', async () => {
const { dist, target } = await setup(); const { dist, target } = await setup();
const run = await upload(dist, target); const run = await upload(dist, target);
expect(run.code).toBe(0); expect(run.code).toBe(0);
expect(await readFile(join(target, 'web.config'), 'utf8')).toBe( expect(existsSync(join(target, 'web.config'))).toBe(false);
await readFile(join(deployDir, 'iis/web.config'), 'utf8'), expect(existsSync(join(dist, 'web.config'))).toBe(false);
);
}); });
}); });
@@ -666,7 +666,7 @@ touch '${slash(marker)}'
}, },
); );
it('zet in elke lftp-sessie de back-ups uit en de TLS-eisen aan', async () => { it('zet in elke lftp-sessie de back-ups uit en TLS aan zonder terugval (FTPS)', async () => {
const dist = await makeDist(); const dist = await makeDist();
const bin = await makeTemp('andreaslop-fakebin-'); const bin = await makeTemp('andreaslop-fakebin-');
const log = join(bin, 'opdrachten'); const log = join(bin, 'opdrachten');
@@ -690,11 +690,61 @@ printf '%s\\n' "$2" >> '${slash(log)}'
const sessions = (await readFile(log, 'utf8')) const sessions = (await readFile(log, 'utf8'))
.split('\n') .split('\n')
.filter(Boolean); .filter(Boolean);
// Ronde 1, web.config, ronde 2 (HTML) en ronde 3 // Ronde 1, ronde 2 (HTML) en ronde 3
expect(sessions).toHaveLength(4); expect(sessions).toHaveLength(3);
for (const commands of sessions) { for (const commands of sessions) {
expect(commands).toContain('set xfer:make-backup no;'); expect(commands).toContain('set xfer:make-backup no;');
expect(commands).toContain('set ftp:ssl-force true;'); expect(commands).toContain('set ftp:ssl-allow yes;');
expect(commands).toContain('set ftp:ssl-auth TLS;');
expect(commands).toContain('set ftp:ssl-force yes;');
expect(commands).toContain('set ftp:ssl-protect-data yes;');
expect(commands).toContain('set ftp:ssl-protect-list yes;');
expect(commands).toContain('set ssl:verify-certificate yes;');
expect(commands).toContain('set ftp:passive-mode on;');
expect(commands).not.toContain('ssl-allow no');
expect(commands).not.toContain('verify-certificate no');
}
});
it('geeft FTP_PORT door aan lftp en weigert een ongeldige poort', async () => {
const dist = await makeDist();
const bin = await makeTemp('andreaslop-fakebin-');
const log = join(bin, 'argumenten');
await writeFile(
join(bin, 'lftp'),
`#!/bin/sh
printf '%s\n' "$*" >> '${slash(log)}'
`,
{ mode: 0o755 },
);
const env = {
PATH: `${bin}${delimiter}${process.env.PATH ?? ''}`,
FTP_HOST: 'ftp.example.test',
FTP_USER: 'gebruiker',
LFTP_PASSWORD: 'geheim',
};
const bad = await runScript(
'upload-production.sh',
[basename(dist), 'wwwroot'],
{ ...env, FTP_PORT: '21; rm -rf' },
dirname(dist),
);
expect(bad.code).toBe(2);
expect(existsSync(log)).toBe(false);
const good = await runScript(
'upload-production.sh',
[basename(dist), 'wwwroot'],
{ ...env, FTP_PORT: '2121' },
dirname(dist),
);
expect(good.code).toBe(0);
for (const line of (await readFile(log, 'utf8'))
.split('\n')
.filter(Boolean)) {
expect(line).toContain(
'-u gebruiker -p 2121 ftp://ftp.example.test',
);
} }
}); });
+1 -1
View File
@@ -6,7 +6,7 @@
"packageManager": "pnpm@12.11.2", "packageManager": "pnpm@12.11.2",
"scripts": { "scripts": {
"dev": "vite", "dev": "vite",
"build": "node config/fetchOfferings.ts && tsc && vite build && node config/externalizeInlineScripts.ts", "build": "node config/fetchOfferings.ts && tsc && vite build && node config/externalizeInlineScripts.ts && node config/writeRedirects.ts",
"preview": "node config/previewServer.ts", "preview": "node config/previewServer.ts",
"e2e": "vitest run --config vitest.e2e.config.ts", "e2e": "vitest run --config vitest.e2e.config.ts",
"postinstall": "chakra typegen ./src/theme.ts", "postinstall": "chakra typegen ./src/theme.ts",
@@ -1,5 +1,5 @@
import { render } from '@testing-library/react'; import { render } from '@testing-library/react';
import { afterEach, describe, expect, it } from 'vitest'; import { afterEach, describe, expect, it, vi } from 'vitest';
import UmamiAnalytics from './UmamiAnalytics'; import UmamiAnalytics from './UmamiAnalytics';
const umamiScripts = () => const umamiScripts = () =>
@@ -8,6 +8,7 @@ const umamiScripts = () =>
); );
afterEach(() => { afterEach(() => {
vi.unstubAllEnvs();
umamiScripts().forEach((script) => script.remove()); umamiScripts().forEach((script) => script.remove());
}); });
@@ -18,9 +19,13 @@ describe('UmamiAnalytics', () => {
}); });
it.each([ it.each([
['andreaslop.nl', '3edbb7d1-4388-4f2d-9cef-11ade88ace96'], ['production', 'andreaslop.nl', '3edbb7d1-4388-4f2d-9cef-11ade88ace96'],
['test.andreaslop.nl', '7fb301ab-6ecc-4aea-beee-71bcb6009bfe'], ['test', 'test.andreaslop.nl', 'test-website'],
])('telt op %s met de juiste website', (hostname, websiteId) => { ])(
'telt in de %s-build op %s met de juiste website',
(environment, hostname, websiteId) => {
vi.stubEnv('VITE_APP_ENV', environment);
vi.stubEnv('VITE_UMAMI_WEBSITE_ID', websiteId);
render(<UmamiAnalytics hostname={hostname} />); render(<UmamiAnalytics hostname={hostname} />);
const [script] = umamiScripts(); const [script] = umamiScripts();
@@ -30,6 +35,12 @@ describe('UmamiAnalytics', () => {
domains: hostname, domains: hostname,
doNotTrack: 'true', doNotTrack: 'true',
}); });
},
);
it('voegt geen script toe op de host van de andere omgeving', () => {
render(<UmamiAnalytics hostname="test.andreaslop.nl" />);
expect(umamiScripts()).toHaveLength(0);
}); });
it('voegt het script maar één keer toe', () => { it('voegt het script maar één keer toe', () => {
@@ -1,5 +1,5 @@
import { useEffect } from 'react'; import { useEffect } from 'react';
import { monitoringFor, umamiOrigin } from '@/monitoring/config'; import { monitoringFor } from '@/monitoring/config';
const SCRIPT_ELEMENT_ID = 'umami-analytics-script'; const SCRIPT_ELEMENT_ID = 'umami-analytics-script';
@@ -16,7 +16,7 @@ export default function UmamiAnalytics({ hostname }: { hostname?: string }) {
const script = document.createElement('script'); const script = document.createElement('script');
script.id = SCRIPT_ELEMENT_ID; script.id = SCRIPT_ELEMENT_ID;
script.src = `${umamiOrigin}/script.js`; script.src = monitoring.umamiScriptUrl;
script.defer = true; script.defer = true;
script.dataset.websiteId = monitoring.umamiWebsiteId; script.dataset.websiteId = monitoring.umamiWebsiteId;
script.dataset.domains = host; script.dataset.domains = host;
+18
View File
@@ -135,6 +135,24 @@ describe('Hero', () => {
}); });
}); });
it('laat de eerste foto inzoomen zolang hij de actieve is', async () => {
const { container } = await renderWithProviders(
<Hero content={heroContent} socials={siteContent.socials} />,
);
const picture = container.querySelector('.cms-hero-picture')!;
expect(picture).toHaveAttribute('data-zoom');
expect(picture).not.toHaveAttribute('aria-hidden');
await userEvent.click(
screen.getByRole('button', { name: 'Volgende foto' }),
);
expect(picture).not.toHaveAttribute('data-zoom');
expect(picture).toHaveAttribute('aria-hidden', 'true');
await userEvent.click(
screen.getByRole('button', { name: 'Vorige foto' }),
);
expect(picture).toHaveAttribute('data-zoom');
});
it('heeft pijlen met een toegankelijke naam', async () => { it('heeft pijlen met een toegankelijke naam', async () => {
await renderWithProviders( await renderWithProviders(
<Hero content={heroContent} socials={siteContent.socials} />, <Hero content={heroContent} socials={siteContent.socials} />,
+9 -3
View File
@@ -164,11 +164,17 @@ function HeroFrame({ content, socials, regionHtml, hydrated }: FrameProps) {
}, [firstPainted]); }, [firstPainted]);
// The first photo is hidden from screen readers while another one is on // The first photo is hidden from screen readers while another one is on
// top of it // top of it, and it zooms (data-zoom, see .cms-hero-image) while it is the
// active one
useEffect(() => { useEffect(() => {
const picture = section.current?.querySelector('.cms-hero-picture'); const picture = section.current?.querySelector('.cms-hero-picture');
if (active === 0) picture?.removeAttribute('aria-hidden'); if (active === 0) {
else picture?.setAttribute('aria-hidden', 'true'); picture?.removeAttribute('aria-hidden');
picture?.setAttribute('data-zoom', '');
} else {
picture?.setAttribute('aria-hidden', 'true');
picture?.removeAttribute('data-zoom');
}
}, [active]); }, [active]);
const loaded = firstPainted ? slidesToLoad(active, shown.length) : [active]; const loaded = firstPainted ? slidesToLoad(active, shown.length) : [active];
@@ -45,7 +45,7 @@ describe('useHeroSlider', () => {
expect(result.current.active).toBe(0); expect(result.current.active).toBe(0);
}); });
it('afspelen via de knop heft ook de pauze door hover op', () => { it('pauzeert niet bij hover met de muis, wel via de knop', () => {
let slider!: ReturnType<typeof useHeroSlider>; let slider!: ReturnType<typeof useHeroSlider>;
function Probe() { function Probe() {
slider = useHeroSlider(8); slider = useHeroSlider(8);
@@ -53,11 +53,11 @@ describe('useHeroSlider', () => {
} }
const { getByTestId } = render(<Probe />); const { getByTestId } = render(<Probe />);
fireEvent.pointerEnter(getByTestId('hero'), { pointerType: 'mouse' }); fireEvent.pointerEnter(getByTestId('hero'), { pointerType: 'mouse' });
expect(slider.paused).toBe(true); fireEvent.mouseEnter(getByTestId('hero'));
expect(slider.paused).toBe(false);
act(() => slider.toggleStopped()); act(() => slider.toggleStopped());
act(() => slider.toggleStopped()); expect(slider.paused).toBe(true);
expect(slider.paused).toBe(false);
}); });
it('afspelen via de knop heft ook de pauze door toetsenbordfocus op', () => { it('afspelen via de knop heft ook de pauze door toetsenbordfocus op', () => {
+9 -15
View File
@@ -22,7 +22,6 @@ export default function useHeroSlider(count: number) {
const [announcement, setAnnouncement] = useState<HeroAnnouncement>(null); const [announcement, setAnnouncement] = useState<HeroAnnouncement>(null);
// Pauzeknop: blijft gelden tot de bezoeker opnieuw klikt (WCAG 2.2.2) // Pauzeknop: blijft gelden tot de bezoeker opnieuw klikt (WCAG 2.2.2)
const [stopped, setStopped] = useState(false); const [stopped, setStopped] = useState(false);
const [hovered, setHovered] = useState(false);
const [focused, setFocused] = useState(false); const [focused, setFocused] = useState(false);
// Server and hydrating render say "visible", like the HTML // Server and hydrating render say "visible", like the HTML
const hidden = useSyncExternalStore( const hidden = useSyncExternalStore(
@@ -49,16 +48,13 @@ export default function useHeroSlider(count: number) {
announcement, announcement,
reducedMotion, reducedMotion,
autoplay: count > 1 && !reducedMotion, autoplay: count > 1 && !reducedMotion,
paused: stopped || hovered || focused || hidden, paused: stopped || focused || hidden,
stopped, stopped,
// Afspelen via de knop geldt ook terwijl de muis of de // Afspelen via de knop geldt ook terwijl de toetsenbordfocus nog in de
// toetsenbordfocus nog in de hero staat (de klik zelf is een hover en // hero staat (de klik zelf is vaak een focus); zonder dit gebeurt er na
// vaak een focus); zonder dit gebeurt er na "afspelen" niets zichtbaars. // "afspelen" niets zichtbaars.
toggleStopped: () => { toggleStopped: () => {
if (stopped) { if (stopped) setFocused(false);
setHovered(false);
setFocused(false);
}
setStopped(!stopped); setStopped(!stopped);
setAnnouncement(stopped ? 'playing' : 'paused'); setAnnouncement(stopped ? 'playing' : 'paused');
}, },
@@ -66,12 +62,10 @@ export default function useHeroSlider(count: number) {
prev, prev,
advance: () => go(active + 1, false), advance: () => go(active + 1, false),
handlers: { handlers: {
// Alleen een echte muis pauzeert; een tik op mobiel niet. // Hover pauzeert bewust niet (Bryan, 2026-11-17): een beeldvullende hero
onPointerEnter: (event: React.PointerEvent<HTMLElement>) => { // heeft bijna altijd de muis erboven. Toetsenbordfocus op de besturing
if (event.pointerType === 'mouse') setHovered(true); // pauzeert wel, want dat is een bewuste handeling; een klik op een
}, // pijl niet.
onPointerLeave: () => setHovered(false),
// Alleen toetsenbordfocus pauzeert, niet een klik op een pijl.
onFocus: (event: React.FocusEvent<HTMLElement>) => { onFocus: (event: React.FocusEvent<HTMLElement>) => {
if (event.target.matches(':focus-visible')) setFocused(true); if (event.target.matches(':focus-visible')) setFocused(true);
}, },
+81 -13
View File
@@ -1,11 +1,22 @@
import fc from 'fast-check'; import fc from 'fast-check';
import { describe, expect, it } from 'vitest'; import { afterEach, describe, expect, it, vi } from 'vitest';
import { import {
monitoredHostnames, monitoredHostnames,
monitoringConfig,
monitoringFor, monitoringFor,
sentryIngestOrigin, monitoringOrigins,
} from './config'; } from './config';
const dsn = 'https://key@o1.ingest.de.sentry.io/2';
const script = 'https://analytics.example.nl/script.js';
const raw = (extra: Record<string, unknown> = {}) => ({
environment: 'production',
sentryDsn: dsn,
umamiScriptUrl: script,
umamiWebsiteId: 'site-1',
...extra,
});
// Alles wat geen test- of productiehost is // Alles wat geen test- of productiehost is
const otherHostname = fc const otherHostname = fc
.oneof( .oneof(
@@ -25,32 +36,89 @@ const otherHostname = fc
) )
.filter((host) => !monitoredHostnames.includes(host)); .filter((host) => !monitoredHostnames.includes(host));
describe('monitoringFor', () => { afterEach(() => vi.unstubAllEnvs());
it('productiehost meet als production met de productiewebsite', () => {
expect(monitoringFor('andreaslop.nl')).toEqual({ describe('monitoringConfig', () => {
it('leest de waarden uit de omgeving van de build', () => {
// De testomgeving (vite.config.ts) is de productiebuild
expect(monitoringConfig()).toMatchObject({
environment: 'production', environment: 'production',
umamiWebsiteId: '3edbb7d1-4388-4f2d-9cef-11ade88ace96', umamiWebsiteId: '3edbb7d1-4388-4f2d-9cef-11ade88ace96',
}); });
vi.stubEnv('VITE_APP_ENV', 'test');
vi.stubEnv('VITE_UMAMI_WEBSITE_ID', ' abc ');
expect(monitoringConfig()).toMatchObject({
environment: 'test',
umamiWebsiteId: 'abc',
});
}); });
it('testhost meet als test met de testwebsite', () => { it('geeft null als er iets ontbreekt of ongeldig is', () => {
expect(monitoringFor('test.andreaslop.nl')).toEqual({ expect(monitoringConfig(raw())).not.toBeNull();
environment: 'test', for (const bad of [
umamiWebsiteId: '7fb301ab-6ecc-4aea-beee-71bcb6009bfe', { environment: 'staging' },
{ environment: undefined },
{ sentryDsn: undefined },
{ sentryDsn: 'http://key@host/1' },
{ sentryDsn: 'geen url' },
{ umamiScriptUrl: '' },
{ umamiScriptUrl: 'http://analytics.example.nl/script.js' },
{ umamiWebsiteId: ' ' },
{ umamiWebsiteId: 5 },
]) {
expect(monitoringConfig(raw(bad))).toBeNull();
}
}); });
}); });
describe('monitoringFor', () => {
it('productiebuild meet alleen op de productiehost', () => {
const config = monitoringConfig(raw());
expect(monitoringFor('andreaslop.nl', config)).toEqual({
environment: 'production',
sentryDsn: dsn,
umamiScriptUrl: script,
umamiWebsiteId: 'site-1',
});
expect(monitoringFor('test.andreaslop.nl', config)).toBeNull();
});
it('testbuild meet alleen op de testhost', () => {
const config = monitoringConfig(raw({ environment: 'test' }));
expect(monitoringFor('test.andreaslop.nl', config)?.environment).toBe(
'test',
);
expect(monitoringFor('andreaslop.nl', config)).toBeNull();
});
it('meet niets zonder instellingen', () => {
expect(monitoringFor('andreaslop.nl', null)).toBeNull();
});
it('elke andere host meet niets (M1)', () => { it('elke andere host meet niets (M1)', () => {
fc.assert( fc.assert(
fc.property(otherHostname, (host) => { fc.property(otherHostname, (host) => {
expect(monitoringFor(host)).toBeNull(); expect(monitoringFor(host)).toBeNull();
expect(
monitoringFor(
host,
monitoringConfig(raw({ environment: 'test' })),
),
).toBeNull();
}), }),
); );
}); });
}); });
it('Sentry-ingest is de EU-host uit de DSN, zonder sleutel', () => { describe('monitoringOrigins', () => {
expect(sentryIngestOrigin).toBe( it('zijn de herkomst van het Umami-script en van de Sentry-ingest, zonder sleutel', () => {
'https://o4511795618185216.ingest.de.sentry.io', expect(monitoringOrigins(monitoringConfig(raw()))).toEqual({
); umami: ['https://analytics.example.nl'],
sentry: ['https://o1.ingest.de.sentry.io'],
});
});
it('zijn leeg zonder instellingen', () => {
expect(monitoringOrigins(null)).toEqual({ umami: [], sentry: [] });
});
}); });
+83 -30
View File
@@ -1,43 +1,96 @@
// Instellingen voor Sentry en Umami (monitoring-plan M1/M2). Deze waarden zijn // Instellingen voor Sentry en Umami (monitoring-plan M1/M2). De waarden zijn
// openbaar: ze staan hoe dan ook in de browser van elke bezoeker. // openbaar (ze staan in de browser van elke bezoeker) maar komen niet meer uit
// de code: de pipeline geeft ze per omgeving mee aan de build, uit de Gitea-
// variabelen {TEST|PROD}_SENTRY_DSN, _UMAMI_SCRIPT_URL en _UMAMI_WEBSITE_ID,
// als VITE_SENTRY_DSN, VITE_UMAMI_SCRIPT_URL, VITE_UMAMI_WEBSITE_ID en
// VITE_APP_ENV ('test' of 'production'). Eén build hoort dus bij één omgeving.
// Geen imports uit Vite: config/securityHeaders.ts leest dit bestand ook in Node. // Geen imports uit Vite: config/securityHeaders.ts leest dit bestand ook in Node.
export type MonitoringEnvironment = 'test' | 'production'; export type MonitoringEnvironment = 'test' | 'production';
export interface Monitoring { export interface MonitoringConfig {
environment: MonitoringEnvironment; environment: MonitoringEnvironment;
sentryDsn: string;
umamiScriptUrl: string;
umamiWebsiteId: string; umamiWebsiteId: string;
} }
export const sentryDsn = export type Monitoring = MonitoringConfig;
'https://12ec77dcc3216a98b96d3fb3dac13f66@o4511795618185216.ingest.de.sentry.io/4512282287472720';
// Waar de browser fouten naartoe stuurt; nodig voor connect-src in de CSP // De host waarop de build van een omgeving meet
export const sentryIngestOrigin = new URL(sentryDsn).origin; const hostnameByEnvironment: Record<MonitoringEnvironment, string> = {
production: 'andreaslop.nl',
test: 'test.andreaslop.nl',
};
export const umamiOrigin = 'https://analytics.slpsoftware.nl'; // In de Vite-build staan de waarden in import.meta.env (statisch vervangen,
// daarom elke naam los); de buildscripts onder Node lezen process.env.
const fromProcess = (name: string): unknown =>
typeof process === 'undefined' ? undefined : process.env[name];
// Eén build voor beide omgevingen: de hostname bepaalt de omgeving function rawSettings(): Record<keyof MonitoringConfig, unknown> {
const monitoringByHostname = new Map<string, Monitoring>([ const env = import.meta.env;
[ return {
'andreaslop.nl', environment: env?.VITE_APP_ENV ?? fromProcess('VITE_APP_ENV'),
{ sentryDsn: env?.VITE_SENTRY_DSN ?? fromProcess('VITE_SENTRY_DSN'),
environment: 'production', umamiScriptUrl:
umamiWebsiteId: '3edbb7d1-4388-4f2d-9cef-11ade88ace96', env?.VITE_UMAMI_SCRIPT_URL ?? fromProcess('VITE_UMAMI_SCRIPT_URL'),
}, umamiWebsiteId:
], env?.VITE_UMAMI_WEBSITE_ID ?? fromProcess('VITE_UMAMI_WEBSITE_ID'),
[ };
'test.andreaslop.nl',
{
environment: 'test',
umamiWebsiteId: '7fb301ab-6ecc-4aea-beee-71bcb6009bfe',
},
],
]);
// Onbekende host (localhost, Lighthouse CI, previews): niets meten (M1)
export function monitoringFor(hostname: string): Monitoring | null {
return monitoringByHostname.get(hostname) ?? null;
} }
export const monitoredHostnames = [...monitoringByHostname.keys()]; const isHttps = (value: string): boolean => {
try {
return new URL(value).protocol === 'https:';
} catch {
return false;
}
};
// De instellingen van deze build, of null als er iets ontbreekt of ongeldig is
// (dan meet de site niets: liever geen meting dan een kapotte)
export function monitoringConfig(
raw: Record<keyof MonitoringConfig, unknown> = rawSettings(),
): MonitoringConfig | null {
const { environment, sentryDsn, umamiScriptUrl, umamiWebsiteId } = raw;
if (environment !== 'test' && environment !== 'production') return null;
const text = (value: unknown) =>
typeof value === 'string' ? value.trim() : '';
const dsn = text(sentryDsn);
const script = text(umamiScriptUrl);
const website = text(umamiWebsiteId);
if (!isHttps(dsn) || !isHttps(script) || website === '') return null;
return {
environment,
sentryDsn: dsn,
umamiScriptUrl: script,
umamiWebsiteId: website,
};
}
// Onbekende host (localhost, Lighthouse CI, previews, de andere omgeving):
// niets meten (M1)
export function monitoringFor(
hostname: string,
config: MonitoringConfig | null = monitoringConfig(),
): Monitoring | null {
if (!config || hostname !== hostnameByEnvironment[config.environment]) {
return null;
}
return { ...config };
}
// De herkomsten voor de CSP: Umami voor script-src en connect-src, de Sentry-
// ingest voor connect-src. Leeg zonder meting.
export function monitoringOrigins(
config: MonitoringConfig | null = monitoringConfig(),
): { umami: string[]; sentry: string[] } {
if (!config) return { umami: [], sentry: [] };
return {
umami: [new URL(config.umamiScriptUrl).origin],
sentry: [new URL(config.sentryDsn).origin],
};
}
export const monitoredHostnames = Object.values(hostnameByEnvironment);
+2
View File
@@ -11,6 +11,7 @@ async function freshSentry() {
} }
beforeEach(() => { beforeEach(() => {
vi.unstubAllEnvs();
init.mockReset(); init.mockReset();
captureException.mockReset(); captureException.mockReset();
}); });
@@ -27,6 +28,7 @@ describe('Sentry', () => {
}); });
it('start op test met omgeving test en zonder persoonsgegevens', async () => { it('start op test met omgeving test en zonder persoonsgegevens', async () => {
vi.stubEnv('VITE_APP_ENV', 'test');
const { startSentry } = await freshSentry(); const { startSentry } = await freshSentry();
startSentry('test.andreaslop.nl'); startSentry('test.andreaslop.nl');
+2 -2
View File
@@ -1,4 +1,4 @@
import { monitoringFor, sentryDsn } from './config'; import { monitoringFor } from './config';
// Sentry laadt pas na het load-event, buiten de hoofdbundel (M4). Fouten van // Sentry laadt pas na het load-event, buiten de hoofdbundel (M4). Fouten van
// daarvoor wachten in een wachtrij en gaan mee zodra Sentry klaar is. // daarvoor wachten in een wachtrij en gaan mee zodra Sentry klaar is.
@@ -33,7 +33,7 @@ export function startSentry(hostname = window.location.hostname): void {
// Alleen fouten: geen tracing, geen replay, geen persoonsgegevens (M5). // Alleen fouten: geen tracing, geen replay, geen persoonsgegevens (M5).
// Sinds SDK 11 verzamelt Sentry standaard alles; daarom alles expliciet uit. // Sinds SDK 11 verzamelt Sentry standaard alles; daarom alles expliciet uit.
Sentry.init({ Sentry.init({
dsn: sentryDsn, dsn: monitoring.sentryDsn,
environment: monitoring.environment, environment: monitoring.environment,
release: import.meta.env.VITE_RELEASE, release: import.meta.env.VITE_RELEASE,
dataCollection: { dataCollection: {
+14
View File
@@ -55,6 +55,20 @@ const config = defineConfig({
width: '100%', width: '100%',
height: '100%', height: '100%',
objectFit: 'cover', objectFit: 'cover',
// Same slow zoom as the other photos of the slider: the plain HTML
// is painted at 1.06 and the slider (after hydration) sets
// data-zoom on the picture, which zooms out to 1 over 9 s. The
// photo itself is never replaced, so the LCP does not wait for
// hydration; the first frame is the same before and after it.
transform: 'scale(1.06)',
transition: 'transform 9s linear',
'@media (prefers-reduced-motion: reduce)': {
transform: 'none',
transition: 'none',
},
},
'.cms-hero-picture[data-zoom] .cms-hero-image': {
transform: 'scale(1)',
}, },
'.cms-hero-title': { '.cms-hero-title': {
position: 'relative', position: 'relative',
+2
View File
@@ -1,3 +1,4 @@
import { monitoringTestEnv } from './config/monitoringTestEnv.ts';
import { configDefaults, defineConfig } from 'vitest/config'; import { configDefaults, defineConfig } from 'vitest/config';
import react from '@vitejs/plugin-react'; import react from '@vitejs/plugin-react';
import { tanstackStart } from '@tanstack/react-start/plugin/vite'; import { tanstackStart } from '@tanstack/react-start/plugin/vite';
@@ -80,6 +81,7 @@ export default defineConfig(({ mode }) => ({
preview: { headers: securityHeaders('production') }, preview: { headers: securityHeaders('production') },
test: { test: {
environment: 'jsdom', environment: 'jsdom',
env: monitoringTestEnv,
// De CI-runner (Raspberry Pi, arm64) is ±5-8x trager dan een pc; de // De CI-runner (Raspberry Pi, arm64) is ±5-8x trager dan een pc; de
// eerste render met axe duurt daar tot 7 s. 5 s (standaard) is te krap. // eerste render met axe duurt daar tot 7 s. 5 s (standaard) is te krap.
testTimeout: 20_000, testTimeout: 20_000,
+2
View File
@@ -1,4 +1,5 @@
import { defineConfig } from 'vitest/config'; import { defineConfig } from 'vitest/config';
import { monitoringTestEnv } from './config/monitoringTestEnv.ts';
// Browsertests (BR-TST-05, BR-TST-06) tegen de gebouwde site in dist/client. // Browsertests (BR-TST-05, BR-TST-06) tegen de gebouwde site in dist/client.
// Los van vite.config.ts: de Start-plugin en de jsdom-opzet van de // Los van vite.config.ts: de Start-plugin en de jsdom-opzet van de
@@ -8,6 +9,7 @@ export default defineConfig({
resolve: { tsconfigPaths: true }, resolve: { tsconfigPaths: true },
test: { test: {
environment: 'node', environment: 'node',
env: monitoringTestEnv,
include: ['e2e/**/*.e2e.ts'], include: ['e2e/**/*.e2e.ts'],
// De CI-runner (Raspberry Pi) is veel trager dan een pc: Chrome starten // De CI-runner (Raspberry Pi) is veel trager dan een pc: Chrome starten
// en een pagina hydrateren kost daar vele seconden. Tests die alle 11 // en een pagina hydrateren kost daar vele seconden. Tests die alle 11