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