First Commit

This commit is contained in:
Arne van Iterson 2020-05-09 17:03:15 +02:00
commit 7737a2645f
7 changed files with 118 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
node_modules/

2
README.md Normal file
View File

@ -0,0 +1,2 @@
# ⇄ SkinSwitcher
Javascript UI for changing your Minecraft skin using the Mojang API

18
auth.js Normal file
View File

@ -0,0 +1,18 @@
const axios = require("axios").default;
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();

1
in.png Normal file
View File

@ -0,0 +1 @@
Unable to open this file -- only text documents are supported

39
index.js Normal file
View File

@ -0,0 +1,39 @@
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);
});
});

37
package-lock.json generated Normal file
View File

@ -0,0 +1,37 @@
{
"name": "skinswitcher",
"version": "1.0.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
"axios": {
"version": "0.19.2",
"resolved": "https://registry.npmjs.org/axios/-/axios-0.19.2.tgz",
"integrity": "sha512-fjgm5MvRHLhx+osE2xoekY70AhARk3a6hkN+3Io1jc00jtquGvxYlKlsFUhmUET0V5te6CcZI7lcv2Ym61mjHA==",
"requires": {
"follow-redirects": "1.5.10"
}
},
"debug": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz",
"integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==",
"requires": {
"ms": "2.0.0"
}
},
"follow-redirects": {
"version": "1.5.10",
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.5.10.tgz",
"integrity": "sha512-0V5l4Cizzvqt5D44aTXbFZz+FtyXV1vrDN6qrelxtfYQKW0KO0W2T/hkE8xvGa/540LkZlkaUjO4ailYTFtHVQ==",
"requires": {
"debug": "=3.1.0"
}
},
"ms": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
"integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g="
}
}
}

20
package.json Normal file
View File

@ -0,0 +1,20 @@
{
"name": "skinswitcher",
"version": "1.0.0",
"description": "Javascript UI for changing your Minecraft skin using the Mojang API",
"main": "index.js",
"scripts": {
"start": "node index.js"
},
"keywords": [],
"author": "Arne van Iterson",
"license": "ISC",
"dependencies": {
"axios": "^0.19.2"
},
"devDependencies": {},
"repository": {
"type": "git",
"url": "https://gitea.arnweb.nl/Hecc-inc./skinswitcher.git"
}
}