Resolve log message null reference

pull/910/head
Louis Lam 3 years ago
parent 9ec29c1bc4
commit 94770cf865

@ -124,7 +124,7 @@ router.get("/api/status-page/:slug", cache("5 minutes"), async (request, respons
// Public Group List // Public Group List
const publicGroupList = []; const publicGroupList = [];
const showTags = !!statusPage.show_tags; const showTags = !!statusPage.show_tags;
debug("Show Tags???" + showTags);
const list = await R.find("group", " public = 1 AND status_page_id = ? ORDER BY weight ", [ const list = await R.find("group", " public = 1 AND status_page_id = ? ORDER BY weight ", [
statusPage.id statusPage.id
]); ]);

@ -11,7 +11,7 @@ if (nodeVersion < requiredVersion) {
} }
const args = require("args-parser")(process.argv); const args = require("args-parser")(process.argv);
const { sleep, log_info, log_debug, log_error, log_warn, getRandomInt, genSecret } = require("../src/util"); const { sleep, log_info, log_debug, log_error, log_warn, getRandomInt, genSecret, debug } = require("../src/util");
const config = require("./config"); const config = require("./config");
log_info("server", "Welcome to Uptime Kuma"); log_info("server", "Welcome to Uptime Kuma");
@ -84,7 +84,7 @@ Notification.init();
log_debug("server", "Importing Proxy"); log_debug("server", "Importing Proxy");
const { Proxy } = require("./proxy"); const { Proxy } = require("./proxy");
debug("Importing Database"); log_debug("server", "Importing Database");
const Database = require("./database"); const Database = require("./database");
log_debug("server", "Importing Background Jobs"); log_debug("server", "Importing Background Jobs");
@ -326,7 +326,7 @@ try {
} }
} catch (error) { } catch (error) {
log_error("auth", `Invalid token for user ${decoded.username}. IP=${getClientIp(socket)}`); log_error("auth", `Invalid token. IP=${getClientIp(socket)}`);
callback({ callback({
ok: false, ok: false,
@ -494,7 +494,7 @@ try {
socket.userID, socket.userID,
]); ]);
log_info("auth", `Saved 2FA token for user ${data.username}. IP=${getClientIp(socket)}`); log_info("auth", `Saved 2FA token. IP=${getClientIp(socket)}`);
callback({ callback({
ok: true, ok: true,
@ -502,7 +502,7 @@ try {
}); });
} catch (error) { } catch (error) {
log_error("auth", `Error changing 2FA token for user ${data.username}. IP=${getClientIp(socket)}`); log_error("auth", `Error changing 2FA token. IP=${getClientIp(socket)}`);
callback({ callback({
ok: false, ok: false,
@ -521,7 +521,7 @@ try {
await doubleCheckPassword(socket, currentPassword); await doubleCheckPassword(socket, currentPassword);
await TwoFA.disable2FA(socket.userID); await TwoFA.disable2FA(socket.userID);
log_info("auth", `Disabled 2FA token for user ${data.username}. IP=${getClientIp(socket)}`); log_info("auth", `Disabled 2FA token. IP=${getClientIp(socket)}`);
callback({ callback({
ok: true, ok: true,
@ -529,7 +529,7 @@ try {
}); });
} catch (error) { } catch (error) {
log_error("auth", `Error disabling 2FA token for user ${data.username}. IP=${getClientIp(socket)}`); log_error("auth", `Error disabling 2FA token. IP=${getClientIp(socket)}`);
callback({ callback({
ok: false, ok: false,
@ -657,7 +657,7 @@ try {
await server.sendMonitorList(socket); await server.sendMonitorList(socket);
await startMonitor(socket.userID, bean.id); await startMonitor(socket.userID, bean.id);
log_info("monitor", `Added Monitor: ${monitorID} User ID: ${socket.userID}`); log_info("monitor", `Added Monitor: ${monitor.id} User ID: ${socket.userID}`);
callback({ callback({
ok: true, ok: true,
@ -667,7 +667,7 @@ try {
} catch (e) { } catch (e) {
log_error("monitor", `Error adding Monitor: ${monitorID} User ID: ${socket.userID}`); log_error("monitor", `Error adding Monitor: ${monitor.id} User ID: ${socket.userID}`);
callback({ callback({
ok: false, ok: false,
@ -1672,7 +1672,7 @@ async function shutdownFunction(signal) {
} }
function getClientIp(socket) { function getClientIp(socket) {
return socket.client.conn.remoteAddress.replace(/^.*:/, "") return socket.client.conn.remoteAddress.replace(/^.*:/, "");
} }
function finalFunction() { function finalFunction() {

Loading…
Cancel
Save