1
0
mirror of https://github.com/louislam/uptime-kuma.git synced 2024-12-24 22:14:47 +02:00

improve uptime calculation

This commit is contained in:
LouisLam 2021-07-06 14:30:10 +08:00
parent ea1556ef81
commit 04ec91d7a9

View File

@ -9,6 +9,7 @@ const {R} = require("redbean-node");
const passwordHash = require('password-hash');
const jwt = require('jsonwebtoken');
const Monitor = require("./model/monitor");
const {getSettings} = require("./util-server");
let totalClient = 0;
let jwtSecret = null;
@ -23,7 +24,7 @@ let monitorList = {};
await initDatabase();
app.use('/', express.static("public"));
app.use('/', express.static("dist"));
io.on('connection', async (socket) => {
console.log('a user connected');
@ -298,6 +299,25 @@ let monitorList = {};
});
}
});
socket.on("getSettings", async (type, callback) => {
try {
checkLogin(socket)
callback({
ok: true,
data: await getSettings(type),
});
} catch (e) {
callback({
ok: false,
msg: e.message
});
}
});
});
server.listen(3001, () => {