Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 19 additions & 3 deletions apps/web/netlify/edge-functions/og.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,16 @@ function renderTemplate(params: z.infer<typeof templateSchema>) {
);
}

export default function handler(req: Request) {
export default async function handler(req: Request) {
const url = new URL(req.url);

if (url.hostname === "localhost" || url.hostname === "127.0.0.1") {
return new Response("OG image generation disabled in dev", {
status: 503,
headers: { "Content-Type": "text/plain" },
});
}

const params = parseSearchParams(url);

if (!params) {
Expand All @@ -99,8 +107,16 @@ export default function handler(req: Request) {
});
}

// https://unpic.pics/og-edge
return new ImageResponse(renderTemplate(params));
try {
// https://unpic.pics/og-edge
return new ImageResponse(renderTemplate(params));
} catch (error) {
console.error("OG image generation failed:", error);
return new Response(JSON.stringify({ error: "image_generation_failed" }), {
status: 500,
headers: { "Content-Type": "application/json" },
});
}
}

// https://docs.netlify.com/build/edge-functions/declarations/#declare-edge-functions-inline
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/routes/_view/download/apple-silicon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { createFileRoute, redirect } from "@tanstack/react-router";
export const Route = createFileRoute("/_view/download/apple-silicon")({
beforeLoad: async () => {
throw redirect({
href: "https://desktop.hyprnote.com/download/latest/dmg-aarch64?channel=stable",
href: "https://desktop2.hyprnote.com/download/latest/dmg-aarch64?channel=nightly",
});
},
});
Loading