ac4af582301a4e8a29245dbba767eba31334ddf9
1
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
de1ba9f123 |
settings, gui: a masking rule can be edited in place, not only removed (nf1qaz2w on Discord)
nf1qaz2w on Discord: "自定义脱敏规则现在只有移除,能否增加一个编辑功能方便调整规则". Settings → Privacy listed each custom masking rule with Remove only, so changing a pattern meant removing it and typing it again at the end. Each rule's row now has Edit beside Remove. Edit opens the rule in its own row, where it stands, with its name, Prefix/Regex (the app's segs, no <select>) and match filled in, laid out like the add row; a narrow window puts the match, Save and Cancel on a line under the name and Prefix/Regex. Save (or Enter) sends that one rule to the new POST /api/settings/redact-rule with its index and its current value; editRedactRule tidies and checks it with redact.CheckRules as an added rule is, and refuses one that doesn't compile, matches the empty string, is left with no prefix or pattern, repeats another rule, or is no longer at that index (changed or removed meanwhile). A refusal is said in the row in red, what was typed kept, and every rule stays as it was. Cancel or Escape leaves the rule untouched and sends nothing. The gateway reads the rules from settings per request (redactionOptions), so the edit masks the next request. The two fixed refusals are translated (zh, zh-TW, ja, de); the other strings (Edit, Save, Cancel, Name, Prefix, Regex) were already there. docs/subsystems/gateway-routing.md now describes the user's own rules and the edit. Run: - TestRedactRuleEdit (internal/gui): a valid edit is saved in place and redact.Mask with the saved rules follows it; a bad regex, a pattern that matches nothing, a short prefix, an empty rule, a duplicate, an index out of range, a negative one and a stale "was" are each refused with the reason, the rules unchanged. With api.go from before this change it fails: "edit: 404 404 page not found". - internal/gui/tests/redact-rule-edit.test.cjs: Chromium and WebKit, en, zh, zh-TW, ja, de, 1100px and 420px (20 tests, all pass): Edit opens the rule in its place with its values, fields don't overlap and stay in the row, the page doesn't scroll sideways, no click moves the page, Cancel sends nothing, a refused regex is shown with the typed values kept, a good one is saved by Enter in the same place. With the old app.js it fails: no button.rule-edit (locator timeout). redact-rule-row.test.cjs and i18n-keys.test.cjs pass. - Whole GUI suite in both engines, under heavy machine load: 5647 of 5667 pass. Each failing file was run again alone: agent-expand-steady, azure-endpoint, balance-currencies, gateway-key-groups, library-desktop-skills, library-all, plain-names, purpose-filter and usage-ledger pass. skill-install-agents-all (chromium 420px "view:5,0") failed the same on the base commit and passes after rebasing onto |