This commit is contained in:
dvelo 2025-05-04 23:48:51 -05:00
parent 76ebc94056
commit 53f7cdb171
2 changed files with 2 additions and 33 deletions

@ -555,21 +555,6 @@ export async function GET(
console.error("Failed to load fonts for error page:", e); console.error("Failed to load fonts for error page:", e);
} }
// Try to load the banner image
let bannerImageData: Buffer | null = null;
try {
const bannerPath = path.join(
process.cwd(),
"public",
"branding",
"dark-banner.png"
);
bannerImageData = fs.readFileSync(bannerPath);
} catch (e) {
// If banner image fails to load, use a solid color background
console.error("Failed to load banner image for error page:", e);
}
return new ImageResponse( return new ImageResponse(
( (
<div <div
@ -577,7 +562,6 @@ export async function GET(
display: "flex", display: "flex",
fontSize: 60, fontSize: 60,
color: "white", color: "white",
background: bannerImageData ? undefined : "#121212",
width: "100%", width: "100%",
height: "100%", height: "100%",
padding: "50px 50px", padding: "50px 50px",
@ -585,11 +569,7 @@ export async function GET(
justifyContent: "center", justifyContent: "center",
alignItems: "center", alignItems: "center",
fontFamily: "Inter", fontFamily: "Inter",
...(bannerImageData && { backgroundColor: "white"
backgroundImage: `url(data:image/png;base64,${bannerImageData.toString("base64")})`,
backgroundSize: "cover",
backgroundPosition: "center",
}),
}} }}
> >
<div <div

@ -154,7 +154,6 @@ export async function GET(
textAlign: "center", textAlign: "center",
justifyContent: "center", justifyContent: "center",
alignItems: "center", alignItems: "center",
backgroundImage: `url(${new URL("/branding/bg-banner.png", request.url).toString()})`,
backgroundSize: "cover", backgroundSize: "cover",
backgroundPosition: "center", backgroundPosition: "center",
fontFamily: "Inter", fontFamily: "Inter",
@ -422,16 +421,6 @@ export async function GET(
const [interRegular, interBold] = await loadFonts(); const [interRegular, interBold] = await loadFonts();
console.error("Error generating OG image:", error); console.error("Error generating OG image:", error);
// Try to load the banner image again in case it failed earlier
let bannerImageData: ArrayBuffer | undefined;
try {
bannerImageData = await fetch(
new URL("/branding/dark-banner.png", request.url)
).then((res) => res.arrayBuffer());
} catch (e) {
// If banner image fails to load, use a solid color background
console.error("Failed to load banner image for error page:", e);
}
return new ImageResponse( return new ImageResponse(
( (
@ -440,7 +429,7 @@ export async function GET(
display: "flex", display: "flex",
fontSize: 60, fontSize: 60,
color: "white", color: "white",
background: bannerImageData ? undefined : "#121212", background: "#121212",
width: "100%", width: "100%",
height: "100%", height: "100%",
padding: "50px 50px", padding: "50px 50px",