Serve built Workers directly through pinned Miniflare with persistent D1-compatible storage and startup migrations. Build and verify Docker images in CI; publish main checkpoints to GHCR for manual TrueNAS updates on port 33046. Preserve explicit public-origin checks and LAN-compatible cryptographic operation IDs. Validation: 5,153 offline tests, typecheck, lint and build; 49 HTTP integration cases; HTTPS-origin create/join/chat/seat protection, foreign-origin rejection, exact saved-seat restart and browser asset serving. Independent persistence/proxy review completed. Clean Docker CI and actual NAS installation follow this source checkpoint.
11 lines
508 B
TypeScript
11 lines
508 B
TypeScript
/** The administrator configures the external origin; forwarded headers are untrusted. */
|
|
export function requestOrigin(request: Request, configured?: string): string {
|
|
if (!configured) return new URL(request.url).origin;
|
|
const url = new URL(configured);
|
|
if (
|
|
!['http:', 'https:'].includes(url.protocol) ||
|
|
url.username || url.password || url.search || url.hash || url.pathname !== '/'
|
|
) throw new Error('DUNE_PUBLIC_ORIGIN must be an HTTP(S) origin without a path.');
|
|
return url.origin;
|
|
}
|