From 179ca232bc85d6a7a0bbedc05d10be5f6e6a003e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ivan=20Bratovi=C4=87?= Date: Thu, 4 Nov 2021 10:12:06 +0100 Subject: [PATCH] Minor refactor - change variable names and add commas to object definitions --- ...-basicauth.sql => patch-monitor-basic-auth.sql} | 4 ++-- server/database.js | 2 +- server/model/monitor.js | 14 +++++++------- server/server.js | 8 ++++---- src/pages/EditMonitor.vue | 4 ++-- 5 files changed, 16 insertions(+), 16 deletions(-) rename db/{patch-monitor-basicauth.sql => patch-monitor-basic-auth.sql} (66%) diff --git a/db/patch-monitor-basicauth.sql b/db/patch-monitor-basic-auth.sql similarity index 66% rename from db/patch-monitor-basicauth.sql rename to db/patch-monitor-basic-auth.sql index 3a33350d7..de4bdefd9 100644 --- a/db/patch-monitor-basicauth.sql +++ b/db/patch-monitor-basic-auth.sql @@ -2,9 +2,9 @@ BEGIN TRANSACTION; ALTER TABLE monitor - ADD basicauth_user TEXT default null; + ADD basic_auth_user TEXT default null; ALTER TABLE monitor - ADD basicauth_pass TEXT default null; + ADD basic_auth_pass TEXT default null; COMMIT; diff --git a/server/database.js b/server/database.js index cc7247f1c..dfc739e0a 100644 --- a/server/database.js +++ b/server/database.js @@ -52,7 +52,7 @@ class Database { "patch-http-monitor-method-body-and-headers.sql": true, "patch-2fa-invalidate-used-token.sql": true, "patch-notification_sent_history.sql": true, - "patch-monitor-basicauth.sql": true, + "patch-monitor-basic-auth.sql": true, } /** diff --git a/server/model/monitor.js b/server/model/monitor.js index 95ef39336..f3c823c3b 100644 --- a/server/model/monitor.js +++ b/server/model/monitor.js @@ -58,8 +58,8 @@ class Monitor extends BeanModel { method: this.method, body: this.body, headers: this.headers, - basicauth_user: this.basicauth_user, - basicauth_pass: this.basicauth_pass, + basic_auth_user: this.basic_auth_user, + basic_auth_pass: this.basic_auth_pass, hostname: this.hostname, port: this.port, maxretries: this.maxretries, @@ -153,10 +153,10 @@ class Monitor extends BeanModel { let startTime = dayjs().valueOf(); // HTTP basic auth - let basicauthHeader = {}; - if (this.basicauth_user) { - basicauthHeader = { - "Authorization": "Basic " + this.encodeB64(this.basicauth_user, this.basicauth_pass) + let basicAuthHeader = {}; + if (this.basic_auth_user) { + basicAuthHeader = { + "Authorization": "Basic " + this.encodeB64(this.basic_auth_user, this.basic_auth_pass), }; } @@ -169,7 +169,7 @@ class Monitor extends BeanModel { "Accept": "*/*", "User-Agent": "Uptime-Kuma/" + version, ...(this.headers ? JSON.parse(this.headers) : {}), - ...(basicauthHeader) + ...(basicAuthHeader), }, httpsAgent: new https.Agent({ maxCachedSessions: 0, // Use Custom agent to disable session reuse (https://github.com/nodejs/node/issues/3940) diff --git a/server/server.js b/server/server.js index 76d456c54..b1678198a 100644 --- a/server/server.js +++ b/server/server.js @@ -575,8 +575,8 @@ exports.entryPage = "dashboard"; bean.method = monitor.method; bean.body = monitor.body; bean.headers = monitor.headers; - bean.basicauth_user = monitor.basicauth_user; - bean.basicauth_pass = monitor.basicauth_pass; + bean.basic_auth_user = monitor.basic_auth_user; + bean.basic_auth_pass = monitor.basic_auth_pass; bean.interval = monitor.interval; bean.retryInterval = monitor.retryInterval; bean.hostname = monitor.hostname; @@ -1141,8 +1141,8 @@ exports.entryPage = "dashboard"; method: monitorListData[i].method || "GET", body: monitorListData[i].body, headers: monitorListData[i].headers, - basicauth_user: monitorListData[i].basicauth_user, - basicauth_pass: monitorListData[i].basicauth_pass, + basic_auth_user: monitorListData[i].basic_auth_user, + basic_auth_pass: monitorListData[i].basic_auth_pass, interval: monitorListData[i].interval, retryInterval: retryInterval, hostname: monitorListData[i].hostname, diff --git a/src/pages/EditMonitor.vue b/src/pages/EditMonitor.vue index f5099aa3a..8b3157eab 100644 --- a/src/pages/EditMonitor.vue +++ b/src/pages/EditMonitor.vue @@ -270,9 +270,9 @@

{{ $t("HTTP Basic Auth") }}

- + - +