better masking and fix ui bug for live events

This commit is contained in:
Carl-Gerhard Lindesvärd
2024-04-16 13:56:48 +02:00
parent a8346ed7d5
commit 8ec4cc2058
3 changed files with 18 additions and 5 deletions

View File

@@ -138,8 +138,12 @@ interface GetEventsOptions {
}
function maskString(str: string, mask = '*') {
if (str.length < 9) return mask.repeat(Math.max(str.length, 3));
return str.slice(0, 3) + mask.repeat(str.length - 6) + str.slice(-3);
const allMasked = str.replace(/(\w)/g, mask);
if (str.length < 8) {
return allMasked;
}
return `${str.slice(0, 4)}${allMasked.slice(4)}`;
}
export function transformMinimalEvent(