use cache busting for video thumbnails
deploy / build-and-deploy (push) Successful in 18s

This commit is contained in:
bytedream committed 2026-11-01 16:10:59 +01:00
1 parent c5c3ba1a38
commit 92707e00e3
4 files changed
+7 -4

No files matched your search

-1
View File
@@ -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);
+3 -1
View File
@@ -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}`
);
---
<WebsiteLayout title={title} description={description ?? undefined} openGraph="minimal">
+3 -1
View File
@@ -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}`
);
---
<BaseLayout title={title}>
+1 -1
View File
@@ -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 });