Revert "fix: don't load banner locally"

This reverts commit b35f04020d318b67908fe1723a66be0b2b6e8716.
This commit is contained in:
dvelo 2025-05-05 20:19:01 -05:00
parent 17dbc9e751
commit 7e806cd335
2 changed files with 16 additions and 4 deletions

@ -35,6 +35,14 @@ export async function GET(
{ params }: { params: Promise<{ id: string }> } { params }: { params: Promise<{ id: string }> }
) { ) {
try { try {
// Load banner image from filesystem
const bannerPath = path.join(
process.cwd(),
"public",
"branding",
"bg-banner.png"
);
const bannerImageData = fs.readFileSync(bannerPath);
const id = (await params).id; const id = (await params).id;
@ -60,7 +68,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()})`, backgroundImage: `url(data:image/png;base64,${bannerImageData.toString("base64")})`,
backgroundSize: "cover", backgroundSize: "cover",
backgroundPosition: "center", backgroundPosition: "center",
fontFamily: "Inter", fontFamily: "Inter",
@ -248,7 +256,7 @@ export async function GET(
position: "relative", position: "relative",
overflow: "hidden", overflow: "hidden",
fontFamily: "Inter", fontFamily: "Inter",
backgroundImage: `url(${new URL("/branding/bg-banner.png", request.url).toString()})`, backgroundImage: `url(data:image/png;base64,${bannerImageData.toString("base64")})`,
backgroundSize: "cover", backgroundSize: "cover",
backgroundPosition: "center", backgroundPosition: "center",
}} }}

@ -128,6 +128,10 @@ export async function GET(
{ params }: { params: Promise<{ id: string }> } { params }: { params: Promise<{ id: string }> }
) { ) {
try { try {
// Load banner image
const bannerImageData = await fetch(
new URL("/branding/bg-banner.png", request.url)
).then((res) => res.arrayBuffer());
const id = (await params).id; const id = (await params).id;
@ -154,7 +158,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()})`, backgroundImage: `url(data:image/png;base64,${Buffer.from(bannerImageData).toString("base64")})`,
backgroundSize: "cover", backgroundSize: "cover",
backgroundPosition: "center", backgroundPosition: "center",
fontFamily: "Inter", fontFamily: "Inter",
@ -222,7 +226,7 @@ export async function GET(
position: "relative", position: "relative",
overflow: "hidden", overflow: "hidden",
fontFamily: "Inter", fontFamily: "Inter",
backgroundImage: `url(${new URL("/branding/bg-banner.png", request.url).toString()})`, backgroundImage: `url(data:image/png;base64,${Buffer.from(bannerImageData).toString("base64")})`,
backgroundSize: "cover", backgroundSize: "cover",
backgroundPosition: "center", backgroundPosition: "center",
}} }}