Fix getGameList, testChrome without checkLogin

pull/4095/head
Louis Lam 1 year ago
parent afaa7bb2f0
commit b689733d59

@ -42,24 +42,40 @@ module.exports.generalSocketHandler = (socket, server) => {
}); });
socket.on("getGameList", async (callback) => { socket.on("getGameList", async (callback) => {
callback({ try {
ok: true, checkLogin(socket);
gameList: getGameList(),
});
});
socket.on("testChrome", (executable, callback) => {
// Just noticed that await call could block the whole socket.io server!!! Use pure promise instead.
testChrome(executable).then((version) => {
callback({ callback({
ok: true, ok: true,
msg: "Found Chromium/Chrome. Version: " + version, gameList: getGameList(),
}); });
}).catch((e) => { } catch (e) {
callback({ callback({
ok: false, ok: false,
msg: e.message, msg: e.message,
})
}
});
socket.on("testChrome", (executable, callback) => {
try {
checkLogin(socket);
// Just noticed that await call could block the whole socket.io server!!! Use pure promise instead.
testChrome(executable).then((version) => {
callback({
ok: true,
msg: "Found Chromium/Chrome. Version: " + version,
});
}).catch((e) => {
callback({
ok: false,
msg: e.message,
});
}); });
}); } catch (e) {
callback({
ok: false,
msg: e.message,
})
}
}); });
}; };

Loading…
Cancel
Save