Skip to content

Commit

Permalink
unmask last character
Browse files Browse the repository at this point in the history
  • Loading branch information
lluisd committed May 10, 2024
1 parent 8eefb11 commit dcf5443
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions handlers/stream.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,22 @@ class Stream {
}

_maskUserName (userName) {
const unmaskedLength = 3
let maskedUserName = userName.substring(0,unmaskedLength)
const unmaskedStartLength = 3
const unmaskedEndLength = 1

let unmaskedStart = userName.substring(0, unmaskedStartLength)
let masked = ''
let unmaskedEnd = ''

const unmaskedLength = unmaskedStartLength + unmaskedEndLength
if (userName.length > unmaskedLength) {
maskedUserName = maskedUserName + '*'.repeat(userName.length - unmaskedLength)
masked = '*'.repeat(userName.length - unmaskedLength)
unmaskedEnd = userName.substring(userName.length - unmaskedEndLength)
} else if (userName.length > unmaskedStartLength) {
masked = '*'.repeat(userName.length - unmaskedStartLength)
}

return maskedUserName
return unmaskedStart + masked + unmaskedEnd
}

async captureScreenshot(target, bot, notifierBot, displayName, roomId) {
Expand Down

0 comments on commit dcf5443

Please sign in to comment.