Skip to content

Commit

Permalink
hotfix: Client bugs (#1137)
Browse files Browse the repository at this point in the history
  • Loading branch information
Pazaz authored Jan 28, 2025
2 parents 52341d6 + 6cd757c commit b92cd28
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 5 deletions.
4 changes: 2 additions & 2 deletions public/client/Client.js

Large diffs are not rendered by default.

15 changes: 14 additions & 1 deletion src/server/login/LoginServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,10 @@ export default class LoginServer {

const raw = Buffer.from(save, 'base64');
if (PlayerLoading.verify(new Packet(raw))) {
if (!fs.existsSync(`data/players/${profile}`)) {
fs.mkdirSync(`data/players/${profile}`, { recursive: true });
}

fs.writeFileSync(`data/players/${profile}/${username}.sav`, raw);
} else {
console.error(username, 'Invalid save file');
Expand All @@ -134,7 +138,16 @@ export default class LoginServer {
} else if (type === 'player_autosave') {
const { username, save } = msg;

fs.writeFileSync(`data/players/${profile}/${username}.sav`, Buffer.from(save, 'base64'));
const raw = Buffer.from(save, 'base64');
if (PlayerLoading.verify(new Packet(raw))) {
if (!fs.existsSync(`data/players/${profile}`)) {
fs.mkdirSync(`data/players/${profile}`, { recursive: true });
}

fs.writeFileSync(`data/players/${profile}/${username}.sav`, raw);
} else {
console.error(username, 'Invalid save file');
}
} else if (type === 'player_force_logout') {
const { username } = msg;

Expand Down
4 changes: 2 additions & 2 deletions view/client.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@
margin-left: auto;
margin-right: auto;
display: block;
width: 789px;
height: 532px;
}
canvas {
width: 789px;
height: 532px;
/* touch-action: none; */
-webkit-touch-callout: none;
-webkit-user-select: none;
Expand Down

0 comments on commit b92cd28

Please sign in to comment.