mirror of
https://github.com/DeveloLongScript/MHSF.git
synced 2026-05-07 16:05:00 -05:00
Revert "fix: remove medium to make endpoint smaller"
This reverts commit 7497ca7df1a58d101d451804789f722710519529.
This commit is contained in:
parent
7e806cd335
commit
275f236365
BIN
apps/www/src/app/api/og/fonts/Inter-Medium.ttf
Normal file
BIN
apps/www/src/app/api/og/fonts/Inter-Medium.ttf
Normal file
Binary file not shown.
@ -4,10 +4,13 @@ export async function loadFonts() {
|
||||
new URL("./Inter-Regular.ttf", import.meta.url)
|
||||
).then((res) => res.arrayBuffer());
|
||||
|
||||
const interMediumFontP = fetch(
|
||||
new URL("./Inter-Medium.ttf", import.meta.url)
|
||||
).then((res) => res.arrayBuffer());
|
||||
|
||||
const interBoldFontP = fetch(
|
||||
new URL("./Inter-Bold.ttf", import.meta.url)
|
||||
).then((res) => res.arrayBuffer());
|
||||
|
||||
return Promise.all([interRegularFontP, interBoldFontP]);
|
||||
return Promise.all([interRegularFontP, interMediumFontP, interBoldFontP]);
|
||||
}
|
||||
|
||||
@ -26,6 +26,7 @@ async function loadLocalFonts() {
|
||||
|
||||
return [
|
||||
fs.readFileSync(path.join(fontPath, "Inter-Regular.ttf")),
|
||||
fs.readFileSync(path.join(fontPath, "Inter-Medium.ttf")),
|
||||
fs.readFileSync(path.join(fontPath, "Inter-Bold.ttf")),
|
||||
];
|
||||
}
|
||||
@ -47,7 +48,7 @@ export async function GET(
|
||||
const id = (await params).id;
|
||||
|
||||
// Load fonts
|
||||
const [interRegular, interBold] = await loadLocalFonts();
|
||||
const [interRegular, interMedium, interBold] = await loadLocalFonts();
|
||||
|
||||
// Verify server exists
|
||||
const serverResponse = await fetch(`https://api.minehut.com/server/${id}`);
|
||||
@ -548,6 +549,12 @@ export async function GET(
|
||||
style: "normal",
|
||||
weight: 700,
|
||||
},
|
||||
{
|
||||
name: "Inter",
|
||||
data: interMedium,
|
||||
style: "normal",
|
||||
weight: 500,
|
||||
},
|
||||
],
|
||||
}
|
||||
);
|
||||
|
||||
@ -136,7 +136,7 @@ export async function GET(
|
||||
const id = (await params).id;
|
||||
|
||||
// Load fonts
|
||||
const [interRegular, interBold] = await loadFonts();
|
||||
const [interRegular, interMedium, interBold] = await loadFonts();
|
||||
|
||||
// Fetch server data
|
||||
const response = await fetch(`https://api.minehut.com/server/${id}`);
|
||||
@ -417,13 +417,18 @@ export async function GET(
|
||||
data: interBold,
|
||||
style: "normal",
|
||||
weight: 700,
|
||||
}
|
||||
|
||||
},
|
||||
{
|
||||
name: "Inter",
|
||||
data: interMedium,
|
||||
style: "normal",
|
||||
weight: 500,
|
||||
},
|
||||
],
|
||||
}
|
||||
);
|
||||
} catch (error) {
|
||||
const [interRegular, interBold] = await loadFonts();
|
||||
const [interRegular, interMedium, interBold] = await loadFonts();
|
||||
console.error("Error generating OG image:", error);
|
||||
|
||||
// Try to load the banner image again in case it failed earlier
|
||||
|
||||
Loading…
Reference in New Issue
Block a user