[Scummvm-git-logs] scummvm-sites multiplayer -> 92958c88d9764f864d12f8305165e7bdde910380
LittleToonCat
noreply at scummvm.org
Fri Nov 3 00:04:34 UTC 2023
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm-sites' repo located at https://github.com/scummvm/scummvm-sites .
Summary:
92958c88d9 MULTIPLAYER: Filter out empty strings on version parsing.
Commit: 92958c88d9764f864d12f8305165e7bdde910380
https://github.com/scummvm/scummvm-sites/commit/92958c88d9764f864d12f8305165e7bdde910380
Author: Little Cat (toontownlittlecat at gmail.com)
Date: 2023-11-02T21:04:24-03:00
Commit Message:
MULTIPLAYER: Filter out empty strings on version parsing.
This fixes logging in when using builds with single digit days.
Changed paths:
lobby/net/DatabaseMessages.js
diff --git a/lobby/net/DatabaseMessages.js b/lobby/net/DatabaseMessages.js
index e6d7370..7e8bb0d 100644
--- a/lobby/net/DatabaseMessages.js
+++ b/lobby/net/DatabaseMessages.js
@@ -62,7 +62,7 @@ server.handleMessage("login", async (client, args) => {
// This code parses the ScummVM version string sent by the client.
// e.g. ScummVM 2.8.0git-{revision} (Oct 21 2023 19:11:48)
- const versionArray = version.split(" ");
+ const versionArray = version.split(" ").filter((str) => str !== '');
if (versionArray[0] != "ScummVM") {
client.send("login_resp", {error_code: 1,
id: 0,
@@ -91,6 +91,7 @@ server.handleMessage("login", async (client, args) => {
// Parse version date and check against the timestamp in the config.
// The substr call is to remove the first bracket from the date string.
+ console.log(`${versionArray[2].substr(1)} ${versionArray[3]} ${versionArray[4]} UTC`)
const clientTimestamp = Date.parse(`${versionArray[2].substr(1)} ${versionArray[3]} ${versionArray[4]} UTC`);
const serverTimestamp = Date.parse(server.versionRestrictions[client.versionNumber])
@@ -187,6 +188,28 @@ server.handleMessage('set_icon', async (client, args) => {
await database.setIcon(client.userId, icon);
});
+server.handleMessage('set_poll_answer', async (client, args) => {
+ const answer = args.answer;
+ logEvent('set_poll_answer', client, args.version, {'answer': answer});
+
+ if (client.userId == 0) {
+ client.kick("Attempting to answer poll without logging in first.");
+ return;
+ } else if (answer === undefined) {
+ logger.warn("Got set_poll_answer with missing answer! Ignoring.");
+ return;
+ }
+
+ const user = await redis.getUserById(client.userId, client.game);
+ const stats = Stats.ProfileMappers[client.game](user.stats);
+ if (!stats.hasOwnProperty('poll')) {
+ logger.warn(`Stats for user id ${client.userId} has no poll stat for game ${client.game}! Ignoring.`);
+ return;
+ }
+ stats['poll'] = answer;
+ await database.setStats(client.userId, Object.values(stats), client.game);
+});
+
server.handleMessage('locate_player', async (client, args) => {
const username = args.user;
if (client.userId == 0) {
More information about the Scummvm-git-logs
mailing list