diff --git a/src/pages/index.astro b/src/pages/index.astro index 40b8813..faace4b 100644 --- a/src/pages/index.astro +++ b/src/pages/index.astro @@ -6,7 +6,6 @@ import Craftattack from '@assets/img/craftattack.webp'; import Background from '@assets/img/background.webp'; import { HOMEPAGE_TRAILER_URL, START_DATE } from 'astro:env/server'; import { getSetting, SettingKey } from '@util/settings'; -import { siteUrl } from '@util/url.ts'; import { db } from '@db/database.ts'; const signupEnabled = await getSetting(db, SettingKey.SignupEnabled, false); diff --git a/src/pages/video/[name].astro b/src/pages/video/[name].astro index fa12b58..5838bd5 100644 --- a/src/pages/video/[name].astro +++ b/src/pages/video/[name].astro @@ -14,7 +14,9 @@ if (!metadata) return new Response(null, { status: 404 }); const { title, description, longDescription } = metadata; const streamUrl = siteUrl(`video/${encodeURIComponent(video.name)}/stream`); -const thumbnailUrl = siteUrl(`video/${encodeURIComponent(video.name)}/thumbnail.jpg`); +const thumbnailUrl = siteUrl( + `video/${encodeURIComponent(video.name)}/thumbnail.jpg?v=${video.modifiedAt.getTime()}-${video.size}` +); --- diff --git a/src/pages/video/[name]/embed.astro b/src/pages/video/[name]/embed.astro index eecf5f9..0ff898d 100644 --- a/src/pages/video/[name]/embed.astro +++ b/src/pages/video/[name]/embed.astro @@ -13,7 +13,9 @@ if (!video) return new Response(null, { status: 404 }); const metadata = await getVideoMetadata(video); const title = metadata?.title ?? video.name; const streamUrl = siteUrl(`video/${encodeURIComponent(video.name)}/stream`); -const thumbnailUrl = siteUrl(`video/${encodeURIComponent(video.name)}/thumbnail.jpg`); +const thumbnailUrl = siteUrl( + `video/${encodeURIComponent(video.name)}/thumbnail.jpg?v=${video.modifiedAt.getTime()}-${video.size}` +); --- diff --git a/src/pages/video/[name]/thumbnail.jpg.ts b/src/pages/video/[name]/thumbnail.jpg.ts index 7acf0dd..171e39e 100644 --- a/src/pages/video/[name]/thumbnail.jpg.ts +++ b/src/pages/video/[name]/thumbnail.jpg.ts @@ -13,7 +13,7 @@ async function handle(context: APIContext, headersOnly = false) { const headers = { 'Content-Type': thumbnail.contentType, 'Content-Length': stats.size.toString(), - 'Cache-Control': 'public, max-age=86400' + 'Cache-Control': 'public, max-age=31536000, immutable' }; if (headersOnly) return new Response(null, { headers });