Merge branch 'detail1'
Co-Authored-By: Claude Fable 5.1 <[email protected]>
This commit is contained in:
commit
3067b668d8
16 files changed
+1992
-175
No files matched your search
@@ -1,4 +1,4 @@
|
||||
import type { SiteDetailPage } from "@umt/adapters";
|
||||
import { formatDetailPage, type SiteDetailPage } from "@umt/adapters";
|
||||
import type { SiteReleasePage } from "@umt/contracts";
|
||||
import { sql } from "@umt/db";
|
||||
import { sharedCache, storageSettings } from "../../../shared-cache.ts";
|
||||
@@ -99,6 +99,12 @@ export async function detailScreenshotRequest(
|
||||
export async function loadDetailPage(rt: SourcesRuntime, srId: string): Promise<SiteReleasePage | null> {
|
||||
const p = await loadStored(rt, srId);
|
||||
if (!p) return null;
|
||||
// 展示结构每次现算:旧缓存也能用,解析规则改了不必清缓存
|
||||
const formatted = formatDetailPage({
|
||||
descriptionText: p.descriptionText ?? null,
|
||||
mediaInfo: p.mediaInfo ?? null,
|
||||
files: p.files ?? [],
|
||||
});
|
||||
return {
|
||||
fetchedAt: p.fetchedAt,
|
||||
descriptionText: p.descriptionText,
|
||||
@@ -118,6 +124,7 @@ export async function loadDetailPage(rt: SourcesRuntime, srId: string): Promise<
|
||||
files: p.files,
|
||||
tags: p.tags,
|
||||
uploader: p.uploader,
|
||||
...formatted,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -88,6 +88,14 @@ describe.skipIf(!up)("站点详情页扩展内容:按需抓 + 24 小时缓存 +
|
||||
expect(page.mediaInfo).toMatch(/^General\nComplete name : Dune.mkv/);
|
||||
expect(page.descriptionText).toContain("◎片名 沙丘2");
|
||||
expect(page.descriptionText).not.toContain("Complete name");
|
||||
// 展示结构:读缓存时现算
|
||||
expect(page.infoBlock).toContainEqual({ key: "片名", value: "沙丘2" });
|
||||
expect(page.media).toMatchObject({
|
||||
kind: "mediainfo",
|
||||
general: { fileName: "Dune.mkv", container: "Matroska", size: "78 GiB", duration: "2 h 46 min" },
|
||||
video: [{ codec: "HEVC" }],
|
||||
});
|
||||
expect(Array.isArray(page.fileTree)).toBe(true);
|
||||
const row = await h.db
|
||||
.selectFrom("source_release")
|
||||
.select(["raw"])
|
||||
|
||||
Reference in new issue
Block a user