Files
O96u 438c1d5529 feat: storage path layout, basename URLs, and bidirectional domain isolation
Add storage_use_date_path for flat vs date-key storage layout and emit
basename-only public URLs when hide-folder is enabled. Block image paths
on the site host when domain separation is active so only the image host
serves files. Update settings UI, i18n, tests, and deployment docs.
2026-08-28 09:56:45 +08:00

18 lines
515 B
TypeScript

import { requestPathToImageKey, serveImageByKey } from '../utils/serve-image'
/**
* 仅当路径像图片 key 或短链时才接管。
* 其它请求(/_nuxt、/api、页面)原样放行。
*/
export default defineEventHandler(async (event) => {
const method = getMethod(event)
if (method !== 'GET' && method !== 'HEAD') return
const key = requestPathToImageKey(getRequestURL(event).pathname, {
hideFolder: isHideFolderInUrl(event)
})
if (!key) return
return serveImageByKey(event, key)
})