Skip to content

Commit

Permalink
checkVIP + mc username on home
Browse files Browse the repository at this point in the history
  • Loading branch information
LeWarpy committed Oct 18, 2023
1 parent fb7673b commit cba2088
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 15 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "launcher",
"preductname": "Almyria Launcher",
"version": "1.0.8",
"version": "1.0.9",
"description": "Launcher pour le serveur AlmyriaCraft",
"main": "src/app.js",
"author": "Luuxis, LeWarpy <coucou@lewarpy.fr",
Expand Down
18 changes: 18 additions & 0 deletions src/assets/css/panels/home.css
Original file line number Diff line number Diff line change
Expand Up @@ -320,4 +320,22 @@
.center {
display: table-cell;
vertical-align: middle;
}

.player-info {
position: absolute;
font: normal normal bold 17px/25px Roboto;
color: #E1E1E1;
top: 22px;
left: 90px;
transition: color .2s;
}

.player-username {
position: absolute;
font: normal normal bold 17px/25px Roboto;
color: #E1E1E1;
top: 22px;
left: 90px;
transition: color .2s;
}
9 changes: 6 additions & 3 deletions src/assets/js/launcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,14 @@ class Launcher {
this.createPanels(Login, Home, Settings);
this.getaccounts();
} else if (this.launcher == 2) {
console.log("Launcher is on staff only");
console.log("Launcher is on staff only mode");
let staff = await config.GetStaffUsernames().then(res => res);
let username = (await this.database.getAll('accounts'))[0]?.value?.uuid;
console.log(username);
if (staff.includes(username)) {
if (username === undefined) {
this.createPanels(Login, Home, Settings);
document.querySelector(".preload-content").style.display = "none";
changePanel("login");
} else if (staff.includes(username)) {
this.createPanels(Login, Home, Settings);
this.getaccounts();
} else {
Expand Down
28 changes: 19 additions & 9 deletions src/assets/js/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,24 @@ function accountSelect(uuid) {
headplayer(pseudo, uuid);
}

function headplayer(pseudo, uuid) {
async function isVIP(uuid) {
try {
const { data: response } = await axios.get(`https://api.almyria.fr/minecraft/checkvip/` + uuid);
return response;
} catch (error) {
console.log(error);
}
}

async function headplayer(pseudo, uuid) {
document.querySelector(".player-head").style.backgroundImage = `url(https://minotar.net/helm/${pseudo}/100)`;
//Add border to the head
axios.get(`https://api.almyria.fr/minecraft/checkvip/` + uuid).then(res => {
if (res.data == true) {
document.querySelector(".player-head").style.border = "3px solid gold";
} else {
document.querySelector(".player-head").style.border = "2px solid #ffffff";
}
})
document.querySelector(".player-username").textContent = pseudo;

const checkVIP = await isVIP(uuid);

if (checkVIP == true) {
document.querySelector(".player-head").style.border = "3px solid gold";
} else {
document.querySelector(".player-head").style.border = "2px solid #ffffff";
}
}
2 changes: 2 additions & 0 deletions src/panels/home.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
<div class="home-content">
<div class="bottom-bar-home">
<button class="player-head"></button>
<div class="player-username">Pseudo</div>

<button class="settings-btn icon-settings"></button>

<div class="play-element">
Expand Down

0 comments on commit cba2088

Please sign in to comment.