4.4 KiB
4.4 KiB
Components - andreaslop-site-hosting
Numbering follows the brief (C1-C6); C7 is added by this design (setup token, requirements FR-U2-07).
C2 WebsiteMode option (Core, SlpModularCms.Core.Hosting)
- Purpose: Per-client choice of how the public website is served.
- Responsibilities:
enum WebsiteMode { SpaFallback, PrerenderedPages }; propertyCmsHostOptions.WebsiteMode(defaultSpaFallback). - Interface: read by
CmsHost.ConfigureServices/ConfigurePipelineandStaticContentExtensions.
C3 Prerendered site serving (Core, SlpModularCms.Core.Hosting.Website, new folder)
Active only when WebsiteMode = PrerenderedPages.
| Part | Kind | Responsibility |
|---|---|---|
C3a WebsitePathResolver |
static, pure | Total function: (raw path, query string, Func<string,bool> fileExists) -> WebsiteResolution (ServeFile(relativePath), Redirect(location), NotFound). Contains every nginx-parity rule (canonical form, trailing slash, /index, traversal and backslash rejection, file-looking paths, reserved prefixes). No I/O, no clock, no logging. |
C3b WebsiteOptions |
options | Website:NoIndex (default false), validated at startup. |
C3c PrerenderedSiteMiddleware |
middleware | Adapter between HTTP and the resolver: supplies the file-exists predicate (confined to wwwroot/web), writes status, Location, Cache-Control, X-Robots-Tag, streams the file, serves 404.html with status 404, answers /robots.txt when NoIndex. Never handles reserved prefixes. |
| C3d Website compression | registration | Built-in response compression for the text MIME types, applied only to non-reserved paths (UseWhen), so /api/v1 and /admin responses are never compressed by this feature. |
C4 StrictSite policy (Core, SlpModularCms.Core.Hosting.Security)
- Purpose: A third CSP policy for a prerendered public site, reproducing the site's current header byte for byte.
- Responsibilities:
CspPolicyCatalog.StrictSiteconstant, added toKnownPolicies;Buildproduces the site CSP withX-Frame-Options: DENYandReferrer-Policy: strict-origin-when-cross-origin;SecurityHeadersOptionsgainsAllowedSiteScriptOriginsandAllowedSiteConnectOrigins, used only byStrictSite(decision Q1=A).StrictandRelaxedoutputs are unchanged. - Check: HSTS,
X-Content-Type-Options,Referrer-Policyand the CSP appear on website pages, assets, 301s, 404 and robots.txt (FR-U1-09). The existing writer emits CSP/frame/referrer as "HTML-only" headers; whether non-HTML website responses also need them is settled in U1 Functional Design.
C1 Client SlpModularCms.Api.AndreaSlopFotografie (Clients)
- Purpose: Deployable host for Andrea's instance.
- Responsibilities: thin
Program.csonCmsHostwithWebsiteMode.PrerenderedPages;.csprojreferences the modules (Core, Identity, and Availability only if the admin needs it); three-file appsettings; own database connection string template (no password in repo); own dev port;SecurityHeaders:DefaultPolicy = StrictSiteplus the site origin lists;Website:NoIndex = truefor test.
C5 Admin theme (frontend)
- Purpose: Per-site look of the admin, fixed at build time.
- Responsibilities:
frontend/themes/<name>/theme.cssoverriding existing design tokens; theme assets (logo, favicon, self-hosted Marcellus and Jost); build-time selection byVITE_THEME;VITE_DEFAULT_LANGUAGEinitial language (user choice still wins); unset variables reproduce today's admin.
C6 CI/CD (Gitea workflows)
- Purpose: Build and deploy each client with its own admin build.
- Responsibilities: per-client admin build (
VITE_THEME,VITE_DEFAULT_LANGUAGE,VITE_APP_TITLE), ARM64 publish of the new host, deploy to the test Pi using the existing atomic release switch,wwwroot/weboutside the release directory; production path ofApi.SlpSoftwareuntouched.
C7 First-admin setup token (Identity module + frontend)
- Purpose: Stop a stranger from claiming the first administrator on a freshly deployed, publicly reachable instance.
- Responsibilities:
SetupOptions(Identity:Setup:Token, optional);ISetupTokenValidator(constant-time compare, true when no token is configured);SetupController.GetStatusreturnstokenRequired;CreateOwnerrequires headerX-Setup-Tokenwhen configured; setup page in the frontend shows a token field only whentokenRequiredis true (decision Q3=A). Existing hosts without the setting behave exactly as before.