import { createMiddleware } from 'hono/factory'; import type { HonoEnv } from './router'; /** * Paths that never render HTML and therefore do not need security headers. * * Browsers ignore CSP and friends on non-document responses, so we skip * them to keep API/manifest/asset responses clean. */ const NON_PAGE_PATH_REGEX = /^(\/api\/|\/ingest\/|\/__manifest|\/assets\/|\/apple-.*|\/favicon.*)/; /** * Embed routes serve our white-label embed UI. Customers iframe these from * arbitrary origins, so `frame-ancestors` must be wildcard, and customer- * supplied CSS is injected at runtime as `