diff --git a/packages/app/src/layouts/Layout.astro b/packages/app/src/layouts/Layout.astro index 4abcff13..51f8da86 100644 --- a/packages/app/src/layouts/Layout.astro +++ b/packages/app/src/layouts/Layout.astro @@ -13,6 +13,8 @@ import { types, fansubs } from '../constant'; export interface Props { title: string; + + timestamp?: Date; } const { title } = Astro.props; @@ -25,7 +27,9 @@ const page = Astro.params.page ?? Astro.url.searchParams.get('page') ?? '1'; const enableFeed = page === '1' && !Astro.url.pathname.startsWith('/resource/'); const runtime = getRuntime(Astro.request); -const timestamp = new Date((await runtime?.env.animegarden.get('state/refresh-timestamp')) ?? 0); +const timestamp = + Astro.props.timestamp ?? + new Date((await runtime?.env.animegarden.get('state/refresh-timestamp')) ?? 0); const hasFansubSearch = search.has('fansubId'); diff --git a/packages/app/src/pages/index.astro b/packages/app/src/pages/index.astro index c919988d..007f5412 100644 --- a/packages/app/src/pages/index.astro +++ b/packages/app/src/pages/index.astro @@ -10,14 +10,14 @@ import { wfetch, fetchResources } from '../fetch'; const runtime = getRuntime(Astro.request); -const { ok, resources } = await fetchResources( +const { ok, resources, timestamp } = await fetchResources( 1, { pageSize: 80 }, { fetch: wfetch(runtime?.env?.worker) } ); --- - +
{ ok ? ( diff --git a/packages/app/src/pages/resources/[page].astro b/packages/app/src/pages/resources/[page].astro index 22c82f3c..458dfc66 100644 --- a/packages/app/src/pages/resources/[page].astro +++ b/packages/app/src/pages/resources/[page].astro @@ -39,7 +39,8 @@ const { ok, complete, resources, - filter: searchParams + filter: searchParams, + timestamp } = await fetchResources( page, { ...params }, @@ -55,7 +56,7 @@ const keywords = { }; --- - +