From cf2ca71deecc218c1977de12bfa7d88cffc6f208 Mon Sep 17 00:00:00 2001 From: "sur.la.route" Date: Tue, 14 Jun 2022 07:42:53 -0500 Subject: [PATCH 1/3] prevent null workstation #'s from passing.. to axios-ntlm --- server/model/monitor.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/server/model/monitor.js b/server/model/monitor.js index 7c269fe26..63fd37114 100644 --- a/server/model/monitor.js +++ b/server/model/monitor.js @@ -279,12 +279,18 @@ class Monitor extends BeanModel { if (this.auth_method === "ntlm") { options.httpsAgent.keepAlive = true; - res = await httpNtlm(options, { + let ntlmOptions = + { username: this.basic_auth_user, password: this.basic_auth_pass, domain: this.authDomain, - workstation: this.authWorkstation, - }); + } + + if (this.authWorkstation) { + ntlmOptions.workstation= this.authWorkstation; + } + + res = await httpNtlm(options, ntlmOptions); } else { res = await axiosClient.request(options); From 98f3c126e5febd7777cf361d8e771a8aa594177c Mon Sep 17 00:00:00 2001 From: Christopher Pickering Date: Tue, 14 Jun 2022 07:58:35 -0500 Subject: [PATCH 2/3] passed lint --- server/model/monitor.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/server/model/monitor.js b/server/model/monitor.js index 63fd37114..774875303 100644 --- a/server/model/monitor.js +++ b/server/model/monitor.js @@ -279,15 +279,14 @@ class Monitor extends BeanModel { if (this.auth_method === "ntlm") { options.httpsAgent.keepAlive = true; - let ntlmOptions = - { + let ntlmOptions = { username: this.basic_auth_user, password: this.basic_auth_pass, domain: this.authDomain, - } + }; if (this.authWorkstation) { - ntlmOptions.workstation= this.authWorkstation; + ntlmOptions.workstation = this.authWorkstation; } res = await httpNtlm(options, ntlmOptions); From 660005b143b6a79ee15624b090474049980595d8 Mon Sep 17 00:00:00 2001 From: Christopher Pickering Date: Tue, 14 Jun 2022 08:49:36 -0500 Subject: [PATCH 3/3] cleaned up code --- package-lock.json | 4 ++-- server/model/monitor.js | 11 +++-------- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/package-lock.json b/package-lock.json index 24f4cca4f..87342813a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "uptime-kuma", - "version": "1.16.1", + "version": "1.17.0-beta.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "uptime-kuma", - "version": "1.16.1", + "version": "1.17.0-beta.0", "license": "MIT", "dependencies": { "@fortawesome/fontawesome-svg-core": "~1.2.36", diff --git a/server/model/monitor.js b/server/model/monitor.js index 774875303..3e026fb62 100644 --- a/server/model/monitor.js +++ b/server/model/monitor.js @@ -279,17 +279,12 @@ class Monitor extends BeanModel { if (this.auth_method === "ntlm") { options.httpsAgent.keepAlive = true; - let ntlmOptions = { + res = await httpNtlm(options, { username: this.basic_auth_user, password: this.basic_auth_pass, domain: this.authDomain, - }; - - if (this.authWorkstation) { - ntlmOptions.workstation = this.authWorkstation; - } - - res = await httpNtlm(options, ntlmOptions); + workstation: this.authWorkstation ? this.authWorkstation : undefined + }); } else { res = await axiosClient.request(options);