39 lines
799 B
JavaScript
39 lines
799 B
JavaScript
const axios = require("axios").default;
|
|
const fs = require("fs");
|
|
const { PNG } = require("pngjs");
|
|
|
|
var payload = {
|
|
"agent": {
|
|
"name": "Minecraft",
|
|
"version": 1
|
|
},
|
|
"username": "aardtaart1@gmail.com",
|
|
"password": "IHVpep11!"
|
|
}
|
|
|
|
//payload = JSON.stringify(payload);
|
|
|
|
axios({
|
|
method: "POST",
|
|
url: "https://authserver.mojang.com/authenticate",
|
|
data: payload,
|
|
}).then((data) => {
|
|
|
|
fs.createReadStream("in.png")
|
|
.pipe(
|
|
new PNG({
|
|
filterType: 4,
|
|
})
|
|
)
|
|
.on("parsed", (image) => {
|
|
axios({
|
|
method: "PUT",
|
|
url: `https://api.mojang.com/user/profile/${data.data.selectedProfile.id}/skin`,
|
|
data: {
|
|
model: "",
|
|
file: image
|
|
},
|
|
headers: {"Authorization": "Bearer " + data.data.accessToken}
|
|
}).catch(console.log);
|
|
});
|
|
}); |