mirror of
https://github.com/YuJunZhiXue/dsh-purge.git
synced 2026-11-28 14:00:22 +08:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a576e9b817 | ||
|
|
e360fa6b70 | ||
|
|
4321b3a039 |
No files matched your search
@@ -1031,7 +1031,7 @@ window.__ModuleLoader__.load({ id: "dsh-purge", factory: (require) => {
|
|||||||
setState(d);
|
setState(d);
|
||||||
if (d.channel) setChannel(d.channel);
|
if (d.channel) setChannel(d.channel);
|
||||||
if (d.update && d.update.ok && !d.update.error) setUpdateInfo(d.update);
|
if (d.update && d.update.ok && !d.update.error) setUpdateInfo(d.update);
|
||||||
if (d.boot_full_quit) setAskOfficialRestart(true);
|
setAskOfficialRestart(Boolean(d.boot_full_quit));
|
||||||
} else {
|
} else {
|
||||||
setState({ ok: false, patches_total: 0, patches_applied: 0, patch_status: {}, shim_cmd: "n/a", shim_ps1: "n/a", shim_bin: "n/a", has_backup: false });
|
setState({ ok: false, patches_total: 0, patches_applied: 0, patch_status: {}, shim_cmd: "n/a", shim_ps1: "n/a", shim_bin: "n/a", has_backup: false });
|
||||||
setNotice({ kind: "error", text: tr("err.status", { error: (d && d.error) || "bad response" }) });
|
setNotice({ kind: "error", text: tr("err.status", { error: (d && d.error) || "bad response" }) });
|
||||||
@@ -2031,14 +2031,23 @@ window.__ModuleLoader__.load({ id: "dsh-purge", factory: (require) => {
|
|||||||
|
|
||||||
function waitForRestart(setNotice, setBusy, t) {
|
function waitForRestart(setNotice, setBusy, t) {
|
||||||
const started = Date.now();
|
const started = Date.now();
|
||||||
|
// 必须先看到旧进程掉线,再等新进程就绪;否则同进程立刻 200 会被当成「重启成功」又弹重启。
|
||||||
|
let sawDown = false;
|
||||||
const ping = () => {
|
const ping = () => {
|
||||||
fetch("/dsh-purge/status", { cache: "no-store", credentials: "same-origin" })
|
fetch("/dsh-purge/status", { cache: "no-store", credentials: "same-origin" })
|
||||||
.then((r) => (r.ok ? r.json() : Promise.reject()))
|
.then((r) => (r.ok ? r.json() : Promise.reject()))
|
||||||
.then((d) => {
|
.then((d) => {
|
||||||
|
if (!sawDown) {
|
||||||
|
retry();
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (d && d.ok && d.ready !== false) reopenAfterRestart();
|
if (d && d.ok && d.ready !== false) reopenAfterRestart();
|
||||||
else retry();
|
else retry();
|
||||||
})
|
})
|
||||||
.catch(retry);
|
.catch(() => {
|
||||||
|
sawDown = true;
|
||||||
|
retry();
|
||||||
|
});
|
||||||
};
|
};
|
||||||
const retry = () => {
|
const retry = () => {
|
||||||
if (Date.now() - started > 90000) {
|
if (Date.now() - started > 90000) {
|
||||||
|
|||||||
@@ -1232,6 +1232,8 @@ function installWebServer(ctx, cfg) {
|
|||||||
pendingQuit = Boolean(swapped?.pending);
|
pendingQuit = Boolean(swapped?.pending);
|
||||||
}
|
}
|
||||||
const leaveTray = renamed || pendingQuit;
|
const leaveTray = renamed || pendingQuit;
|
||||||
|
if (complete) reapply.markPatchesApplied();
|
||||||
|
if (leaveTray) bootFullQuit = true;
|
||||||
sendJson(response, 200, {
|
sendJson(response, 200, {
|
||||||
ok: true,
|
ok: true,
|
||||||
complete,
|
complete,
|
||||||
@@ -1371,6 +1373,8 @@ function installWebServer(ctx, cfg) {
|
|||||||
try {
|
try {
|
||||||
const surface = hostctl.currentSurface();
|
const surface = hostctl.currentSurface();
|
||||||
const planned = hostctl.scheduleRestart(request, ctx);
|
const planned = hostctl.scheduleRestart(request, ctx);
|
||||||
|
// 用户已点重启:清掉粘性标记,避免同进程误刷新/再进面板又弹一次。
|
||||||
|
bootFullQuit = false;
|
||||||
sendJson(response, 200, {
|
sendJson(response, 200, {
|
||||||
ok: true,
|
ok: true,
|
||||||
surface,
|
surface,
|
||||||
|
|||||||
+7
-1
@@ -64,6 +64,11 @@ function writeAppliedStamp(sha) {
|
|||||||
}, null, 2)}\n`, "utf8");
|
}, null, 2)}\n`, "utf8");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 手动「应用」成功后也要打戳,否则重启后 settle 会以为补丁未对齐再要求重启。 */
|
||||||
|
export function markPatchesApplied(sha) {
|
||||||
|
writeAppliedStamp(sha == null ? installedRev() : sha);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 先把宿主文件从备份还原,再按当前这份插件的补丁重写。
|
* 先把宿主文件从备份还原,再按当前这份插件的补丁重写。
|
||||||
* 低版本带着自己的补丁列表,高版本带着自己的;回退到哪一版就打哪一版。
|
* 低版本带着自己的补丁列表,高版本带着自己的;回退到哪一版就打哪一版。
|
||||||
@@ -103,6 +108,7 @@ export async function reapplyInstalled(options = {}) {
|
|||||||
}
|
}
|
||||||
const summary = core.summarizeApplyReport(report);
|
const summary = core.summarizeApplyReport(report);
|
||||||
writeAppliedStamp(installedRev());
|
writeAppliedStamp(installedRev());
|
||||||
|
const pending = Boolean(handoff?.asar && !renamed && options.scheduleSwap !== false);
|
||||||
return {
|
return {
|
||||||
ok: true,
|
ok: true,
|
||||||
version: pluginVersion(),
|
version: pluginVersion(),
|
||||||
@@ -110,7 +116,7 @@ export async function reapplyInstalled(options = {}) {
|
|||||||
applied: summary.applied || 0,
|
applied: summary.applied || 0,
|
||||||
failed: summary.failed.length,
|
failed: summary.failed.length,
|
||||||
renamed,
|
renamed,
|
||||||
needsFullQuit: renamed || core.officialHostMustStayUp(),
|
needsFullQuit: renamed || pending || core.officialHostMustStayUp(),
|
||||||
cmdFlashOk: flash.ok === true,
|
cmdFlashOk: flash.ok === true,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
+4
-1
@@ -107,11 +107,14 @@ export function latestStableVersion(versions) {
|
|||||||
return best;
|
return best;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 正式版已经追上的测试版不再列出。1.1.11-beta 始终下线。 */
|
/** 正式版已经追上的旧测试版标签不再列出。1.1.11-beta 始终下线。
|
||||||
|
* 正式/测试是并行通道(测试带红队等),beta 分支 tip 始终保留,避免 1.1.25 正式把 1.1.25-beta 整通道藏掉。 */
|
||||||
export function hideListedVersion(item, stableVersion = "") {
|
export function hideListedVersion(item, stableVersion = "") {
|
||||||
if (!item || withdrawnVersion(item)) return true;
|
if (!item || withdrawnVersion(item)) return true;
|
||||||
const beta = item.channel === "beta" || isBetaName(item.version) || isBetaName(item.ref) || isBetaName(item.id);
|
const beta = item.channel === "beta" || isBetaName(item.version) || isBetaName(item.ref) || isBetaName(item.id);
|
||||||
if (!beta) return false;
|
if (!beta) return false;
|
||||||
|
// 并行测试通道 tip:始终可见。
|
||||||
|
if (item.ref === BETA_REF || item.kind === "head") return false;
|
||||||
const ceiling = String(stableVersion || "").replace(/^v/i, "");
|
const ceiling = String(stableVersion || "").replace(/^v/i, "");
|
||||||
if (!ceiling || isBetaName(ceiling)) return false;
|
if (!ceiling || isBetaName(ceiling)) return false;
|
||||||
const ver = String(item.version || item.ref || item.id || "").replace(/^v/i, "");
|
const ver = String(item.version || item.ref || item.id || "").replace(/^v/i, "");
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "dsh-purge",
|
"name": "dsh-purge",
|
||||||
"version": "1.1.25",
|
"version": "1.1.27",
|
||||||
"description": "DeepSeek Harness 网络安全红队工具:本机官方 Harness 受控评测与清洗,不同模型可换不同提示词;默认提示词面向国模「小码酱」。求 Star ⭐",
|
"description": "DeepSeek Harness 网络安全红队工具:本机官方 Harness 受控评测与清洗,不同模型可换不同提示词;默认提示词面向国模「小码酱」。求 Star ⭐",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"main": "lib/index.js",
|
"main": "lib/index.js",
|
||||||
|
|||||||
@@ -1,3 +1,28 @@
|
|||||||
|
# 1.1.27
|
||||||
|
|
||||||
|
## 中文
|
||||||
|
|
||||||
|
- **修复应用重启后进规则设定仍弹「需要重启」**:手动「应用」成功后写入 `applied` 戳,重启后 settle 不再误判补丁未对齐。
|
||||||
|
- 点「重启」清掉 `boot_full_quit` 粘性标记;status 按布尔值同步弹窗。
|
||||||
|
- web `waitForRestart` 必须先看到旧进程掉线再判定成功,避免同进程误刷新又弹窗。
|
||||||
|
|
||||||
|
## English
|
||||||
|
|
||||||
|
- **Fix restart prompt still showing after Apply + successful restart**: write the `applied` stamp on successful manual Apply so settle does not think patches are out of date.
|
||||||
|
- Clear sticky `boot_full_quit` when Restart is clicked; status syncs the modal from the boolean.
|
||||||
|
- Web `waitForRestart` requires the old process to go down before treating restart as success, avoiding same-process false refresh.
|
||||||
|
|
||||||
|
# 1.1.26
|
||||||
|
|
||||||
|
## 中文
|
||||||
|
|
||||||
|
- **修复测试通道被正式版同号藏掉**:`1.1.25` 正式发布后,`1.1.25-beta.*` 因「正式已追上」逻辑整通道不可见;现 **beta 分支 tip 始终列出**(正式/测试并行,测试带红队)。
|
||||||
|
- 已追上的旧 beta **标签**仍会隐藏;`1.1.11-beta` 仍下线。
|
||||||
|
|
||||||
|
## English
|
||||||
|
|
||||||
|
- **Fix beta lane hidden by same-number stable**: after `1.1.25` stable, `1.1.25-beta.*` vanished via the “stable caught up” filter; the **beta branch tip always stays listed** (parallel channels; beta carries red-team).
|
||||||
|
- Older caught-up beta **tags** still hide; `1.1.11-beta` stays withdrawn.
|
||||||
# 1.1.25
|
# 1.1.25
|
||||||
|
|
||||||
## 中文
|
## 中文
|
||||||
|
|||||||
@@ -40,17 +40,18 @@ const caughtUp = [
|
|||||||
];
|
];
|
||||||
const ceiling = latestStableVersion(caughtUp);
|
const ceiling = latestStableVersion(caughtUp);
|
||||||
assert.equal(ceiling, "1.1.12");
|
assert.equal(ceiling, "1.1.12");
|
||||||
assert.equal(hideListedVersion(caughtUp[2], ceiling), true);
|
assert.equal(hideListedVersion(caughtUp[2], ceiling), true); // 已追上的旧 beta 标签仍隐藏
|
||||||
assert.equal(hideListedVersion(caughtUp[3], ceiling), true);
|
assert.equal(hideListedVersion(caughtUp[3], ceiling), false); // beta 分支 tip 始终保留(并行通道)
|
||||||
assert.equal(hideListedVersion(caughtUp[4], ceiling), false);
|
assert.equal(hideListedVersion(caughtUp[4], ceiling), false);
|
||||||
assert.equal(hideListedVersion({ ref: "v1.1.11-beta.1", version: "1.1.11-beta.1", channel: "beta" }, ""), true);
|
assert.equal(hideListedVersion({ ref: "v1.1.11-beta.1", version: "1.1.11-beta.1", channel: "beta" }, ""), true);
|
||||||
|
|
||||||
const visible = caughtUp.filter((item) => !hideListedVersion(item, ceiling));
|
const visible = caughtUp.filter((item) => !hideListedVersion(item, ceiling));
|
||||||
assert.deepEqual(visible.map((item) => item.ref), ["master", "v1.1.12", "v1.1.13-beta.1"]);
|
assert.deepEqual(visible.map((item) => item.ref), ["master", "v1.1.12", "beta", "v1.1.13-beta.1"]);
|
||||||
const staleSha = "423a91614baa747b56749003d054fedb8e725714";
|
const staleSha = "423a91614baa747b56749003d054fedb8e725714";
|
||||||
const shown = markCurrent(visible, { channel: "stable", pin: "" }, "1.1.12", staleSha);
|
const shown = markCurrent(visible, { channel: "stable", pin: "" }, "1.1.12", staleSha);
|
||||||
assert.equal(shown.find((item) => item.ref === "master").current, true);
|
assert.equal(shown.find((item) => item.ref === "master").current, true);
|
||||||
assert.equal(shown.find((item) => item.ref === "v1.1.12").current, false);
|
assert.equal(shown.find((item) => item.ref === "v1.1.12").current, false);
|
||||||
|
assert.equal(shown.find((item) => item.ref === "beta").current, false);
|
||||||
assert.equal(shown.find((item) => item.ref === "v1.1.13-beta.1").current, false);
|
assert.equal(shown.find((item) => item.ref === "v1.1.13-beta.1").current, false);
|
||||||
|
|
||||||
console.log("ok: update guards");
|
console.log("ok: update guards");
|
||||||
Reference in new issue
Block a user