mirror of
https://github.com/lukasabbe/skin-pack-website.git
synced 2026-04-30 10:50:52 +00:00
Route skins thru backend
This commit is contained in:
@@ -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);
|
||||||
|
|||||||
@@ -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'
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user