tracker: keep spaces, remove data from page location msg
This commit is contained in:
parent
829e1c8bde
commit
6f172d4f01
2 changed files with 6 additions and 2 deletions
|
|
@ -41,7 +41,7 @@ export interface Options {
|
|||
export const stringWiper = (input: string) =>
|
||||
input
|
||||
.trim()
|
||||
.replace(/[^\f\n\r\t\v\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff]/g, '*')
|
||||
.replace(/[^\f\n\r\t\v\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff\s]/g, '*')
|
||||
|
||||
export default class Sanitizer {
|
||||
private readonly obscured: Set<number> = new Set()
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
import type App from '../app/index.js'
|
||||
import { getTimeOrigin } from '../utils.js'
|
||||
import { SetPageLocation, SetViewportSize, SetPageVisibility } from '../app/messages.gen.js'
|
||||
import { stringWiper } from '../app/sanitizer.js'
|
||||
|
||||
export default function (app: App): void {
|
||||
let url: string | null, width: number, height: number
|
||||
|
|
@ -11,7 +12,10 @@ export default function (app: App): void {
|
|||
const { URL } = document
|
||||
if (URL !== url) {
|
||||
url = URL
|
||||
app.send(SetPageLocation(url, referrer, navigationStart, document.title))
|
||||
const safeTitle = app.sanitizer.privateMode ? stringWiper(document.title) : document.title
|
||||
const safeUrl = app.sanitizer.privateMode ? stringWiper(url) : url
|
||||
const safeReferrer = app.sanitizer.privateMode ? stringWiper(referrer) : referrer
|
||||
app.send(SetPageLocation(safeUrl, safeReferrer, navigationStart, safeTitle))
|
||||
navigationStart = 0
|
||||
referrer = url
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue