From bea3877f4dcd60f90da13df348f66ed197c53d67 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8F=AB=E6=88=91=E5=B0=8F=E6=9D=A8=E5=90=8C=E5=AD=A6?= <188421097+HunYiSage@users.noreply.github.com> Date: Fri, 18 Sep 2026 14:18:35 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20git=20=E5=BF=AB=E8=BF=9B=E5=A4=B1?= =?UTF-8?q?=E8=B4=A5=E6=97=B6=20reset=20=E6=88=96=20zip=20=E8=A6=86?= =?UTF-8?q?=E7=9B=96=EF=BC=8C=E6=9B=B4=E6=96=B0=E4=B8=8D=E5=86=8D=E6=95=B4?= =?UTF-8?q?=E6=AC=A1=E5=A4=B1=E8=B4=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 6 +++++- README.zh-CN.md | 6 +++++- lib/update.js | 41 +++++++++++++++++++++++++++++++++++------ package.json | 2 +- 4 files changed, 46 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 2d62a1f..c4cbc2a 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@
Version 1.1.4
+Version 1.1.5
DeepSeek Harness jailbreak (破甲): every model can jailbreak; swap prompts per model. Default prompt for Chinese models — 小码酱. Please star ⭐ @@ -537,6 +537,10 @@ If nothing is found, set `DSH_BASE`. No files are changed. ## Changelog +### 1.1.5 + +- Manual Update: if `git pull --ff-only` fails, fetch + reset to `origin/master`, then zip overlay. + ### 1.1.4 - Update check reads `package.json` at the GitHub commit SHA, instead of the stale jsDelivr `@master` cache or falling back to the local version. diff --git a/README.zh-CN.md b/README.zh-CN.md index 18d13cb..5e0043d 100644 --- a/README.zh-CN.md +++ b/README.zh-CN.md @@ -4,7 +4,7 @@
Version 1.1.4
+Version 1.1.5
DeepSeek Harness 破甲:让所有模型都能破甲,不同模型可换不同提示词。默认提示词面向国模「小码酱」。求 Star 收藏 ⭐ @@ -541,6 +541,10 @@ npm 嵌套布局下,审批在 `dsh-user-approval/lib/index.js`,升级逻辑 ## 更新记录 +### 1.1.5 + +- 点「更新」时:git 快进失败会 `fetch + reset`,再不行改用 zip 覆盖,不再整次失败。 + ### 1.1.4 - 检测更新按 GitHub 提交号读 `package.json`,不再误用 jsDelivr `@master` 缓存,也不会在读不到远端版本时显示成「有新版本 1.1.2,当前 1.1.2」。 diff --git a/lib/update.js b/lib/update.js index 91fcc4e..b77da2c 100644 --- a/lib/update.js +++ b/lib/update.js @@ -386,11 +386,35 @@ export function lastUpdateResult() { return lastUpdate; } +function runGit(dir, args, timeout = 20000) { + try { + return execFileSync("git", ["-C", dir, ...args], { + encoding: "utf8", + stdio: ["ignore", "pipe", "pipe"], + windowsHide: true, + timeout, + }); + } catch (e) { + const detail = [e.stderr, e.stdout, e.message].filter(Boolean).join("\n").trim(); + throw new Error(detail || `git ${args.join(" ")}`); + } +} + function gitPull(dir) { - execFileSync("git", ["-C", dir, "pull", "--ff-only", "origin", BRANCH], { - ...HIDDEN, - timeout: 60000, - }); + try { + runGit(dir, ["pull", "--ff-only", "origin", BRANCH], 60000); + return; + } catch (pullErr) { + try { + runGit(dir, ["fetch", "origin", BRANCH], 60000); + runGit(dir, ["reset", "--hard", `origin/${BRANCH}`], 60000); + return; + } catch (resetErr) { + throw new Error( + `git 更新失败(${dir}):${String(resetErr.message || resetErr).slice(0, 240)};${String(pullErr.message || pullErr).slice(0, 160)}`, + ); + } + } } function extractZip(zip, dest) { @@ -443,8 +467,13 @@ export async function applyUpdate(jobs = planUpdates()) { const vias = new Set(); for (const job of jobs) { if (job.kind === "git") { - gitPull(job.dir); - vias.add("git"); + try { + gitPull(job.dir); + vias.add("git"); + continue; + } catch { + zipDirs.push(job.dir); + } continue; } if (job.kind === "dsh") { diff --git a/package.json b/package.json index 9fd2678..8fc4182 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "dsh-purge", - "version": "1.1.4", + "version": "1.1.5", "description": "DeepSeek Harness 破甲:所有模型都可破甲,不同模型可换不同提示词;默认提示词面向国模「小码酱」。Jailbreak for every model. 求 Star ⭐", "type": "module", "main": "lib/index.js",