feat(cache): TMDB image proxy, posters, cache admin API and settings cards

GET /img/tmdb/{size}/{file} ported from MP ImageHelper / fetch_image
(sanitized cache path under DATA_DIR/cache/images, GLOBAL_IMAGE_CACHE
read switch, md5 ETag / 304, day-based cleanup job). Cache module adds
cache.sweep / cache.images_clean jobs and /cache/tmdb, /cache/images
list and clear endpoints. Library list/detail and the search palette
show posters with the neutral placeholder as fallback; metadata settings
get TMDB cache and image cache cards. Runbook docs/runbook/cache.md and
porting notes docs/porting/moviepilot-tmdb-cache.md.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
rootandClaude Opus 5.5 committed 2026-09-28 22:26:29 +08:00
1 parent 946fca5e55
commit 7862573944
16 files changed
+1028 -9

No files matched your search

+34
View File
@@ -3,6 +3,7 @@ import * as agent from "./agent.ts";
import * as assets from "./assets.ts";
import * as auth from "./auth.ts";
import * as browser from "./browser.ts";
import * as cache from "./cache.ts";
import { CapabilityDescriptor, KnownCapabilityId } from "./capability.ts";
import { type ApiScope, CursorQuery, cursorPage, HealthStatus, Id, IdParam } from "./common.ts";
import * as content from "./content.ts";
@@ -1611,6 +1612,39 @@ export const Api = {
}),
},
// ── 缓存(C2-A,docs/runbook/cache.md) ──
cache: {
tmdb: ep({
method: "get",
path: "/cache/tmdb",
scope: "admin",
summary: "TMDB 缓存条目(请求响应与识别结果:键、过期时间、大小)与上限 / TTL",
query: cache.TmdbCacheQuery,
response: cache.TmdbCacheList,
}),
tmdbClear: ep({
method: "post",
path: "/cache/tmdb/clear",
scope: "admin",
summary: "清空 TMDB 缓存(请求响应与识别结果)",
response: cache.CacheClearResult,
}),
images: ep({
method: "get",
path: "/cache/images",
scope: "admin",
summary: "图片代理缓存用量",
response: cache.ImageCacheStatus,
}),
imagesClear: ep({
method: "post",
path: "/cache/images/clear",
scope: "admin",
summary: "清空图片代理缓存",
response: cache.CacheClearResult,
}),
},
// ── 设置 ──
settings: {
get: ep({ method: "get", path: "/settings", scope: "read", summary: "全局设置", response: GlobalSettings }),