This commit is contained in:
biglyderv 2025-01-02 22:00:28 -05:00
parent c603bc8755
commit 9c2deb3dcb
2 changed files with 24 additions and 22 deletions

26
game.js
View file

@ -221,31 +221,33 @@ class Game extends GameBasic {
async authUser(ws, data) {
ws.token = data;
let f = new FormData();
f.append('token', ws.token);
let j = false;
let j = await fetch("https://bg.dervland.net/api/form/auth_api/",
try {
j = await fetch("https://nbg.dervland.net/auth.php",
{
"method": "post",
"body": f
"method": "get",
"headers": {
"cookie": `token=${data}`
}
}
);
j = await j.text();
try {
j = JSON.parse(j);
} catch (err) {
j = {};
j = false;
}
if (j.username == '!nobody' || !j.username) return;
j = j.replaceAll(/\s+/g,'');
if (this.ws.findIndex(x => x.username == j.username && x.ent.health > 0) != -1) {
console.log(`Player ${ws.ent.you} uses username ${j.username} illegally`)
if (!j || j == '') return;
if (this.ws.findIndex(x => x.username == j && x.ent.health > 0) != -1) {
console.log(`Player ${ws.ent.you} uses username ${j} illegally`)
return;
}
ws.ent.username = ws.username = j.username;
ws.ent.username = ws.username = j;
console.log(`Player ${ws.ent.you} uses username ${ws.username}`)
}

View file

@ -12,7 +12,7 @@
<p>The <b>left mouse button</b> is the only input. No keyboard, moving the mouse, or anything else.</p>
<p>Click to launch... figure out the rest of the combos yourself.</p>
<a class='button' href='https://dervland.net/'>Created by 08draven</a>
<a class='button' href='https://bg.dervland.net/client/login?redirect=https://ub.dervland.net/'>Log in</a>
<a class='button' href='https://nbg.dervland.net/login.php?next=https://ub.dervland.net/'>Log in</a>
<canvas id='canvas'></canvas>
</div>
</section>