diff --git a/apps/web/netlify/edge-functions/og.tsx b/apps/web/netlify/edge-functions/og.tsx index 44fa9202de..6ba883f173 100644 --- a/apps/web/netlify/edge-functions/og.tsx +++ b/apps/web/netlify/edge-functions/og.tsx @@ -1,8 +1,6 @@ // deno-lint-ignore no-import-prefix no-unused-vars import React from "https://esm.sh/react@18.2.0"; // deno-lint-ignore no-import-prefix -import { ImageResponse } from "https://deno.land/x/og_edge@0.0.6/mod.ts"; -// deno-lint-ignore no-import-prefix import { z } from "https://deno.land/x/zod@v3.23.8/mod.ts"; const templateSchema = z.object({ @@ -14,7 +12,6 @@ const templateSchema = z.object({ const changelogSchema = z.object({ type: z.literal("changelog"), version: z.string(), - isNightly: z.boolean().optional().default(false), }); const OGSchema = z.discriminatedUnion("type", [templateSchema, changelogSchema]); @@ -27,9 +24,8 @@ function parseSearchParams(url: URL): z.infer | null { if (type === "changelog") { const version = url.searchParams.get("version"); - const isNightly = url.searchParams.get("isNightly") === "true"; - const result = OGSchema.safeParse({ type, version, isNightly }); + const result = OGSchema.safeParse({ type, version }); return result.success ? result.data : null; } @@ -103,114 +99,29 @@ function renderTemplate(params: z.infer) { } function renderChangelogTemplate(params: z.infer) { - const background = params.isNightly - ? "linear-gradient(180deg, #03BCF1 0%, #127FE5 100%)" - : "linear-gradient(180deg, #A8A29E 0%, #57534E 100%)"; - - return ( -
- {/* Header section */} -
- {/* Left: Hyprnote Changelog */} -
- Hyprnote Changelog -
- - {/* Center: Line */} -
- - {/* Right: Version */} -
- {params.version} -
+ const isNightly = params.version.includes("nightly"); + + if (isNightly) { + return ( +
+
Changelog
+
v.{params.version}
+
The AI notepad for private meetings
+
Hyprnote.
+
+
+ ); + } - {/* Image section */} -
-
- {/* Shadow layer */} -
- {/* Image */} - Hyprnote Application -
-
+ return ( +
+
Changelog
+
v.{params.version}
+
The AI notepad for private meetings
+
Hyprnote.
+
+
); } @@ -218,18 +129,6 @@ function renderChangelogTemplate(params: z.infer) { export default async function handler(req: Request) { const url = new URL(req.url); - // Disable in development to avoid WASM loading issues - if ( - url.hostname === "localhost" || - url.hostname === "127.0.0.1" || - Deno.env.get("CONTEXT") === "dev" - ) { - return new Response("OG image generation disabled in dev", { - status: 503, - headers: { "Content-Type": "text/plain" }, - }); - } - const params = parseSearchParams(url); if (!params) { @@ -240,6 +139,9 @@ export default async function handler(req: Request) { } try { + // Dynamically import ImageResponse only when needed (not in dev) + const { ImageResponse } = await import("https://deno.land/x/og_edge@0.0.6/mod.ts"); + // https://unpic.pics/og-edge let response; if (params.type === "changelog") { @@ -283,5 +185,4 @@ export default async function handler(req: Request) { export const config = { path: "/og", cache: "manual", - excludedPath: Deno.env.get("CONTEXT") === "dev" ? "/og" : undefined, }; diff --git a/apps/web/src/routes/_view/changelog/$slug.tsx b/apps/web/src/routes/_view/changelog/$slug.tsx index bb36568dd2..8882736636 100644 --- a/apps/web/src/routes/_view/changelog/$slug.tsx +++ b/apps/web/src/routes/_view/changelog/$slug.tsx @@ -66,7 +66,7 @@ export const Route = createFileRoute("/_view/changelog/$slug")({ const title = `Hyprnote Changelog - Version ${changelog.version}`; const description = `Explore what's new in Hyprnote version ${changelog.version}${isNightly ? " (Nightly)" : ""}.`; const url = `https://hyprnote.com/changelog/${changelog.slug}`; - const ogImageUrl = `https://hyprnote.com/og?type=changelog&version=${encodeURIComponent(changelog.version)}&isNightly=${isNightly}`; + const ogImageUrl = `https://hyprnote.com/og?type=changelog&version=${encodeURIComponent(changelog.version)}`; return { meta: [