fix invalid opengraph stream url
deploy / build-and-deploy (push) Successful in 39s

This commit is contained in:
bytedream committed 2026-10-31 01:54:29 +01:00
1 parent b0f55f3e6b
commit 197ea41442
1 file changed
+2 -3
+2 -3
View File
@@ -14,14 +14,13 @@ if (!metadata) return new Response(null, { status: 404 });
const { title, description, width, height, duration } = metadata;
const basePath = import.meta.env.BASE_URL.replace(/\/$/, '');
const streamPath = `${basePath}/video/${encodeURIComponent(video.name)}/stream`;
const streamUrl = new URL(streamPath, Astro.url);
---
<WebsiteLayout title={`${title} - Video`} description={description ?? undefined}>
<Fragment slot="head">
<meta property="og:type" content="video" />
<meta property="og:video" content={streamUrl.href} />
{streamUrl.href.startsWith('https://') && <meta property="og:video:secure_url" content={streamUrl.href} />}
<meta property="og:video" content={streamPath} />
{streamPath.startsWith('https://') && <meta property="og:video:secure_url" content={streamPath} />}
<meta property="og:video:type" content={video.contentType} />
{width && <meta property="og:video:width" content={width.toString()} />}
{height && <meta property="og:video:height" content={height.toString()} />}