skinswitcher/html/partials/profile.html

50 lines
1.7 KiB
HTML
Raw Normal View History

<h1 class="title">Profile</h1>
<div class="columns is-mobile">
<div class="column">
<img src="" class="skin" id="flat" alt="Current Skin" style="display: none;">
2021-09-06 19:40:51 +02:00
<div id="mesh"></div>
</div>
<div class="column">
<article class="message is-info">
<div class="message-body" id="profile"></div>
</article>
<div class="buttons">
<a class="button" href="/partials/edit.html" id="edit">Edit</a>
</div>
<div class="buttons has-addons">
<button class="button" id="download">Download</button>
<button class="button" id="save">Save</button>
</div>
<div class="buttons">
<button class="button" id="switch" style="display: none;">Switch to 2D</button>
<button class="button is-danger" id="logout">Logout</button>
</div>
</div>
</div>
<script src="../src/skin.js"></script>
<script>
axios({
method: "GET",
url: "https://sessionserver.mojang.com/session/minecraft/profile/" + api.profile.id
}).then((data) => {
var result = JSON.parse(atob(data.data.properties[0].value));
var model = result.textures.SKIN.metadata.model;
$("div#profile").html(`
Username: ${result.profileName} <br>
Skin type: ${model.substr(0,1).toUpperCase() + model.substr(1)}
`);
setView(result.textures.SKIN.url);
});
$("button#logout").on("click", () => {
api.invalidate(
settings.accessToken
).then((res) => {
settings.accessToken = "";
save();
load("/partials/auth.html");
});
});
</script>