From dbf492947ec7cc9ff427f560141febe62931e7dd Mon Sep 17 00:00:00 2001 From: Adam Stachowicz Date: Fri, 5 Jan 2024 22:10:31 +0100 Subject: [PATCH] Simplify `encodeBase64` --- server/model/monitor.js | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/server/model/monitor.js b/server/model/monitor.js index f52de66280..451924ccae 100644 --- a/server/model/monitor.js +++ b/server/model/monitor.js @@ -233,15 +233,7 @@ class Monitor extends BeanModel { * @returns {string} */ encodeBase64(user, pass) { - if (!user) { - return Buffer.from(`:${pass}`).toString("base64"); - } - - if (!pass) { - return Buffer.from(`${user}:`).toString("base64"); - } - - return Buffer.from(`${user}:${pass}`).toString("base64"); + return Buffer.from(`${user || ''}:${pass || ''}`).toString("base64"); } /**