ci / ci (22, ubuntu-latest) (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
GitHub Release / release (push) Canceled after 0s
Add admin/image domain separation with host isolation middleware, optional hide-folder public URLs, GitHub release update check, and Lucky/Nginx deployment docs. Switch license to GPL-3.0-only.
14 lines
475 B
TypeScript
14 lines
475 B
TypeScript
/** 对外 URL 路径:可选去掉 key 的首段目录(如 images/) */
|
||
export function toPublicImagePath(key: string, hideFolder: boolean): string {
|
||
if (!hideFolder) return key
|
||
const slash = key.indexOf('/')
|
||
return slash > 0 ? key.slice(slash + 1) : key
|
||
}
|
||
|
||
const HIDDEN_DATE_PATH_PATTERN
|
||
= /^\d{4}\/\d{2}\/[^/\\]+\.(jpg|jpeg|png|webp|gif|svg|ico)$/i
|
||
|
||
export function isHiddenImageDatePath(path: string): boolean {
|
||
return HIDDEN_DATE_PATH_PATTERN.test(path)
|
||
}
|