Fix getGameList, testChrome without checkLogin

This commit is contained in:
Louis Lam 2023-11-24 16:37:52 +08:00
parent afaa7bb2f0
commit b689733d59

View file

@ -42,13 +42,23 @@ module.exports.generalSocketHandler = (socket, server) => {
});
socket.on("getGameList", async (callback) => {
try {
checkLogin(socket);
callback({
ok: true,
gameList: getGameList(),
});
} catch (e) {
callback({
ok: false,
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({
@ -61,5 +71,11 @@ module.exports.generalSocketHandler = (socket, server) => {
msg: e.message,
});
});
} catch (e) {
callback({
ok: false,
msg: e.message,
})
}
});
};