GitHub Release / release (push) Canceled after 0s
Publish Docker image / build (linux/amd64, ubuntu-latest, amd64) (push) Canceled after 0s
Publish Docker image / build (linux/arm64, ubuntu-24.04-arm, arm64) (push) Canceled after 0s
Publish Docker image / merge (push) Canceled after 0s
ci / ci (22, ubuntu-latest) (push) Canceled after 0s
修复设置页误清空管理域、配置与生效 URL 混淆及第三 Host 绕过隔离;加固 Settings API 与中间件,并更新文档站。
19 lines
545 B
TypeScript
19 lines
545 B
TypeScript
import {
|
|
shouldBlockImageHostRequest,
|
|
shouldBlockSiteHostImageRequest,
|
|
shouldBlockUnknownHostRequest
|
|
} from '../utils/host-isolation'
|
|
|
|
const HOST_ISOLATION_CACHE_CONTROL = 'private, no-cache, max-age=0'
|
|
|
|
export default defineEventHandler((event) => {
|
|
if (
|
|
shouldBlockUnknownHostRequest(event)
|
|
|| shouldBlockImageHostRequest(event)
|
|
|| shouldBlockSiteHostImageRequest(event)
|
|
) {
|
|
setHeader(event, 'Cache-Control', HOST_ISOLATION_CACHE_CONTROL)
|
|
throw createError({ statusCode: 404, statusMessage: 'Not Found' })
|
|
}
|
|
})
|