masking: the Masking page turns masking off as it turns it on
ZekeXiao on X: "脱敏好像只有一个打开开关,不能关?". Insights › Masking's header had "Turn on masking" while masking was off and nothing at all while it was on; the off switches were only in Settings › Privacy. - Masking on, the header has a "Turn off masking" text button where "Turn on masking" sits when off. It sets redact and redactPersonal off, and the card then says "Masking is off" with Turn on masking. - Turn on masking from this page after that brings personal data back on if it was on before (and Hide accounts with it, as Settings does); otherwise it turns secrets on, as before. - With the user's own Masked words, masking stays on with both switches off (masking.Wanted), so a button that turned the switches off would leave the page saying on, or lie. Then the button reads "Turn off in Settings" and opens Settings › Privacy, with a tooltip saying the words mask until they are taken out there. Words are never deleted from here. - Strings in plugins/redact/i18n.js for zh, zh-TW, ja, de. Run (worktree at origin/main628ac36fc): - masking-records: new "masking on, the page turns it off and on again" (5 languages, 1100 and 640px) and the words case, now asserting the one way off opens Settings and saves nothing. Red on the old page.js: 30 of 30 (mote, chromium + webkit). Green with the change: 30 of 30. - Broken by hand: not restoring redactPersonal on Turn on makes "personal data comes back on as it was" red in both engines. - An earlier label "Turn off masking…" was red in i18n-keys (it says routing's own key "masking…"); relabelled. - Linux box (wsl-run, magpie-desktop, playwright 1.62.0): chromium: i18n-keys, mask*, redact*, account-mask*, routing-masking, window-mask, provider-unmasked: 201 of 201 ok. webkit: masking-records, mask-actions, routing-masking 72 of 72; the rest 124 of 129, the 5 reds redact-rule-edit at 420px, red the same at origin/main3142a5559alone (#3407, commented). - mote at load 18-30 with other sessions' full GUI suites: WebKit could not launch at all, origin/main too (#4125, commented), and Chromium had 5s-timeout reds in account-mask*, mask-alert and masking-demo-unblurred, files this change doesn't reach; the same files passed on the Linux box. Not tried: the whole GUI suite (mote was taken by others' suites and could not launch WebKit); the real app; WebKit on macOS after the relabel (Linux WebKit only).
This commit is contained in:
@@ -3,6 +3,9 @@
|
||||
magpie.strings({
|
||||
zh: {
|
||||
"Turn on masking": "打开脱敏",
|
||||
"Turn off masking": "关闭脱敏",
|
||||
"Turn off in Settings": "去设置里关闭",
|
||||
"Your own masked words still mask until you take them out, in Settings › Privacy": "你自己加的脱敏词会一直脱敏,要在「设置 › 隐私」里删掉",
|
||||
"You can also change it in": "也可以在这里调整:",
|
||||
"Requests go to vendors as they are": "请求按原样发给厂商",
|
||||
"Turned on, keys, passwords and tokens become placeholders before they leave this computer, and are put back in each answer. Emails and phone numbers too once Mask personal data is on. What each request had masked shows here.": "打开脱敏后,密钥、密码、令牌这些值在离开这台电脑前会换成占位符,回复里再换回来。打开「脱敏个人信息」后,邮箱和手机号也会。每条请求遮了什么,都会显示在这里。",
|
||||
@@ -95,6 +98,9 @@ magpie.strings({
|
||||
},
|
||||
"zh-TW": {
|
||||
"Turn on masking": "開啟脫敏",
|
||||
"Turn off masking": "關閉脫敏",
|
||||
"Turn off in Settings": "到設定裡關閉",
|
||||
"Your own masked words still mask until you take them out, in Settings › Privacy": "你自己加的脫敏詞會一直脫敏,要在「設定 › 隱私」裡刪掉",
|
||||
"You can also change it in": "也可以在這裡調整:",
|
||||
"Requests go to vendors as they are": "請求照原樣發給廠商",
|
||||
"Turned on, keys, passwords and tokens become placeholders before they leave this computer, and are put back in each answer. Emails and phone numbers too once Mask personal data is on. What each request had masked shows here.": "開啟脫敏後,金鑰、密碼、權杖這些值在離開這台電腦前會換成佔位符,回覆裡再換回來。開啟「脫敏個人資訊」後,電子郵件和手機號碼也會。每則請求遮了什麼,都會顯示在這裡。",
|
||||
@@ -187,6 +193,9 @@ magpie.strings({
|
||||
},
|
||||
ja: {
|
||||
"Turn on masking": "マスクをオンにする",
|
||||
"Turn off masking": "マスクをオフにする",
|
||||
"Turn off in Settings": "設定でオフにする",
|
||||
"Your own masked words still mask until you take them out, in Settings › Privacy": "自分で追加したマスクする語は、設定 › プライバシーで削除するまでマスクされ続けます",
|
||||
"You can also change it in": "こちらでも変更できます:",
|
||||
"Requests go to vendors as they are": "リクエストはそのままベンダーに送られます",
|
||||
"Turned on, keys, passwords and tokens become placeholders before they leave this computer, and are put back in each answer. Emails and phone numbers too once Mask personal data is on. What each request had masked shows here.": "オンにすると、キー・パスワード・トークンはこのコンピュータを出る前にプレースホルダーに置き換わり、返答の中で元に戻されます。「個人情報をマスク」をオンにすると、メールアドレスと電話番号も対象になります。各リクエストで何をマスクしたかがここに表示されます。",
|
||||
@@ -279,6 +288,9 @@ magpie.strings({
|
||||
},
|
||||
de: {
|
||||
"Turn on masking": "Maskierung einschalten",
|
||||
"Turn off masking": "Maskierung ausschalten",
|
||||
"Turn off in Settings": "In den Einstellungen ausschalten",
|
||||
"Your own masked words still mask until you take them out, in Settings › Privacy": "Ihre eigenen maskierten Wörter werden weiter maskiert, bis Sie sie unter Einstellungen › Datenschutz entfernen",
|
||||
"You can also change it in": "Auch zu ändern unter",
|
||||
"Requests go to vendors as they are": "Anfragen gehen unverändert an die Anbieter",
|
||||
"Turned on, keys, passwords and tokens become placeholders before they leave this computer, and are put back in each answer. Emails and phone numbers too once Mask personal data is on. What each request had masked shows here.": "Eingeschaltet werden Schlüssel, Passwörter und Tokens zu Platzhaltern, bevor sie diesen Computer verlassen, und in jeder Antwort zurückgesetzt. E-Mails und Telefonnummern ebenso, sobald „Personenbezogene Daten maskieren“ an ist. Was jede Anfrage maskiert hatte, steht hier.",
|
||||
|
||||
@@ -112,7 +112,7 @@ function drawMaskCard() {
|
||||
if (!box) return;
|
||||
// until the window's state is read, agents would show as their ids
|
||||
const on = maskOn(), sum = maskSumDays === maskDays && load.done ? maskSum : null;
|
||||
const key = JSON.stringify([document.documentElement.lang, maskDays, on, sum, state?.agents?.length, (providers || maskProv)?.providers?.length]);
|
||||
const key = JSON.stringify([document.documentElement.lang, maskDays, on, !!maskSettings().redactWords?.length, sum, state?.agents?.length, (providers || maskProv)?.providers?.length]);
|
||||
if (key === maskDrawn && box.firstChild) return;
|
||||
maskDrawn = key;
|
||||
// it moves when it first has numbers to say, and for other days: not
|
||||
@@ -133,7 +133,7 @@ function drawMaskCard() {
|
||||
b.type = "button";
|
||||
b.onclick = maskTurnOn;
|
||||
head.append(b);
|
||||
}
|
||||
} else head.append(maskOffButton());
|
||||
if (sum?.requests || maskDays === 30) head.append(segs([["7", t("7 days")], ["30", t("30 days")]], String(maskDays), (v) => {
|
||||
maskDays = +v;
|
||||
try { localStorage.setItem("magpie.maskDays", v); } catch {}
|
||||
@@ -201,11 +201,44 @@ function maskNone() {
|
||||
box.append(" ", link);
|
||||
return box;
|
||||
}
|
||||
// the way off, beside the way on (ZekeXiao on X: "脱敏好像只有一个打开
|
||||
// 开关,不能关?"). Both switches go off at once. Your own words mask with neither
|
||||
// on, and only Settings › Privacy can take them out, so with words the
|
||||
// button opens it there, and says so, rather than leave the page
|
||||
// saying off while words still mask
|
||||
function maskOffButton() {
|
||||
const words = maskSettings().redactWords?.length;
|
||||
const b = el("button", "text", t(words ? "Turn off in Settings" : "Turn off masking"));
|
||||
b.type = "button";
|
||||
if (words) {
|
||||
b.title = t("Your own masked words still mask until you take them out, in Settings › Privacy");
|
||||
b.onclick = (e) => openSettingsAt(e, "privacy");
|
||||
return b;
|
||||
}
|
||||
b.onclick = () => {
|
||||
b.disabled = true;
|
||||
(prefs ? Promise.resolve() : loadSettings())
|
||||
.then(() => {
|
||||
// turned on again from this page, it comes back as it was
|
||||
maskWasPersonal = !!prefs.redactPersonal;
|
||||
return savePrefs({ ...prefsKeep(prefs), redact: false, redactPersonal: false });
|
||||
})
|
||||
.then(() => { maskDrawn = ""; drawMaskCard(); })
|
||||
.finally(() => { b.disabled = false; });
|
||||
};
|
||||
return b;
|
||||
}
|
||||
let maskWasPersonal = false;
|
||||
function maskTurnOn(e) {
|
||||
const b = e.currentTarget;
|
||||
b.disabled = true;
|
||||
(prefs ? Promise.resolve() : loadSettings())
|
||||
.then(() => savePrefs({ ...prefsKeep(prefs), redact: true }))
|
||||
.then(() => {
|
||||
const back = maskWasPersonal;
|
||||
maskWasPersonal = false;
|
||||
if (back) window.hideAccounts?.set(true);
|
||||
return savePrefs({ ...prefsKeep(prefs), redact: true, ...(back ? { redactPersonal: true } : {}) });
|
||||
})
|
||||
.then(() => { maskDrawn = ""; drawMaskCard(); })
|
||||
.finally(() => { b.disabled = false; });
|
||||
}
|
||||
|
||||
@@ -400,14 +400,61 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
|
||||
});
|
||||
test(`${engine} ${lang}: your own words alone are masking on`, async (t) => {
|
||||
const empty = (d) => ({ ...summary(d), requests: 0, n: 0, distinct: 0, blocked: 0, kinds: [], agents: [], providers: [], values: [], by: {} });
|
||||
const { browser, page, errors } = await open(engine, lang, 640, empty, null, { off: true, none: true, settings: { redactWords: ["Nightjar"] } });
|
||||
const { browser, page, errors, asked } = await open(engine, lang, 640, empty, null, { off: true, none: true, settings: { redactWords: ["Nightjar"] } });
|
||||
t.after(() => browser.close());
|
||||
await page.locator("#maskCard .msk-head").waitFor();
|
||||
assert.equal(await page.locator("#maskCard.off").count(), 0, "words alone mask, the card says off");
|
||||
assert.equal(await page.locator("#maskCard .msk-head button").count(), 0, "no Turn on masking while words mask");
|
||||
// the way off is Settings › Privacy, where the words are: a click
|
||||
// here that turned the switches off would leave words masking
|
||||
const off = page.locator("#maskCard .msk-head button");
|
||||
assert.equal(await off.count(), 1, "one way off, no Turn on masking while words mask");
|
||||
if (lang === "en") assert.equal(await off.innerText(), "Turn off in Settings");
|
||||
else assert(!(await off.innerText()).includes("Turn"), "Turn off in Settings left in English");
|
||||
assert(!(await page.locator("#maskCard .msk-flow-none").innerText()).includes("Only keys"), "words alone: not the secrets-only line");
|
||||
await off.click();
|
||||
await page.locator("#view-settings").waitFor({ state: "visible" });
|
||||
assert(!asked.some((x) => x.startsWith("settings")), "opening Settings saves nothing");
|
||||
assert.deepEqual(errors, []);
|
||||
});
|
||||
// masking on, the page turns it off as it turns it on (ZekeXiao on X:
|
||||
// "脱敏好像只有一个打开开关,不能关?"): both switches go off, the page
|
||||
// then says off, and Turn on masking brings back what was on
|
||||
for (const width of [1100, 640]) {
|
||||
test(`${engine} ${lang} ${width}px: masking on, the page turns it off and on again`, async (t) => {
|
||||
const { browser, page, errors, asked } = await open(engine, lang, width, summary);
|
||||
t.after(() => browser.close());
|
||||
const head = page.locator("#maskCard .msk-head");
|
||||
await page.locator("#maskCard .msk-num").waitFor();
|
||||
const off = head.locator("button.text");
|
||||
assert.equal(await off.count(), 1, "a way off while masking is on");
|
||||
if (lang === "en") assert.equal(await off.innerText(), "Turn off masking");
|
||||
else assert(!(await off.innerText()).includes("Turn"), "Turn off masking left in English");
|
||||
assert.deepEqual(await wide(page), { page: false, over: [] });
|
||||
await shot(page, `${engine}-${lang}-${width}-on-off`);
|
||||
const offText = await off.innerText();
|
||||
await stillClick(page, off);
|
||||
await until(() => asked.some((x) => x.startsWith("settings")));
|
||||
const sent = JSON.parse(asked.find((x) => x.startsWith("settings")).slice(9));
|
||||
assert.equal(sent.redact, false);
|
||||
assert.equal(sent.redactPersonal, false);
|
||||
// what the page says after is true: off, and the way back on
|
||||
const on = head.locator("button.text");
|
||||
await page.waitForFunction((was) => { const b = document.querySelector("#maskCard .msk-head button.text"); return b && !b.disabled && b.textContent !== was; }, offText);
|
||||
if (lang === "en") {
|
||||
assert.equal(await head.locator(".msk-sub").innerText(), "Masking is off: requests go to vendors as they are");
|
||||
assert.equal(await on.innerText(), "Turn on masking");
|
||||
}
|
||||
assert.deepEqual(await wide(page), { page: false, over: [] });
|
||||
asked.length = 0;
|
||||
await stillClick(page, on);
|
||||
await until(() => asked.some((x) => x.startsWith("settings")));
|
||||
const back = JSON.parse(asked.find((x) => x.startsWith("settings")).slice(9));
|
||||
assert.equal(back.redact, true);
|
||||
assert.equal(back.redactPersonal, true, "personal data comes back on as it was");
|
||||
await page.waitForFunction((was) => document.querySelector("#maskCard .msk-head button.text")?.textContent === was, offText);
|
||||
assert.deepEqual(errors, []);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
test(`${engine}: a masked call on the Gateway page, and a key in the address, open its request`, async (t) => {
|
||||
|
||||
Reference in New Issue
Block a user