company-guard 0.4.8: drop unused authorization CSS, one error map (#1215)

Drops four authorization-page CSS rules no element matches
(.authorization-heading and its p, .authorization-scope .detail-message,
.authorization-card>button) and folds the error map's three
Object.assign layers into one literal. The 12 effective messages are
unchanged; request_expired keeps the later text, the one that won
before. By cyanask.

Run at the reviewed head f9a65c28 (mote, temp HOME):
- bun test packages/company-guard: 36 pass, 0 fail.
- bun scripts/check.mjs company-guard: ok. node --check on every page/*.js.
- The new map parsed as JSON: 12 keys, request_expired = the old
  effective text.
- git grep of page/*.js and *.html: no authorization-heading, no
  .detail-message inside .authorization-scope, no button as a direct
  child of .authorization-card.

Not tried: the page in a browser; nothing it renders changes.
This commit is contained in:
cyanask
2026-11-16 17:29:38 +08:00
committed by GitHub
parent 9720caa468
commit 34e32a1f44
5 changed files with 12 additions and 11 deletions
+5 -1
View File
@@ -2,7 +2,7 @@
Local company-name masking and reversible replies for Magpie, with session approvals and local receipts.
当前版本:**0.4.7**(macOS)。
当前版本:**0.4.8**(macOS)。
面向 Magpie 的公司名称保护插件:在模型请求发送前替换识别到的公司名称,在回复返回本机时还原;提供“会话授权”“脱敏规则”和“脱敏回执”三个页面。
@@ -81,6 +81,10 @@ node receipt-report.mjs --json
本仓库不包含用户配置、授权名单、业务材料或本机验收记录。
## 0.4.8 代码整理
移除不再使用的授权页面样式,合并重复定义的错误提示表。页面布局、有效提示文案、授权范围和处理逻辑保持不变。
## 0.4.7 更新
脱敏回执按每条请求展示;会话授权页另外汇总所有日期合计保留的最近25条回执所涉及的会话。某个会话的最后一条回执移出窗口后,它会从近期会话列表消失,已启用授权仍在左侧表格中管理。近期会话以标题为主,来源标签、回执数及授权信息在下方分组显示。
+2 -2
View File
@@ -1,12 +1,12 @@
{
"name": "@magpie-community/middleware-company-guard",
"version": "0.4.7",
"version": "0.4.8",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "@magpie-community/middleware-company-guard",
"version": "0.4.7",
"version": "0.4.8",
"license": "MIT",
"devDependencies": {
"esbuild": "0.25.12"
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@magpie-community/middleware-company-guard",
"version": "0.4.7",
"version": "0.4.8",
"type": "module",
"license": "MIT",
"description": "Local company-name masking, reversible replies and session approvals for Magpie",
+1 -3
View File
@@ -10,9 +10,7 @@ async function api(route,params={},timeout=8000) {
if(!response.ok)throw new Error('read_failed');return response.json();
}
const authorizationErrors={invalid_names:'请填写有效公司名称,每行一个,最多32个;本次设置尚未改变。',request_expired:'申请已过期,请在目标会话重新提出申请。',operation_expired:'保存已过期,请刷新后重新确认。',operation_busy:'另一个窗口正在保存授权,请稍后刷新重试。',invalid_registry:'授权配置校验未通过,请保留当前设置并联系维护。',authorization_too_large:'名单或会话数量超过容量,请缩小范围。',authorization_unavailable:'本机授权服务暂不可用,请刷新重试。',authorization_not_found:'这份授权已变化,请刷新查看。'};
Object.assign(authorizationErrors,{receipt_target_unavailable:'此回执已过期或缺少可核验的目录,请等待该会话的新请求。',already_authorized:'此会话已全部放行,请刷新查看。',pending_capacity:'待确认申请已满,请先处理已有申请。'});
Object.assign(authorizationErrors,{request_expired:'申请已过期或已处理,请刷新核对。',rejection_history_unavailable:'申请已拒绝,但操作记录保存未成功;请保留本机记录并联系维护。'});
const authorizationErrors={"invalid_names":"请填写有效公司名称,每行一个,最多32个;本次设置尚未改变。","request_expired":"申请已过期或已处理,请刷新核对。","operation_expired":"保存已过期,请刷新后重新确认。","operation_busy":"另一个窗口正在保存授权,请稍后刷新重试。","invalid_registry":"授权配置校验未通过,请保留当前设置并联系维护。","authorization_too_large":"名单或会话数量超过容量,请缩小范围。","authorization_unavailable":"本机授权服务暂不可用,请刷新重试。","authorization_not_found":"这份授权已变化,请刷新查看。","receipt_target_unavailable":"此回执已过期或缺少可核验的目录,请等待该会话的新请求。","already_authorized":"此会话已全部放行,请刷新查看。","pending_capacity":"待确认申请已满,请先处理已有申请。","rejection_history_unavailable":"申请已拒绝,但操作记录保存未成功;请保留本机记录并联系维护。"};
function authorizationNotice(text,error=false){
for(const id of ['authorization-notice',...($('authorization-editor').open?['authorization-editor-notice']:[])]){const notice=$(id);notice.textContent=text;notice.className=error?'error':'detail-message';notice.hidden=!text;}
}
+3 -4
View File
@@ -18,8 +18,7 @@ button {cursor:pointer;white-space:nowrap}button:hover:not(:disabled) {border-co
.tabs a:focus-visible{outline:2px solid var(--magpie-accent,#a292ff);outline-offset:2px}
.task-name{display:block;max-width:290px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:12px;font-weight:550;margin-bottom:2px}
.authorization-page main{max-width:1160px;padding-bottom:20px}
.authorization-heading{display:flex;align-items:center;justify-content:space-between;gap:16px}
.authorization-heading p{font-size:12px;line-height:1.5;color:var(--magpie-muted,#aaaab5);margin:0}
#authorization-notice{font-size:12px;color:var(--magpie-muted,#aaaab5);margin:8px 0 12px;min-height:18px}
.authorization-guide{display:flex;align-items:baseline;flex-wrap:wrap;gap:6px 12px;padding:10px 12px;border:1px solid var(--magpie-line,#35353d);border-radius:6px;font-size:12px}
.authorization-guide>span{font-weight:600;white-space:nowrap}.authorization-guide>p{flex:1;margin:0;color:var(--magpie-muted,#aaaab5)}
@@ -30,8 +29,8 @@ button {cursor:pointer;white-space:nowrap}button:hover:not(:disabled) {border-co
.authorization-task{min-width:0}.authorization-card h3{font-size:14px;font-weight:600;line-height:1.45;overflow-wrap:anywhere;margin:0 0 5px}.authorization-card p{margin:0}
.authorization-title{display:flex;align-items:center;flex-wrap:wrap;gap:8px 10px;margin-bottom:6px}.authorization-title h3{margin:0}.authorization-agent{display:inline-flex;align-items:baseline;gap:6px;max-width:100%;overflow-wrap:anywhere;padding:3px 8px;border:1px solid color-mix(in srgb,var(--magpie-accent,#a292ff) 45%,var(--magpie-line,#35353d));border-radius:4px;background:color-mix(in srgb,var(--magpie-accent,#a292ff) 10%,var(--magpie-bg,#19191d));color:var(--magpie-fg,#ededf0);font-size:12px;line-height:1.5}.authorization-agent strong{font-weight:650}
.authorization-identity{display:flex;flex-wrap:wrap;gap:2px 12px;color:var(--magpie-muted,#aaaab5);font-size:11px;line-height:1.6}.authorization-workspace{overflow-wrap:anywhere}
.authorization-scope{display:grid;grid-template-columns:auto auto;align-items:baseline;gap:1px 8px;font-size:12px}.authorization-scope-label{font-weight:550;white-space:nowrap}.authorization-scope .detail-message{font-size:11px}.authorization-time{grid-column:1/-1;font-size:11px;color:var(--magpie-muted,#aaaab5);white-space:nowrap}
.authorization-card>button{height:29px;padding:4px 10px}.authorization-footnote{margin:9px 0 0;color:var(--magpie-muted,#aaaab5);font-size:11px;line-height:1.6}
.authorization-scope{display:grid;grid-template-columns:auto auto;align-items:baseline;gap:1px 8px;font-size:12px}.authorization-scope-label{font-weight:550;white-space:nowrap}.authorization-time{grid-column:1/-1;font-size:11px;color:var(--magpie-muted,#aaaab5);white-space:nowrap}
.authorization-footnote{margin:9px 0 0;color:var(--magpie-muted,#aaaab5);font-size:11px;line-height:1.6}
.authorization-pending-actions{display:flex;gap:8px}.authorization-pending-actions button{height:29px;padding:4px 10px}.rejection-confirm{grid-column:1/-1;display:flex;align-items:center;gap:16px;padding-top:10px;border-top:1px solid var(--magpie-line,#35353d)}.rejection-confirm p{flex:1;font-size:12px}.rejection-confirm .authorization-actions{flex:none}
.history-reapply{margin-left:14px}
.authorization-editor{box-sizing:border-box;position:fixed;inset:0;width:min(680px,calc(100vw - 64px));max-height:86vh;margin:auto;padding:0;overflow:hidden;border:1px solid var(--magpie-line,#35353d);border-radius:12px;background:var(--magpie-card,#242429);color:var(--magpie-fg,#ededf0);box-shadow:0 20px 70px #0003}