Hero-module: hero beheren vanuit het CMS #17
@@ -97,7 +97,7 @@ Variabelen:
|
||||
| `VITE_UMAMI_SCRIPT_URL`, `VITE_UMAMI_WEBSITE_ID_TEST`, `VITE_UMAMI_WEBSITE_ID_PRODUCTION` | Umami voor de SlpSoftware-adminbuild (ASF gebruikt geen Umami) |
|
||||
| `SECURITY_ALLOWED_SCRIPT_ORIGINS_TEST`, `SECURITY_ALLOWED_SCRIPT_ORIGINS_PRODUCTION` | Alleen gebruikt als controle in `publish-sls-test`/`publish-sls-production` wanneer `VITE_UMAMI_SCRIPT_URL` gevuld is: de Umami-origin moet in deze lijst staan, en de lijst moet overeenkomen met `SecurityHeaders__AllowedScriptOrigins__0` op de host |
|
||||
|
||||
Runtime-instellingen van de applicatie (verbindingsstring, JWT, mail, `Contact__*`, Sentry) zitten niet in de workflow maar in het omgevingsbestand op de host (`shared/env`, zie README en de hostdocumentatie).
|
||||
Runtime-instellingen van de applicatie (verbindingsstring, JWT, mail, `Contact__*`, `Media__Directory`, Sentry) zitten niet in de workflow maar in het omgevingsbestand op de host (`shared/env`, zie README en de hostdocumentatie). Voor de afbeeldingen van de Hero-module hoort daar `Media__Directory` bij, een map buiten de release (`shared/media`), die de deploy niet aanraakt; zie [hero-module.md](hero-module.md).
|
||||
|
||||
## Runners
|
||||
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
# Hero-module
|
||||
|
||||
Levend document (2026-11-16). De hero van een website (titel, tagline, lead, knoppen, afbeeldingen) staat in het CMS. Het CMS levert alleen **inhoud**; elke site houdt zijn eigen opmaak. Ontwerp en besluiten: `aidlc-docs/features/hero-module/`. Contract met de websites: `aidlc-docs/features/hero-module/inception/requirements/site-contract-agreed-with-asf.md`.
|
||||
|
||||
## Wat beheer je
|
||||
|
||||
Admin > **Hero** (Owner en Administrator, module `Hero`):
|
||||
|
||||
- Titel (een nieuwe regel is een regelafbreking, maximaal 5 regels), tagline, lead, weergave (`single` of `slideshow`).
|
||||
- Maximaal twee knoppen met tekst en doel. Een doel is een `#anker`, een `/pad` of een `https://`-adres; andere waarden worden geweigerd.
|
||||
- Planning (aan of uit, van en tot). Buiten de planning, of uitgezet, toont de website zijn eigen ingebakken hero.
|
||||
- Slides: een afbeelding met verplichte beschrijving (alt-tekst) of de markering decoratief, volgorde, aan of uit per slide. Er is geen grens op het aantal slides; technisch publiceert de host er hoogstens `Hero:MaxPublishedSlides` (50).
|
||||
- Focus: per afbeelding een algemeen punt en zoom, en optioneel een eigen punt voor de liggende (`wide`, 3:2) en de staande (`tall`, 4:5) weergave. De host snijdt de varianten daaromheen uit.
|
||||
|
||||
De admin toont alleen een badge Live of Niet live.
|
||||
|
||||
## Wat de website krijgt
|
||||
|
||||
- `GET /api/v1/hero`: anoniem, `Cache-Control: public, max-age=60`, `204` als er niets te tonen is (dan blijft de ingebakken hero staan). Dezelfde JSON staat onder `hero` in het datablok `#cms-data`.
|
||||
- Markers in de pagina: `<!--CMS:HERO-HTML-->…<!--/CMS:HERO-HTML-->` (titel, tagline, knoppen, eerste slide als `<picture>`) en `<!--CMS:HERO-PRELOAD-->…<!--/CMS:HERO-PRELOAD-->` in de head (een of twee preload-links). Alleen WebP komt in de eerste afbeelding en de preload. Zonder bruikbare hero, bij een fout of als de bestanden van de eerste slide ontbreken blijft de pagina zoals gebouwd.
|
||||
- Afbeeldingen: `/media/hero/<set>/<ratio>-<breedte>.<webp|avif>`, onder het eigen adres van de site (de CSP verandert niet), `immutable` gecachet; een andere focus geeft een nieuw adres.
|
||||
- De golden files van ASF (commit 13f78c4) leggen de HTML byte voor byte vast: `src/SlpModularCms.Modules.Hero.Tests/Golden`.
|
||||
|
||||
## Instellen op een host
|
||||
|
||||
| Instelling | Betekenis |
|
||||
|---|---|
|
||||
| `Media__Directory` | De map voor de afbeeldingen, **buiten de release** en buiten de webroot. Zonder deze instelling (of als de map niet beschrijfbaar is) staan uploads uit; bestaande bestanden en de publieke hero blijven werken. Niet in een committed appsettings-bestand. |
|
||||
| `Media__MaxUploadBytes` (10 MB), `Media__MaxPixels` (64 miljoen), `Media__MaxParallelJobs` (2), `Media__DecodeTimeoutSeconds` (20), `Media__MaxTotalBytes` (2 GB), `Media__RetentionDays` (7) | Grenzen en bewaartijd; standaardwaarden zijn bedoeld om te blijven. |
|
||||
| `Hero__MaxPublishedSlides` | Technische bovengrens op het aantal gepubliceerde slides (standaard 50). |
|
||||
| `RateLimiting__HeroPublic`, `__MediaPublic`, `__HeroUpload` | Snelheidsbeleid (standaard 120 per 60 s, 600 per 60 s, 20 per uur per gebruiker). |
|
||||
|
||||
### Pi (test en later productie van SLP)
|
||||
|
||||
1. Eenmalig, als het service-account: `mkdir -p ~/apps/slpsoftware/<omgeving>/shared/media && chmod 700 ~/apps/slpsoftware/<omgeving>/shared/media` (voor ASF-test hetzelfde in zijn eigen map).
|
||||
2. In `shared/env`: `Media__Directory=%h/apps/slpsoftware/<omgeving>/shared/media` (let op: systemd verwacht een volledig pad; vervang `%h` door het thuispad als de EnvironmentFile dat niet uitbreidt).
|
||||
3. De map hoort bij de back-up van de site (het back-upscript van de database neemt hem niet mee).
|
||||
4. Na de eerste deploy: kijk in het log naar `Image library Magick.NET self-test passed` (met de lijst formaten). Staat daar een fout, dan zijn uploads uitgezet en is de bibliotheek op deze machine niet bruikbaar (linux-arm64 is niet vooraf getest).
|
||||
5. Het deployartefact is ongeveer 35 MB groter door de beeldbibliotheek; meet de grootte bij de eerste deploy tegen de uploadlimiet van de proxy.
|
||||
|
||||
### IIS (ASF-productie, later)
|
||||
|
||||
Een gegevensmap naast de site, buiten de webroot, waarin het account van de application pool mag schrijven. **Of dat op MijnHostingPartner kan, is nog niet getest** (Bryan test het met ASF). Faalt het, dan komt er een opslag in de database achter dezelfde koppeling (`IMediaStore`). De self-contained win-x64-publish bevat alleen `Magick.Native-Q8-x64.dll`.
|
||||
|
||||
## Startinhoud (alleen test)
|
||||
|
||||
```powershell
|
||||
./scripts/Seed-Hero.ps1 -BaseUrl https://test.andreaslop.nl -ImagesDirectory <web/src/assets van de ASF-repository>
|
||||
./scripts/Seed-Hero.ps1 -BaseUrl https://test.slpsoftware.nl -SeedFile ./scripts/hero-sls.json
|
||||
```
|
||||
|
||||
`hero-asf.json` bevat de 8 huidige foto's met alt-teksten en een eerste schatting van de focuspunten (door de ASF-sessie); Bryan past ze aan in de admin. `hero-sls.json` is de huidige SLP-hero (alleen tekst, twee knoppen). Het script slaat een CMS over dat al een hero heeft (`-Force` vervangt), vraagt het wachtwoord interactief en gebruikt voor productie niets zonder Bryans go.
|
||||
|
||||
## Wat er achter de schermen gebeurt
|
||||
|
||||
- Upload: echt bestandstype aan de inhoud (geen SVG), grenzen op bytes, pixels, tijd en gelijktijdigheid; metadata (GPS) uit het opgeslagen origineel en alle varianten; varianten per verhouding rond het focuspunt, nooit groter dan de bron, in WebP (en AVIF waar het platform dat kan). Dezelfde foto nog een keer is hetzelfde plaatje (en herstelt verloren bestanden).
|
||||
- Oude bestanden (nieuwe focus, vervangen of ongebruikte foto) blijven 7 dagen en worden dan opgeschoond; een bestand dat nog gebruikt wordt, verdwijnt nooit.
|
||||
- Ondersteunde invoer: JPEG, PNG, WebP, GIF, BMP, TIFF en AVIF; HEIC alleen als aangegeven mogelijkheid van de bibliotheek (nog niet met een echt bestand getest).
|
||||
|
||||
## Controleren na een deploy
|
||||
|
||||
- `scripts/smoke-site.sh` (in de CI na elke test-deploy): module `Hero` geladen, `GET /api/v1/hero` is 200 of 204, het beheer is beschermd, een niet-bestaand mediaadres is een gewone 404.
|
||||
- LCP: Lighthouse (mobiel profiel) op de testsite vóór en na het plaatsen van de markers in de website; de LCP van de gerenderde pagina mag niet slechter zijn dan die van de ingebakken pagina en de hero veroorzaakt geen layoutverschuiving (`width` en `height` staan op de afbeelding). Zie `release-checklist-productie.md`.
|
||||
@@ -38,6 +38,15 @@ Achtergrond per onderwerp: [deploy-en-testomgevingen.md](deploy-en-testomgevinge
|
||||
| `Contact__Enabled` | pas `true` als het formulier live moet | Het contactformulier staat standaard uit. |
|
||||
| `Texts__DefaultLanguage` | `nl` (standaard) | De vaste teksten van de backend zijn Nederlands. |
|
||||
|
||||
## 4b. Hero (module `Hero`)
|
||||
|
||||
- [ ] `Media__Directory` staat in de omgeving van de productiehost, de map bestaat buiten de release en de webroot en is beschrijfbaar door het service-account (Pi: `shared/media`; ASF op IIS: een gegevensmap naast de site, schrijfrechten voor de application pool: **door Bryan met ASF getest voor de release**).
|
||||
- [ ] De map zit in de back-up van de site (het database-back-upscript neemt hem niet mee).
|
||||
- [ ] Het log toont na de start `Image library Magick.NET self-test passed`; zo niet, dan zijn uploads uitgezet.
|
||||
- [ ] De hero staat in het CMS van productie (seed alleen met Bryans go: `scripts/Seed-Hero.ps1`), de focuspunten kloppen en de ASF-foto's zijn gecontroleerd.
|
||||
- [ ] De websites zijn gebouwd met de markers (`CMS:HERO-HTML`, `CMS:HERO-PRELOAD`, `CMS:DATA`); de rooktest slaagt en de LCP van de gerenderde pagina is niet slechter dan die van de ingebakken pagina (Lighthouse, mobiel).
|
||||
- [ ] Het deployartefact past binnen de uploadlimiet van de proxy (de beeldbibliotheek voegt ongeveer 35 MB toe).
|
||||
|
||||
## 5. Contact-retentie en privacy
|
||||
|
||||
- [ ] `Contact:RetentionMonths` (standaard 12) en `Contact:SpamRetentionDays` (standaard 30) kloppen met de privacyverklaring van de site.
|
||||
|
||||
@@ -0,0 +1,141 @@
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Puts the hero of a site into a CMS through the admin API: uploads the photos, sets their focus points and saves the
|
||||
hero. Test hosts only unless you deliberately point it somewhere else. Skips a CMS that already has a hero.
|
||||
|
||||
.DESCRIPTION
|
||||
Logs in with an admin account (the password is asked interactively, as a secure string; it is never written to disk,
|
||||
to the console or to a log). Then, from -SeedFile: uploads every slide photo from -ImagesDirectory (the same photo
|
||||
again is the same image, so a second run does not duplicate anything), sets the focus point of each photo, and saves
|
||||
the hero (texts, buttons, display and the slides with their alt texts) in one go.
|
||||
|
||||
.PARAMETER BaseUrl
|
||||
Root of the host, e.g. https://test.andreaslop.nl (no trailing /api).
|
||||
|
||||
.PARAMETER SeedFile
|
||||
JSON: title (new lines as \n), tagline, lead, display (single or slideshow), buttons [{label, target}],
|
||||
slides [{file, alt, decorative, focus {x, y}}]. Default: hero-asf.json next to this script. hero-sls.json is the
|
||||
text-only hero of SLP Software (no slides).
|
||||
|
||||
.PARAMETER ImagesDirectory
|
||||
The folder that holds the files named in the slides (required when the seed has slides). For ASF these are the
|
||||
existing exports hero-1.jpg to hero-8.jpg of the website repository (web/src/assets).
|
||||
|
||||
.PARAMETER Email
|
||||
Admin e-mail address. Asked when omitted.
|
||||
|
||||
.PARAMETER Force
|
||||
Replace an existing hero as well (the photos stay; the slide list is replaced).
|
||||
|
||||
.PARAMETER WhatIf
|
||||
Shows what would be done without logging in or writing anything.
|
||||
|
||||
.EXAMPLE
|
||||
./scripts/Seed-Hero.ps1 -BaseUrl https://test.andreaslop.nl -ImagesDirectory K:\Development\SlpSoftware\Projects\AndreaSlopFotografie\web\src\assets
|
||||
|
||||
.EXAMPLE
|
||||
./scripts/Seed-Hero.ps1 -BaseUrl https://test.slpsoftware.nl -SeedFile ./scripts/hero-sls.json
|
||||
#>
|
||||
[CmdletBinding(SupportsShouldProcess)]
|
||||
param(
|
||||
[Parameter(Mandatory)] [string] $BaseUrl,
|
||||
[string] $SeedFile,
|
||||
[string] $ImagesDirectory,
|
||||
[string] $Email,
|
||||
[switch] $Force
|
||||
)
|
||||
|
||||
$ErrorActionPreference = 'Stop'
|
||||
# $PSScriptRoot is empty in a param default under Windows PowerShell 5.1, so it is read here.
|
||||
$here = if ($PSScriptRoot) { $PSScriptRoot } else { Split-Path -Parent $MyInvocation.MyCommand.Path }
|
||||
if (-not $SeedFile) { $SeedFile = Join-Path $here 'hero-asf.json' }
|
||||
$BaseUrl = $BaseUrl.TrimEnd('/')
|
||||
$api = "$BaseUrl/api/v1"
|
||||
|
||||
$seed = Get-Content -LiteralPath $SeedFile -Raw -Encoding UTF8 | ConvertFrom-Json
|
||||
if ([string]::IsNullOrWhiteSpace($seed.title) -or $seed.title -like 'TODO*') { throw "The seed has no title (or it is still TODO)." }
|
||||
$slides = @($seed.slides | Where-Object { $_ })
|
||||
if ($slides.Count -gt 0) {
|
||||
if (-not $ImagesDirectory) { throw 'The seed has slides: give -ImagesDirectory (the folder with the photos).' }
|
||||
foreach ($s in $slides) {
|
||||
$path = Join-Path $ImagesDirectory $s.file
|
||||
if (-not (Test-Path -LiteralPath $path)) { throw "Photo not found: $path" }
|
||||
if ([string]::IsNullOrWhiteSpace($s.alt) -and -not $s.decorative) { throw "Slide '$($s.file)' has no alt text and is not decorative." }
|
||||
}
|
||||
}
|
||||
|
||||
if ($WhatIfPreference) {
|
||||
Write-Host "Would save the hero '$($seed.title -replace "`n", ' / ')' on $BaseUrl with $($slides.Count) slide(s):"
|
||||
$slides | ForEach-Object { Write-Host " $($_.file) focus $($_.focus.x),$($_.focus.y) alt: $($_.alt)" }
|
||||
return
|
||||
}
|
||||
|
||||
if (-not $Email) { $Email = Read-Host 'Admin e-mail' }
|
||||
$secure = Read-Host "Password for $Email" -AsSecureString
|
||||
$bstr = [Runtime.InteropServices.Marshal]::SecureStringToBSTR($secure)
|
||||
try {
|
||||
$plain = [Runtime.InteropServices.Marshal]::PtrToStringBSTR($bstr)
|
||||
$body = @{ email = $Email; password = $plain } | ConvertTo-Json -Compress
|
||||
$login = Invoke-RestMethod -Method Post -Uri "$api/auth/login" -ContentType 'application/json' -Body $body
|
||||
}
|
||||
finally {
|
||||
[Runtime.InteropServices.Marshal]::ZeroFreeBSTR($bstr)
|
||||
$plain = $null; $body = $null
|
||||
}
|
||||
$token = $login.accessToken
|
||||
$headers = @{ Authorization = "Bearer $token" }
|
||||
|
||||
$current = Invoke-RestMethod -Method Get -Uri "$api/hero/all" -Headers $headers
|
||||
if ($current.id -and -not $Force) {
|
||||
Write-Host "skip a hero already exists on $BaseUrl (use -Force to replace it)"
|
||||
return
|
||||
}
|
||||
|
||||
Add-Type -AssemblyName System.Net.Http
|
||||
function Send-Photo([string] $path) {
|
||||
$client = [System.Net.Http.HttpClient]::new()
|
||||
try {
|
||||
$client.DefaultRequestHeaders.Authorization = [System.Net.Http.Headers.AuthenticationHeaderValue]::new('Bearer', $token)
|
||||
$form = [System.Net.Http.MultipartFormDataContent]::new()
|
||||
$bytes = [System.IO.File]::ReadAllBytes($path)
|
||||
$content = [System.Net.Http.ByteArrayContent]::new($bytes)
|
||||
$form.Add($content, 'file', [System.IO.Path]::GetFileName($path))
|
||||
$response = $client.PostAsync("$api/hero/images", $form).GetAwaiter().GetResult()
|
||||
$text = $response.Content.ReadAsStringAsync().GetAwaiter().GetResult()
|
||||
if (-not $response.IsSuccessStatusCode) { throw "Upload of '$path' failed ($([int]$response.StatusCode)): $text" }
|
||||
return ($text | ConvertFrom-Json)
|
||||
}
|
||||
finally { $client.Dispose() }
|
||||
}
|
||||
|
||||
$requestSlides = @()
|
||||
foreach ($s in $slides) {
|
||||
$image = Send-Photo (Join-Path $ImagesDirectory $s.file)
|
||||
Write-Host "upload $($s.file) -> image $($image.id)"
|
||||
if ($s.focus) {
|
||||
$focus = @{ focus = @{ x = [double]$s.focus.x; y = [double]$s.focus.y; zoom = 1.0 }; wide = $null; tall = $null } | ConvertTo-Json -Depth 5
|
||||
$null = Invoke-RestMethod -Method Put -Uri "$api/hero/images/$($image.id)/focus" -Headers $headers -ContentType 'application/json' -Body $focus
|
||||
Write-Host "focus $($s.file) at $($s.focus.x), $($s.focus.y)"
|
||||
}
|
||||
$requestSlides += [ordered]@{ imageId = $image.id; alt = $(if ($s.decorative) { $null } else { $s.alt }); decorative = [bool]$s.decorative; isActive = $true }
|
||||
}
|
||||
|
||||
$payload = [ordered]@{
|
||||
title = $seed.title
|
||||
tagline = $(if ($seed.tagline) { $seed.tagline } else { $null })
|
||||
lead = $(if ($seed.lead) { $seed.lead } else { $null })
|
||||
display = $(if ($seed.display) { $seed.display } else { 'single' })
|
||||
buttons = @($seed.buttons | Where-Object { $_ } | ForEach-Object { [ordered]@{ label = $_.label; target = $_.target } })
|
||||
isActive = $true
|
||||
startsAt = $null
|
||||
endsAt = $null
|
||||
slides = $requestSlides
|
||||
} | ConvertTo-Json -Depth 6
|
||||
|
||||
try {
|
||||
$saved = Invoke-RestMethod -Method Put -Uri "$api/hero" -Headers $headers -ContentType 'application/json; charset=utf-8' -Body ([Text.Encoding]::UTF8.GetBytes($payload))
|
||||
Write-Host "saved hero $($saved.id) with $($saved.slides.Count) slide(s); live: $($saved.isLive)"
|
||||
}
|
||||
catch {
|
||||
Write-Error "Saving the hero failed: $($_.Exception.Message) $($_.ErrorDetails.Message)"
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
{
|
||||
"note": "Seed of the ASF hero for the TEST CMS (ASF commit 13f78c4, web/contract/host-injection/hero/seed.json). Photos: the existing exports in the website repository (web/src/assets, hero-1.jpg to hero-8.jpg); never upscaled. The focus points are a first estimate by looking at the photos (x and y from the top left, 0 to 1); Bryan adjusts them in the admin.",
|
||||
"display": "slideshow",
|
||||
"title": "Andrea Slop",
|
||||
"tagline": "Lifestyle fotograaf · Huizen",
|
||||
"lead": null,
|
||||
"buttons": [
|
||||
{
|
||||
"label": "Lees meer",
|
||||
"target": "/over-mij"
|
||||
}
|
||||
],
|
||||
"slides": [
|
||||
{
|
||||
"file": "hero-8.jpg",
|
||||
"alt": "Zwangerschapsfoto in de duinen",
|
||||
"decorative": false,
|
||||
"focus": {
|
||||
"x": 0.5,
|
||||
"y": 0.55
|
||||
}
|
||||
},
|
||||
{
|
||||
"file": "hero-7.jpg",
|
||||
"alt": "Knusse newbornfoto met de familie",
|
||||
"decorative": false,
|
||||
"focus": {
|
||||
"x": 0.45,
|
||||
"y": 0.5
|
||||
}
|
||||
},
|
||||
{
|
||||
"file": "hero-1.jpg",
|
||||
"alt": "Lifestyle fotografie",
|
||||
"decorative": false,
|
||||
"focus": {
|
||||
"x": 0.55,
|
||||
"y": 0.6
|
||||
}
|
||||
},
|
||||
{
|
||||
"file": "hero-2.jpg",
|
||||
"alt": "Zwangerschapsshoot in de buitenlucht",
|
||||
"decorative": false,
|
||||
"focus": {
|
||||
"x": 0.45,
|
||||
"y": 0.45
|
||||
}
|
||||
},
|
||||
{
|
||||
"file": "hero-3.jpg",
|
||||
"alt": "Newbornshoot van een pasgeboren baby",
|
||||
"decorative": false,
|
||||
"focus": {
|
||||
"x": 0.45,
|
||||
"y": 0.4
|
||||
}
|
||||
},
|
||||
{
|
||||
"file": "hero-4.jpg",
|
||||
"alt": "Spontaan portret buiten",
|
||||
"decorative": false,
|
||||
"focus": {
|
||||
"x": 0.45,
|
||||
"y": 0.35
|
||||
}
|
||||
},
|
||||
{
|
||||
"file": "hero-5.jpg",
|
||||
"alt": "Natuurlijke lifestylefoto",
|
||||
"decorative": false,
|
||||
"focus": {
|
||||
"x": 0.5,
|
||||
"y": 0.55
|
||||
}
|
||||
},
|
||||
{
|
||||
"file": "hero-6.jpg",
|
||||
"alt": "Portret in de natuur",
|
||||
"decorative": false,
|
||||
"focus": {
|
||||
"x": 0.5,
|
||||
"y": 0.35
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"note": "Seed of the SLP Software hero for the TEST CMS: the current texts, unchanged (Bryan, 2026-11-16). The small line 'Web & .NET development' and the code line stay fixed text in the SLP website. The title is one field with line breaks; the website derives the screen-reader title from the lines.",
|
||||
"display": "single",
|
||||
"title": "Websites,\napps\n& meer.",
|
||||
"tagline": null,
|
||||
"lead": "Bij SLP Software kun je terecht voor maatwerk oplossingen. Of het nou gaat om een website, cms of app: wij bouwen het allemaal. Voor ondernemers die geen verrassingen willen — niet in de code, niet op de factuur.",
|
||||
"buttons": [
|
||||
{
|
||||
"label": "Bekijk pakketten",
|
||||
"target": "#pakketten"
|
||||
},
|
||||
{
|
||||
"label": "Plan een gesprek",
|
||||
"target": "#contact"
|
||||
}
|
||||
],
|
||||
"slides": []
|
||||
}
|
||||
@@ -50,6 +50,13 @@ banner="$(status_of '/api/v1/offerings/banner')"
|
||||
if [ "$banner" = "200" ] || [ "$banner" = "204" ]; then pass "public banner (/api/v1/offerings/banner -> $banner)"; else fail "public banner (-> $banner, expected 200 or 204)"; fi
|
||||
expect_status /api/v1/offerings/all 401 "the administrator list is protected"
|
||||
|
||||
# The hero: 204 = no hero to show (the website keeps its own), 200 = there is one; the management routes are protected and
|
||||
# the media endpoint answers a plain 404 for something that is not stored.
|
||||
hero="$(status_of '/api/v1/hero')"
|
||||
if [ "$hero" = "200" ] || [ "$hero" = "204" ]; then pass "public hero (/api/v1/hero -> $hero)"; else fail "public hero (-> $hero, expected 200 or 204)"; fi
|
||||
expect_status /api/v1/hero/all 401 "the hero management read is protected"
|
||||
expect_status /media/hero/0123456789abcdef/wide-960.webp 404 "media that is not stored is a plain 404"
|
||||
|
||||
# A test host is never indexed.
|
||||
expect_header / X-Robots-Tag noindex "noindex on the website"
|
||||
expect_body /robots.txt "Disallow: /" "robots.txt disallows everything"
|
||||
@@ -75,11 +82,11 @@ fi
|
||||
|
||||
case "$profile" in
|
||||
sls-test)
|
||||
for m in Identity Availability Offerings Contact Master; do expect_module "$m"; done
|
||||
for m in Identity Availability Offerings Contact Hero Master; do expect_module "$m"; done
|
||||
expect_status /sitemap.xml 404 "no sitemap on a test host"
|
||||
;;
|
||||
asf-test)
|
||||
for m in Identity Availability Offerings Contact; do expect_module "$m"; done
|
||||
for m in Identity Availability Offerings Contact Hero; do expect_module "$m"; done
|
||||
expect_no_module Master
|
||||
# Prerendered website: an unknown path is a real 404 (an SPA would answer 200).
|
||||
expect_status /smoke-test-path-that-does-not-exist 404 "unknown website path is a 404"
|
||||
|
||||
Reference in New Issue
Block a user