From d6b7019ad5ae1a7a698eb9946033449700a6732f Mon Sep 17 00:00:00 2001 From: meetqy Date: Fri, 6 Oct 2023 10:31:26 +0800 Subject: [PATCH 1/2] fix: #14178 --- themes/gallery/src/pages/index.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/themes/gallery/src/pages/index.tsx b/themes/gallery/src/pages/index.tsx index 16efe22f..3d5714f0 100644 --- a/themes/gallery/src/pages/index.tsx +++ b/themes/gallery/src/pages/index.tsx @@ -86,7 +86,9 @@ function Home() { const photos = page.data?.map((image) => { const id = image.path.split("/").slice(-2)[0]; const src = `http://${config?.ip}:${config?.serverPort}/static/${id}/${image.name}.${image.ext}`; - const thumbnailPath = `http://${config?.ip}:${config?.serverPort}/static/${id}/${image.name}_thumbnail.png`; + const thumbnailPath = image.noThumbnail + ? src + : `http://${config?.ip}:${config?.serverPort}/static/${id}/${image.name}_thumbnail.png`; return { id: image.id, From 6d199faea68513342ae66e681c07e40a22de96c4 Mon Sep 17 00:00:00 2001 From: meetqy Date: Fri, 6 Oct 2023 11:06:23 +0800 Subject: [PATCH 2/2] =?UTF-8?q?fix:=20=E3=80=90Gallery=20=E4=B8=BB?= =?UTF-8?q?=E9=A2=98=E3=80=91=E6=97=A0=E7=BC=A9=E7=95=A5=E5=9B=BE=E6=9C=AA?= =?UTF-8?q?=E5=B1=95=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/api/src/sync/image.ts | 1 + themes/gallery/src/pages/index.tsx | 5 +++-- tooling/typescript/base.d.ts | 1 + 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/packages/api/src/sync/image.ts b/packages/api/src/sync/image.ts index 187c6b5e..03e7ecf2 100644 --- a/packages/api/src/sync/image.ts +++ b/packages/api/src/sync/image.ts @@ -80,6 +80,7 @@ export const upsertImage = async (p: Pending, timeout = 3000) => { annotation: newImage.annotation, url: newImage.url, duration: newImage.duration, + noThumbnail: newImage.noThumbnail ?? false, // 文件夹只需要关联,删除处理在 handleFolder 中处理,删除 folder 会同时删除关联的 image folders: { connect: newImage.folders }, tags, diff --git a/themes/gallery/src/pages/index.tsx b/themes/gallery/src/pages/index.tsx index 3d5714f0..4e33d280 100644 --- a/themes/gallery/src/pages/index.tsx +++ b/themes/gallery/src/pages/index.tsx @@ -85,10 +85,11 @@ function Home() { {pages?.map((page) => { const photos = page.data?.map((image) => { const id = image.path.split("/").slice(-2)[0]; - const src = `http://${config?.ip}:${config?.serverPort}/static/${id}/${image.name}.${image.ext}`; + const host = `http://${config?.ip}:${config?.serverPort}`; + const src = `${host}/static/${id}/${image.name}.${image.ext}`; const thumbnailPath = image.noThumbnail ? src - : `http://${config?.ip}:${config?.serverPort}/static/${id}/${image.name}_thumbnail.png`; + : `${host}/static/${id}/${image.name}_thumbnail.png`; return { id: image.id, diff --git a/tooling/typescript/base.d.ts b/tooling/typescript/base.d.ts index 01a95da2..d6eb887e 100644 --- a/tooling/typescript/base.d.ts +++ b/tooling/typescript/base.d.ts @@ -32,6 +32,7 @@ declare global { width: number; duration: number; lastModified: number; + noThumbnail: boolean?; palettes: MetadataPalette[]; }