mirror of
https://github.com/louislam/uptime-kuma.git
synced 2024-11-23 14:54:05 +00:00
improve uptime calculation
This commit is contained in:
parent
ea1556ef81
commit
04ec91d7a9
1 changed files with 21 additions and 1 deletions
|
@ -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, () => {
|
||||
|
|
Loading…
Reference in a new issue