mirror of
https://github.com/DeveloLongScript/MHSF.git
synced 2026-05-07 13:54:59 -05:00
Revert "fix: p.2"
This reverts commit 53f7cdb171ea2fab272108c3ee6b7e67d4b479ae.
This commit is contained in:
parent
53f7cdb171
commit
1a05e42996
@ -555,6 +555,21 @@ export async function GET(
|
||||
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(
|
||||
(
|
||||
<div
|
||||
@ -562,6 +577,7 @@ export async function GET(
|
||||
display: "flex",
|
||||
fontSize: 60,
|
||||
color: "white",
|
||||
background: bannerImageData ? undefined : "#121212",
|
||||
width: "100%",
|
||||
height: "100%",
|
||||
padding: "50px 50px",
|
||||
@ -569,7 +585,11 @@ export async function GET(
|
||||
justifyContent: "center",
|
||||
alignItems: "center",
|
||||
fontFamily: "Inter",
|
||||
backgroundColor: "white"
|
||||
...(bannerImageData && {
|
||||
backgroundImage: `url(data:image/png;base64,${bannerImageData.toString("base64")})`,
|
||||
backgroundSize: "cover",
|
||||
backgroundPosition: "center",
|
||||
}),
|
||||
}}
|
||||
>
|
||||
<div
|
||||
|
||||
@ -154,6 +154,7 @@ export async function GET(
|
||||
textAlign: "center",
|
||||
justifyContent: "center",
|
||||
alignItems: "center",
|
||||
backgroundImage: `url(${new URL("/branding/bg-banner.png", request.url).toString()})`,
|
||||
backgroundSize: "cover",
|
||||
backgroundPosition: "center",
|
||||
fontFamily: "Inter",
|
||||
@ -421,6 +422,16 @@ export async function GET(
|
||||
const [interRegular, interBold] = await loadFonts();
|
||||
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(
|
||||
(
|
||||
@ -429,7 +440,7 @@ export async function GET(
|
||||
display: "flex",
|
||||
fontSize: 60,
|
||||
color: "white",
|
||||
background: "#121212",
|
||||
background: bannerImageData ? undefined : "#121212",
|
||||
width: "100%",
|
||||
height: "100%",
|
||||
padding: "50px 50px",
|
||||
|
||||
Loading…
Reference in New Issue
Block a user