mirror of
https://github.com/koichixD/uptime-kuma.git
synced 2026-09-04 17:23:21 +00:00
chore: enable formatting over the entire codebase in CI (#6655)
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
This commit is contained in:
co-authored by
autofix-ci[bot]
parent
6658f2ce41
commit
0f61d7ee1b
+41
-43
@@ -19,14 +19,12 @@ async function sendNotificationList(socket) {
|
||||
const timeLogger = new TimeLogger();
|
||||
|
||||
let result = [];
|
||||
let list = await R.find("notification", " user_id = ? ", [
|
||||
socket.userID,
|
||||
]);
|
||||
let list = await R.find("notification", " user_id = ? ", [socket.userID]);
|
||||
|
||||
for (let bean of list) {
|
||||
let notificationObject = bean.export();
|
||||
notificationObject.isDefault = (notificationObject.isDefault === 1);
|
||||
notificationObject.active = (notificationObject.active === 1);
|
||||
notificationObject.isDefault = notificationObject.isDefault === 1;
|
||||
notificationObject.active = notificationObject.active === 1;
|
||||
result.push(notificationObject);
|
||||
}
|
||||
|
||||
@@ -46,14 +44,15 @@ async function sendNotificationList(socket) {
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
async function sendHeartbeatList(socket, monitorID, toUser = false, overwrite = false) {
|
||||
let list = await R.getAll(`
|
||||
let list = await R.getAll(
|
||||
`
|
||||
SELECT * FROM heartbeat
|
||||
WHERE monitor_id = ?
|
||||
ORDER BY time DESC
|
||||
LIMIT 100
|
||||
`, [
|
||||
monitorID,
|
||||
]);
|
||||
`,
|
||||
[monitorID]
|
||||
);
|
||||
|
||||
let result = list.reverse();
|
||||
|
||||
@@ -75,14 +74,16 @@ async function sendHeartbeatList(socket, monitorID, toUser = false, overwrite =
|
||||
async function sendImportantHeartbeatList(socket, monitorID, toUser = false, overwrite = false) {
|
||||
const timeLogger = new TimeLogger();
|
||||
|
||||
let list = await R.find("heartbeat", `
|
||||
let list = await R.find(
|
||||
"heartbeat",
|
||||
`
|
||||
monitor_id = ?
|
||||
AND important = 1
|
||||
ORDER BY time DESC
|
||||
LIMIT 500
|
||||
`, [
|
||||
monitorID,
|
||||
]);
|
||||
`,
|
||||
[monitorID]
|
||||
);
|
||||
|
||||
timeLogger.print(`[Monitor: ${monitorID}] sendImportantHeartbeatList`);
|
||||
|
||||
@@ -91,7 +92,6 @@ async function sendImportantHeartbeatList(socket, monitorID, toUser = false, ove
|
||||
} else {
|
||||
socket.emit("importantHeartbeatList", monitorID, list, overwrite);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -102,8 +102,11 @@ async function sendImportantHeartbeatList(socket, monitorID, toUser = false, ove
|
||||
async function sendProxyList(socket) {
|
||||
const timeLogger = new TimeLogger();
|
||||
|
||||
const list = await R.find("proxy", " user_id = ? ", [ socket.userID ]);
|
||||
io.to(socket.userID).emit("proxyList", list.map(bean => bean.export()));
|
||||
const list = await R.find("proxy", " user_id = ? ", [socket.userID]);
|
||||
io.to(socket.userID).emit(
|
||||
"proxyList",
|
||||
list.map((bean) => bean.export())
|
||||
);
|
||||
|
||||
timeLogger.print("Send Proxy List");
|
||||
|
||||
@@ -119,11 +122,7 @@ async function sendAPIKeyList(socket) {
|
||||
const timeLogger = new TimeLogger();
|
||||
|
||||
let result = [];
|
||||
const list = await R.find(
|
||||
"api_key",
|
||||
"user_id=?",
|
||||
[ socket.userID ],
|
||||
);
|
||||
const list = await R.find("api_key", "user_id=?", [socket.userID]);
|
||||
|
||||
for (let bean of list) {
|
||||
result.push(bean.toPublicJSON());
|
||||
@@ -150,7 +149,7 @@ async function sendInfo(socket, hideVersion = false) {
|
||||
if (!hideVersion) {
|
||||
info.version = checkVersion.version;
|
||||
info.latestVersion = checkVersion.latestVersion;
|
||||
info.isContainer = (process.env.UPTIME_KUMA_IS_CONTAINER === "1");
|
||||
info.isContainer = process.env.UPTIME_KUMA_IS_CONTAINER === "1";
|
||||
info.dbType = Database.dbConfig.type;
|
||||
info.runtime = {
|
||||
platform: process.platform, // linux or win32
|
||||
@@ -170,9 +169,7 @@ async function sendDockerHostList(socket) {
|
||||
const timeLogger = new TimeLogger();
|
||||
|
||||
let result = [];
|
||||
let list = await R.find("docker_host", " user_id = ? ", [
|
||||
socket.userID,
|
||||
]);
|
||||
let list = await R.find("docker_host", " user_id = ? ", [socket.userID]);
|
||||
|
||||
for (let bean of list) {
|
||||
result.push(bean.toJSON());
|
||||
@@ -194,9 +191,7 @@ async function sendRemoteBrowserList(socket) {
|
||||
const timeLogger = new TimeLogger();
|
||||
|
||||
let result = [];
|
||||
let list = await R.find("remote_browser", " user_id = ? ", [
|
||||
socket.userID,
|
||||
]);
|
||||
let list = await R.find("remote_browser", " user_id = ? ", [socket.userID]);
|
||||
|
||||
for (let bean of list) {
|
||||
result.push(bean.toJSON());
|
||||
@@ -215,21 +210,24 @@ async function sendRemoteBrowserList(socket) {
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
async function sendMonitorTypeList(socket) {
|
||||
const result = Object.entries(UptimeKumaServer.monitorTypeList).map(([ key, type ]) => {
|
||||
return [ key, {
|
||||
supportsConditions: type.supportsConditions,
|
||||
conditionVariables: type.conditionVariables.map(v => {
|
||||
return {
|
||||
id: v.id,
|
||||
operators: v.operators.map(o => {
|
||||
return {
|
||||
id: o.id,
|
||||
caption: o.caption,
|
||||
};
|
||||
}),
|
||||
};
|
||||
}),
|
||||
}];
|
||||
const result = Object.entries(UptimeKumaServer.monitorTypeList).map(([key, type]) => {
|
||||
return [
|
||||
key,
|
||||
{
|
||||
supportsConditions: type.supportsConditions,
|
||||
conditionVariables: type.conditionVariables.map((v) => {
|
||||
return {
|
||||
id: v.id,
|
||||
operators: v.operators.map((o) => {
|
||||
return {
|
||||
id: o.id,
|
||||
caption: o.caption,
|
||||
};
|
||||
}),
|
||||
};
|
||||
}),
|
||||
},
|
||||
];
|
||||
});
|
||||
|
||||
io.to(socket.userID).emit("monitorTypeList", Object.fromEntries(result));
|
||||
|
||||
Reference in New Issue
Block a user