Revert "fix: p.2"

This reverts commit 53f7cdb171ea2fab272108c3ee6b7e67d4b479ae.
This commit is contained in:
dvelo 2025-05-05 20:18:57 -05:00
parent 53f7cdb171
commit 1a05e42996
2 changed files with 33 additions and 2 deletions

@ -555,6 +555,21 @@ 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
@ -562,6 +577,7 @@ 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",
@ -569,7 +585,11 @@ export async function GET(
justifyContent: "center", justifyContent: "center",
alignItems: "center", alignItems: "center",
fontFamily: "Inter", fontFamily: "Inter",
backgroundColor: "white" ...(bannerImageData && {
backgroundImage: `url(data:image/png;base64,${bannerImageData.toString("base64")})`,
backgroundSize: "cover",
backgroundPosition: "center",
}),
}} }}
> >
<div <div

@ -154,6 +154,7 @@ 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",
@ -421,6 +422,16 @@ 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(
( (
@ -429,7 +440,7 @@ export async function GET(
display: "flex", display: "flex",
fontSize: 60, fontSize: 60,
color: "white", color: "white",
background: "#121212", background: bannerImageData ? undefined : "#121212",
width: "100%", width: "100%",
height: "100%", height: "100%",
padding: "50px 50px", padding: "50px 50px",