Files
magpie/internal/gui/assets/plugins/redact/client.js
T
yetone 847f0c4703 gui: Masking alert lives on the Masking page
nb5p on Discord (#feedback): "这个脱敏提醒被放到额度设置里了,害得我找半天没找到".
The Masking alert row sat in Settings › Usage. It now closes Insights ›
Masking, after the list of requests, in the page's own `.list.prefs` rows
(same Off/On segs, same ids #maskAlertRow/#maskAlertSegs, same i18n keys
and the same maskAlert setting). Nothing is left in Usage. The page draws
it from page.js after loadSettings, hides it while one request is open,
and gateway mode leaves it out as Settings did. Placed after the list so
the requests still start in the first screen (masking-records at 640px)
and the demo keeps its place between the card and the list.

Run at base 07a3312c5 with this change:
- mask-alert.test.cjs, Chromium (WSL magpie-desktop and mote) and WebKit
  (WSL), en/zh/zh-TW/ja/de at 900 and 380px: all pass.
- WebKit (WSL): mask-alert, masking-records, masking-demo,
  masking-demo-unblurred: 87 pass, 0 fail (tree differed from the pushed
  one by a client.js comment reflow only). Earlier WebKit run: turn-done,
  quota-reads, routing-masking, gateway-mode, builtins, sidebar pass.
- Chromium (WSL) at the final tree: i18n-keys, mask-alert, masking-records,
  masking-demo, masking-demo-unblurred, turn-done, quota-reads,
  routing-masking, gateway-mode, builtins, sidebar: 131 pass, 1 fail. The
  fail is i18n-keys "a plugin's words are its own" on "Unmarked"
  (plugins/routing/i18n.js), red on main, #4524.
- mote: go test -timeout 45m ./internal/gui/...: TestCoreScriptBudget and
  the budgets pass (app.js only shrinks). Red: TestSettingsSaveKeepsWhat-
  ItDoesNotSend (SearchAll, red on origin/main 93b31f5b7 too, #4514),
  TestColdTurnsTaken (passes alone 3 of 3, #4510), and the AppKit window
  tests killed at their 30s bar on mote over ssh (no window session).

Broken by hand: with internal/gui/assets back as on 07a3312c5 (row in
Settings › Usage, none on the page), mask-alert.test.cjs went 11 of 12
red in Chromium; the feature-off test is the one that still passes.

Not tried: the real app (desktop window) and WebKit on mote, whose
Playwright WebKit launch hangs there.
2026-10-31 14:05:02 +08:00

47 lines
2.6 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
// Insights › Masking: what masking kept from vendors, request by request.
//
// A page the redact plugin adds to the window (kernel.js), its words in
// i18n.js beside this file. This file registers the page and its markup,
// before app.js; page.js, after app.js, is the page's code. The card on
// top says how much was masked over 7 or 30 days and where it went, the
// list under it each request (or each value) masking changed (between
// them, folded, demo.js's 小鹊 shows how masking works), and a
// request opened says what it carried, what the vendor got instead, and
// how each value was found and put back. The Masking alert closes the
// page (it sat in Settings › Usage, where nb5p looked for it in vain),
// after the list, so the requests still start in the first screen. The
// hooks are what the shell asks of it: open, refresh (the window came
// back), reload (Refresh in the sidebar), leave, and focus (a masked
// call's badge opens its request).
magpie.plugin("redact", (ctx) => {
ctx.slots.add("page", {
key: "masking",
title: "Masking",
html: `
<section class="msk-card" id="maskCard"></section>
<section class="msk-demo" id="maskDemo" data-no-pii>
<button type="button" class="md-row" id="mdRow" aria-expanded="false" aria-controls="mdBody">
<span class="md-thumb" aria-hidden="true"></span>
<span class="md-words"><span class="md-name" data-t>How masking works</span><span class="md-sub" data-t>Little Magpie walks one request through: passwords become placeholders before it leaves, and come back on your computer with the answer</span></span>
<span class="md-len">0:27</span>
<svg class="md-chev" viewBox="0 0 16 16" width="12" height="12" aria-hidden="true"><path d="m6 3.5 4.5 4.5L6 12.5" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"/></svg>
</button>
<div class="md-body" id="mdBody" hidden></div>
</section>
<section class="msk-list" id="maskList"></section>
<div class="list prefs msk-prefs" id="maskPrefs">
<div class="row pref" id="maskAlertRow">
<div class="who"><div class="name" data-t>Masking alert</div><div class="sub wraps" data-t>A notification when masking swaps a value for the first time: its kind and how many, never the value itself</div></div>
<div id="maskAlertSegs"></div>
</div>
</div>
<section class="msk-one" id="maskOne" hidden></section>
`,
open() { return maskPageOpen(); },
refresh(again) { return maskPageLoad(again); },
reload() { return maskPageLoad(true); },
leave() { maskTipOff(); },
focus(key) { maskOneOpen(String(key)); },
});
});