Skip to content

Commit

Permalink
Simplify encodeBase64
Browse files Browse the repository at this point in the history
  • Loading branch information
Saibamen committed Jan 5, 2024
1 parent 51d8ccf commit dbf4929
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions server/model/monitor.js
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}

/**
Expand Down

0 comments on commit dbf4929

Please sign in to comment.