Made sure that more of the async usages are awaited (#4574)

This commit is contained in:
Frank Elsinga 2024-03-15 15:02:55 +01:00 committed by GitHub
parent a9a1cf1353
commit 0e3b3a9ab8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
19 changed files with 53 additions and 53 deletions

View file

@ -294,7 +294,7 @@ let needSetup = false;
log.debug("server", "Adding socket handler");
io.on("connection", async (socket) => {
sendInfo(socket, true);
await sendInfo(socket, true);
if (needSetup) {
log.info("server", "Redirect to setup page");
@ -326,7 +326,7 @@ let needSetup = false;
}
log.debug("auth", "afterLogin");
afterLogin(socket, user);
await afterLogin(socket, user);
log.debug("auth", "afterLogin ok");
log.info("auth", `Successfully logged in user ${decoded.username}. IP=${clientIP}`);
@ -382,7 +382,7 @@ let needSetup = false;
if (user) {
if (user.twofa_status === 0) {
afterLogin(socket, user);
await afterLogin(socket, user);
log.info("auth", `Successfully logged in user ${data.username}. IP=${clientIP}`);
@ -405,7 +405,7 @@ let needSetup = false;
let verify = notp.totp.verify(data.token, user.twofa_secret, twoFAVerifyOptions);
if (user.twofa_last_token !== data.token && verify) {
afterLogin(socket, user);
await afterLogin(socket, user);
await R.exec("UPDATE `user` SET twofa_last_token = ? WHERE id = ? ", [
data.token,
@ -1351,8 +1351,8 @@ let needSetup = false;
msgi18n: true,
});
sendInfo(socket);
server.sendMaintenanceList(socket);
await sendInfo(socket);
await server.sendMaintenanceList(socket);
} catch (e) {
callback({
@ -1532,7 +1532,7 @@ let needSetup = false;
log.debug("auth", "check auto login");
if (await setting("disableAuth")) {
log.info("auth", "Disabled Auth: auto login to admin");
afterLogin(socket, await R.findOne("user"));
await afterLogin(socket, await R.findOne("user"));
socket.emit("autoLogin");
} else {
log.debug("auth", "need auth");
@ -1548,7 +1548,7 @@ let needSetup = false;
process.exit(1);
});
server.start();
await server.start();
server.httpServer.listen(port, hostname, () => {
if (hostname) {
@ -1619,13 +1619,13 @@ async function afterLogin(socket, user) {
socket.join(user.id);
let monitorList = await server.sendMonitorList(socket);
sendInfo(socket);
server.sendMaintenanceList(socket);
sendNotificationList(socket);
sendProxyList(socket);
sendDockerHostList(socket);
sendAPIKeyList(socket);
sendRemoteBrowserList(socket);
await sendInfo(socket);
await server.sendMaintenanceList(socket);
await sendNotificationList(socket);
await sendProxyList(socket);
await sendDockerHostList(socket);
await sendAPIKeyList(socket);
await sendRemoteBrowserList(socket);
await sleep(500);