mirror of
https://github.com/saltbo/zpan.git
synced 2026-09-21 13:20:33 +08:00
Adds imageHostingDomain middleware that inspects the Host header and, when it matches a verified customDomain in image_hosting_configs, resolves the virtual path to an image and 302-redirects to a presigned inline URL. Non-matching hosts fall through to normal routing. - server/services/image-hosting.ts: add resolveCustomDomain (host→orgId via single indexed lookup) and getImageByOrgPath (orgId+path→image) - server/middleware/image-hosting-domain.ts: new middleware with lowercase+port-strip normalisation, workers.dev/PUBLIC_APP_HOST fast-path, referer allowlist enforcement, accessCount increment, and presigned 302 with Cache-Control: public, max-age=270 - server/app.ts: register middleware on /* after platformMiddleware and before all route definitions - server/test/setup.ts: accept optional envOverrides in createTestApp - integration and CF tests covering all spec scenarios Agent-Profile: https://agent-kanban.dev/agents/a6bb038c4226a87f Co-authored-by: Bob <aibob@mails.agent-kanban.dev>