Route skins thru backend

This commit is contained in:
lukas
2026-03-24 17:08:45 +01:00
parent 56d0a92707
commit db4ab9cb0b
2 changed files with 14 additions and 1 deletions
+3 -1
View File
@@ -142,7 +142,9 @@
let cases: { when: string; model: { type: string; model: string } }[] = []; let cases: { when: string; model: { type: string; model: string } }[] = [];
for (const profile of data.data) { for (const profile of data.data) {
const image = await fetch(profile.MinecraftSkinData.skinUrl); const image = await fetch(
`/api/get-skin/${profile.MinecraftSkinData.skinUrl.split('texture/')[1]}`
);
const imageBlob = await image.blob(); const imageBlob = await image.blob();
texturesFolder.file(`${profile.MinecraftUsername}.png`, imageBlob); texturesFolder.file(`${profile.MinecraftUsername}.png`, imageBlob);
const { height } = await getImageDimensions(imageBlob); const { height } = await getImageDimensions(imageBlob);
+11
View File
@@ -0,0 +1,11 @@
export async function GET({ params }) {
const { id } = params;
const skinImage = await fetch(`http://textures.minecraft.net/texture/${id}`);
const skinBuffer = await skinImage.arrayBuffer();
const skinData = Buffer.from(skinBuffer);
return new Response(skinData, {
headers: {
'Content-Type': 'image/png'
}
});
}