mirror of
https://github.com/louislam/uptime-kuma.git
synced 2024-11-23 23:04:04 +00:00
Fix getGameList, testChrome without checkLogin
This commit is contained in:
parent
afaa7bb2f0
commit
b689733d59
1 changed files with 28 additions and 12 deletions
|
@ -42,13 +42,23 @@ module.exports.generalSocketHandler = (socket, server) => {
|
||||||
});
|
});
|
||||||
|
|
||||||
socket.on("getGameList", async (callback) => {
|
socket.on("getGameList", async (callback) => {
|
||||||
|
try {
|
||||||
|
checkLogin(socket);
|
||||||
callback({
|
callback({
|
||||||
ok: true,
|
ok: true,
|
||||||
gameList: getGameList(),
|
gameList: getGameList(),
|
||||||
});
|
});
|
||||||
|
} catch (e) {
|
||||||
|
callback({
|
||||||
|
ok: false,
|
||||||
|
msg: e.message,
|
||||||
|
})
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
socket.on("testChrome", (executable, callback) => {
|
socket.on("testChrome", (executable, callback) => {
|
||||||
|
try {
|
||||||
|
checkLogin(socket);
|
||||||
// Just noticed that await call could block the whole socket.io server!!! Use pure promise instead.
|
// Just noticed that await call could block the whole socket.io server!!! Use pure promise instead.
|
||||||
testChrome(executable).then((version) => {
|
testChrome(executable).then((version) => {
|
||||||
callback({
|
callback({
|
||||||
|
@ -61,5 +71,11 @@ module.exports.generalSocketHandler = (socket, server) => {
|
||||||
msg: e.message,
|
msg: e.message,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
} catch (e) {
|
||||||
|
callback({
|
||||||
|
ok: false,
|
||||||
|
msg: e.message,
|
||||||
|
})
|
||||||
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue