Upload via GUI (138 Dateien)

This commit is contained in:
2026-10-04 14:49:45 +00:00
parent 642d229d7e
commit 7e1fb616aa
2 changed files with 56 additions and 6 deletions
+36 -1
View File
@@ -141,4 +141,39 @@ async function setzeUmhang(accessToken, capeId) {
return { ok: true };
}
module.exports = { setzeSkin, setzeSkinZurueck, holeProfil, pruefeDatei, aufHttps, setzeUmhang };
/*
* Texturen, die andere Spieler im Spiel sehen (öffentliches Profil beim
* Sitzungsserver). Das kann vom Kontoprofil oben abweichen: Dort liefert
* Mojang bei manchen Konten einen Standard-Skin (z. B. Efe) als "ACTIVE",
* obwohl im Spiel längst ein eigener Skin getragen wird.
*/
async function holeSpielTexturen(uuid) {
const id = String(uuid || '').replace(/-/g, '').toLowerCase();
if (!/^[0-9a-f]{32}$/.test(id)) return null;
const res = await fetch('https://sessionserver.mojang.com/session/minecraft/profile/' + id, {
headers: { 'User-Agent': UA, Accept: 'application/json' },
});
if (!res.ok) return null;
const profil = await res.json();
const eigenschaft = (profil.properties || []).find((p) => p.name === 'textures');
if (!eigenschaft) return null;
const texturen = JSON.parse(Buffer.from(eigenschaft.value, 'base64').toString('utf8')).textures || {};
const skin = texturen.SKIN;
return {
skinUrl: skin && skin.url ? aufHttps(skin.url) : '',
variante: skin && skin.metadata && skin.metadata.model === 'slim' ? 'slim' : 'classic',
};
}
/*
* Welcher Skin wird als "aktuell" gezeigt? Grundsätzlich der aus dem Spiel –
* nur direkt nach einer eigenen Änderung das Kontoprofil, weil der
* Sitzungsserver dann noch kurz den alten Stand liefert.
*/
function waehleAnzeigeSkin(kontoProfil, spiel, kuerzlichGeaendert) {
if (!kontoProfil || !kontoProfil.ok || kuerzlichGeaendert) return kontoProfil;
if (!spiel || !spiel.skinUrl || spiel.skinUrl === kontoProfil.skinUrl) return kontoProfil;
return Object.assign({}, kontoProfil, { skinUrl: spiel.skinUrl, variante: spiel.variante, skinAusSpiel: true });
}
module.exports = { setzeSkin, setzeSkinZurueck, holeProfil, pruefeDatei, aufHttps, setzeUmhang, holeSpielTexturen, waehleAnzeigeSkin };