mirror of
https://github.com/YuJunZhiXue/dsh-purge.git
synced 2026-11-30 03:30:22 +08:00
- 门禁收敛:仅拦截中国大陆、香港、澳门,银行与金融站点,政府与军事站点 - #220 dshTarget 适配 0.2.1-rc.5 - #213 POSIX 原子写保留文件权限位 - #211 回退按钮遮挡与层级 - #209 pnpm 12 允许构建配置键名 - 提示词只由本地 lib/default-prompt-inject.md 嵌入,移除 zh/en 变体并加入忽略 - README 中英日同步,边界说明统一为禁止项
This commit is contained in:
1 parent
aa80d2e809
commit
2d428b11ff
12 files changed
+345
-312
No files matched your search
@@ -175,7 +175,7 @@ window.__ModuleLoader__.load({ id: "dsh-purge", factory: (require) => {
|
||||
"purge.title": "补丁",
|
||||
"override.title": "提示词",
|
||||
"own.title": "本地靶场",
|
||||
"own.hint": "开源版攻击任务只放行本机/内网 IP。域名会先解析,解析到的每一个地址都必须是私网或回环;hosts 把 .lab 指到公网 IP 也会拦。解析失败或混有公网地址一律拦截。",
|
||||
"own.hint": "禁止对中国大陆、香港、澳门,银行与金融站点,政府与军事站点进行渗透、攻击或扫描。本地演练限定在本机回环与 RFC1918 私网。",
|
||||
"own.save": "保存名单",
|
||||
"saved.own": "已保存自己的服务器",
|
||||
"saved.own.dropped": "已保存。有 {n} 行不是单个 IP 或主机名,已丢掉",
|
||||
@@ -535,8 +535,8 @@ window.__ModuleLoader__.load({ id: "dsh-purge", factory: (require) => {
|
||||
"theme.ink": "Ink",
|
||||
"purge.title": "Patches",
|
||||
"override.title": "Prompt",
|
||||
"own.title": "Local lab only",
|
||||
"own.hint": "The open-source build only allows localhost/private IPs. Domains are resolved first; every A/AAAA must be loopback or RFC1918. A hosts entry that points .lab at a public IP is blocked. Failed or mixed public answers are denied.",
|
||||
"own.title": "Local lab",
|
||||
"own.hint": "Penetration, attack, or scanning against mainland China, Hong Kong and Macau, banks and financial sites, government and military sites is prohibited. Local drills are limited to loopback and RFC1918 private addresses.",
|
||||
"own.save": "Save list",
|
||||
"saved.own": "Own servers saved",
|
||||
"saved.own.dropped": "Saved. {n} lines were not a single IP or hostname and were dropped",
|
||||
@@ -3065,7 +3065,7 @@ body[data-ds-dark-theme] .rt-rep-step-no,.dshp-dock[data-theme="dusk"] .rt-rep-s
|
||||
.dshp-rewind:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover,rgba(127,127,127,.12));color:var(--dsw-alias-label-primary,currentColor)}
|
||||
.dshp-rewind:disabled{opacity:.4;cursor:default}
|
||||
.dshp-rewind svg{display:block}
|
||||
.dshp-rewind-menu{position:fixed;z-index:2147483000;box-sizing:border-box;min-width:220px;padding:4px;border:0;border-radius:12px;background:var(--dsw-specific-menu,#fff);color:var(--dsw-alias-label-primary,#1a1a1a);--dsw-elevation-stroke-color:var(--dsw-alias-border-l1);box-shadow:var(--dsw-elevation-prominent,0 8px 24px rgba(0,0,0,.16));transform:translateY(-100%)}
|
||||
.dshp-rewind-menu{position:fixed;z-index:950;box-sizing:border-box;min-width:220px;padding:4px;border:0;border-radius:12px;background:var(--dsw-specific-menu,#fff);color:var(--dsw-alias-label-primary,#1a1a1a);--dsw-elevation-stroke-color:var(--dsw-alias-border-l1);box-shadow:var(--dsw-elevation-prominent,0 8px 24px rgba(0,0,0,.16));transform:translateY(-100%)}
|
||||
body[data-ds-dark-theme] .dshp-rewind-menu{background:var(--dsw-specific-menu,#32312d);color:var(--dsw-alias-label-primary,#e6e2db);--dsw-elevation-stroke-color:var(--dsw-alias-border-l1,#3f3d38);box-shadow:var(--dsw-elevation-prominent,0 10px 28px rgba(0,0,0,.45))}
|
||||
.dshp-rewind-item{display:flex;flex-direction:column;gap:2px;width:100%;padding:8px 10px;border:0;border-radius:8px;background:transparent;color:inherit;text-align:left;cursor:pointer;font:12px/1.3 var(--ds-font-sans,system-ui,sans-serif)}
|
||||
.dshp-rewind-item:hover{background:var(--dsw-alias-interactive-bg-hover,rgba(127,127,127,.12))}
|
||||
@@ -9145,6 +9145,28 @@ body[data-ds-dark-theme] .rt-scope-testing,.dshp-dock[data-theme="dusk"] .rt-sco
|
||||
return best;
|
||||
}
|
||||
|
||||
/* #211:锚点有矩形不代表用户看得见。设置 / 账户这类页面是挂在 body 上的
|
||||
aria-modal 模态,会话面原地保留、composer 仍有尺寸,按钮就会飘在模态上面。
|
||||
命中任一情况都收起来,并把预留的 padding 还回去。 */
|
||||
function rewindSurfaceObscured(anchor) {
|
||||
if (!anchor || !anchor.isConnected) return true;
|
||||
if (typeof anchor.checkVisibility === "function") {
|
||||
let visible = true;
|
||||
try {
|
||||
visible = anchor.checkVisibility({ checkOpacity: true, checkVisibilityCSS: true });
|
||||
} catch { /* 旧引擎不认 options,退回矩形检查 */ }
|
||||
if (!visible) return true;
|
||||
}
|
||||
try {
|
||||
if (anchor.closest && anchor.closest('[inert], [aria-hidden="true"]')) return true;
|
||||
} catch { /* ignore */ }
|
||||
const dialogs = document.querySelectorAll('[role="dialog"][aria-modal="true"]');
|
||||
for (let i = 0; i < dialogs.length; i += 1) {
|
||||
if (!dialogs[i].contains(anchor)) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function placeRewindHost(host, anchor, reserve) {
|
||||
if (!host || !anchor) return;
|
||||
const rect = anchor.getBoundingClientRect();
|
||||
@@ -9177,7 +9199,7 @@ body[data-ds-dark-theme] .rt-scope-testing,.dshp-dock[data-theme="dusk"] .rt-sco
|
||||
el.setAttribute(REWIND_HOST_ATTR, "");
|
||||
document.body.appendChild(el);
|
||||
}
|
||||
el.style.cssText = "position:fixed;z-index:2147482500;display:none;left:0;top:0;";
|
||||
el.style.cssText = "position:fixed;z-index:900;display:none;left:0;top:0;";
|
||||
setHost(el);
|
||||
let padded = null;
|
||||
let warned = false;
|
||||
@@ -9205,14 +9227,16 @@ body[data-ds-dark-theme] .rt-scope-testing,.dshp-dock[data-theme="dusk"] .rt-sco
|
||||
}
|
||||
return;
|
||||
}
|
||||
// 按钮标签会随失败提示变长,预留宽度跟着实测宽度走,避免压到模型选择器。
|
||||
const reserve = Math.max(REWIND_RESERVE_PX, (el.offsetWidth || 60) + 12);
|
||||
const pad = sessionRef.current ? reserve + "px" : (anchor.dataset.dshpPad || "");
|
||||
if (anchor.style.paddingLeft !== pad) anchor.style.paddingLeft = pad;
|
||||
if (!sessionRef.current) {
|
||||
if (!sessionRef.current || rewindSurfaceObscured(anchor)) {
|
||||
const restore = anchor.dataset.dshpPad || "";
|
||||
if (anchor.style.paddingLeft !== restore) anchor.style.paddingLeft = restore;
|
||||
el.style.display = "none";
|
||||
return;
|
||||
}
|
||||
// 按钮标签会随失败提示变长,预留宽度跟着实测宽度走,避免压到模型选择器。
|
||||
const reserve = Math.max(REWIND_RESERVE_PX, (el.offsetWidth || 60) + 12);
|
||||
const pad = reserve + "px";
|
||||
if (anchor.style.paddingLeft !== pad) anchor.style.paddingLeft = pad;
|
||||
placeRewindHost(el, anchor, reserve);
|
||||
};
|
||||
place(true);
|
||||
|
||||
Reference in new issue
Block a user