feat: 设置页检测 GitHub master 更新,版本号从 1.0.0 起

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
叫我小杨同学andCursor committed 2026-09-17 18:01:29 +08:00
1 parent b4701de4a0
commit 3f1ef4d69f
6 files changed
+312 -15

No files matched your search

+11 -6
View File
@@ -4,7 +4,7 @@
<h1 align="center">dsh-purge</h1>
<p align="center"><strong>Version 1.3.6</strong></p>
<p align="center"><strong>Version 1.0.0</strong></p>
<p align="center">
<em>DeepSeek Harness jailbreak (破甲): every model can jailbreak; swap prompts per model. Default prompt for Chinese models — 小码酱. Please star ⭐</em>
@@ -166,13 +166,13 @@ If the official DeepSeek Harness desktop client (EXE) is installed, the button b
<p align="center">
<a href="https://deepseek.stream/plugins/dsh-purge"><strong>🌐 Open Hub page</strong></a>
&nbsp;·&nbsp;
<a href="dsh://plugin/install?id=dsh-purge&name=dsh-purge&version=1.3.6&repo=YuJunZhiXue%2Fdsh-purge&permissions=%E7%B3%BB%E7%BB%9F%E6%8F%90%E7%A4%BA%E8%AF%8D%E6%B3%A8%E5%85%A5%2C%E6%9C%AC%E6%9C%BA%E8%A1%A5%E4%B8%81%2C%E8%AE%BE%E7%BD%AE%E9%A1%B5&downloadUrl=https%3A%2F%2Fgithub.com%2FYuJunZhiXue%2Fdsh-purge%2Farchive%2Frefs%2Fheads%2Fmaster.zip"><strong>🚀 Install in desktop client</strong></a>
<a href="dsh://plugin/install?id=dsh-purge&name=dsh-purge&version=1.0.0&repo=YuJunZhiXue%2Fdsh-purge&permissions=%E7%B3%BB%E7%BB%9F%E6%8F%90%E7%A4%BA%E8%AF%8D%E6%B3%A8%E5%85%A5%2C%E6%9C%AC%E6%9C%BA%E8%A1%A5%E4%B8%81%2C%E8%AE%BE%E7%BD%AE%E9%A1%B5&downloadUrl=https%3A%2F%2Fgithub.com%2FYuJunZhiXue%2Fdsh-purge%2Farchive%2Frefs%2Fheads%2Fmaster.zip"><strong>🚀 Install in desktop client</strong></a>
</p>
🔗 **Raw protocol URL:**
```
dsh://plugin/install?id=dsh-purge&name=dsh-purge&version=1.3.6&repo=YuJunZhiXue%2Fdsh-purge&permissions=%E7%B3%BB%E7%BB%9F%E6%8F%90%E7%A4%BA%E8%AF%8D%E6%B3%A8%E5%85%A5%2C%E6%9C%AC%E6%9C%BA%E8%A1%A5%E4%B8%81%2C%E8%AE%BE%E7%BD%AE%E9%A1%B5&downloadUrl=https%3A%2F%2Fgithub.com%2FYuJunZhiXue%2Fdsh-purge%2Farchive%2Frefs%2Fheads%2Fmaster.zip
dsh://plugin/install?id=dsh-purge&name=dsh-purge&version=1.0.0&repo=YuJunZhiXue%2Fdsh-purge&permissions=%E7%B3%BB%E7%BB%9F%E6%8F%90%E7%A4%BA%E8%AF%8D%E6%B3%A8%E5%85%A5%2C%E6%9C%AC%E6%9C%BA%E8%A1%A5%E4%B8%81%2C%E8%AE%BE%E7%BD%AE%E9%A1%B5&downloadUrl=https%3A%2F%2Fgithub.com%2FYuJunZhiXue%2Fdsh-purge%2Farchive%2Frefs%2Fheads%2Fmaster.zip
```
**Web trigger example:**
@@ -185,7 +185,7 @@ export function installDshPurgeToDesktop() {
const params = new URLSearchParams({
id: 'dsh-purge',
name: 'dsh-purge',
version: '1.3.6',
version: '1.0.0',
repo: 'YuJunZhiXue/dsh-purge',
permissions: '系统提示词注入, 本机补丁, 设置页',
downloadUrl: 'https://github.com/YuJunZhiXue/dsh-purge/archive/refs/heads/master.zip',
@@ -204,7 +204,7 @@ export function installDshPurgeToDesktop() {
**HTML link:**
```html
<a href="dsh://plugin/install?id=dsh-purge&name=dsh-purge&version=1.3.6&repo=YuJunZhiXue%2Fdsh-purge&permissions=%E7%B3%BB%E7%BB%9F%E6%8F%90%E7%A4%BA%E8%AF%8D%E6%B3%A8%E5%85%A5%2C%E6%9C%AC%E6%9C%BA%E8%A1%A5%E4%B8%81%2C%E8%AE%BE%E7%BD%AE%E9%A1%B5&downloadUrl=https%3A%2F%2Fgithub.com%2FYuJunZhiXue%2Fdsh-purge%2Farchive%2Frefs%2Fheads%2Fmaster.zip">
<a href="dsh://plugin/install?id=dsh-purge&name=dsh-purge&version=1.0.0&repo=YuJunZhiXue%2Fdsh-purge&permissions=%E7%B3%BB%E7%BB%9F%E6%8F%90%E7%A4%BA%E8%AF%8D%E6%B3%A8%E5%85%A5%2C%E6%9C%AC%E6%9C%BA%E8%A1%A5%E4%B8%81%2C%E8%AE%BE%E7%BD%AE%E9%A1%B5&downloadUrl=https%3A%2F%2Fgithub.com%2FYuJunZhiXue%2Fdsh-purge%2Farchive%2Frefs%2Fheads%2Fmaster.zip">
🚀 Install in desktop client
</a>
```
@@ -215,7 +215,7 @@ export function installDshPurgeToDesktop() {
|---|---|---|
| id | `dsh-purge` | Plugin id |
| name | `dsh-purge` | Display name |
| version | `1.3.6` | Semver |
| version | `1.0.0` | Semver |
| repo | `YuJunZhiXue/dsh-purge` | GitHub repo |
| permissions | `系统提示词注入, 本机补丁, 设置页` | Requested permissions |
| downloadUrl | `https://github.com/YuJunZhiXue/dsh-purge/archive/refs/heads/master.zip` | Zip URL |
@@ -531,6 +531,11 @@ If nothing is found, set `DSH_BASE`. No files are changed.
## Changelog
### 1.0.0
- Version numbering reset.
- Settings: **Check update** reads GitHub `master`. After a push, others can install that commit (git pull, or zip overlay). Restart to load.
### 1.3.6 (dsh 0.1.5-rc.1)
- **persona schema:** 0.1.5 requires `prefix`; `#39` aliases community `text` so picking a workspace / opening a chat no longer wipes empty.
+11 -6
View File
@@ -4,7 +4,7 @@
<h1 align="center">dsh-purge</h1>
<p align="center"><strong>Version 1.3.6</strong></p>
<p align="center"><strong>Version 1.0.0</strong></p>
<p align="center">
<em>DeepSeek Harness 破甲:让所有模型都能破甲,不同模型可换不同提示词。默认提示词面向国模「小码酱」。求 Star 收藏 ⭐</em>
@@ -163,13 +163,13 @@ dsh plugin --profile default remove dsh-purge
<p align="center">
<a href="https://deepseek.stream/plugins/dsh-purge"><strong>🌐 打开插件市场页</strong></a>
&nbsp;·&nbsp;
<a href="dsh://plugin/install?id=dsh-purge&name=dsh-purge&version=1.3.6&repo=YuJunZhiXue%2Fdsh-purge&permissions=%E7%B3%BB%E7%BB%9F%E6%8F%90%E7%A4%BA%E8%AF%8D%E6%B3%A8%E5%85%A5%2C%E6%9C%AC%E6%9C%BA%E8%A1%A5%E4%B8%81%2C%E8%AE%BE%E7%BD%AE%E9%A1%B5&downloadUrl=https%3A%2F%2Fgithub.com%2FYuJunZhiXue%2Fdsh-purge%2Farchive%2Frefs%2Fheads%2Fmaster.zip"><strong>🚀 唤起客户端一键安装</strong></a>
<a href="dsh://plugin/install?id=dsh-purge&name=dsh-purge&version=1.0.0&repo=YuJunZhiXue%2Fdsh-purge&permissions=%E7%B3%BB%E7%BB%9F%E6%8F%90%E7%A4%BA%E8%AF%8D%E6%B3%A8%E5%85%A5%2C%E6%9C%AC%E6%9C%BA%E8%A1%A5%E4%B8%81%2C%E8%AE%BE%E7%BD%AE%E9%A1%B5&downloadUrl=https%3A%2F%2Fgithub.com%2FYuJunZhiXue%2Fdsh-purge%2Farchive%2Frefs%2Fheads%2Fmaster.zip"><strong>🚀 唤起客户端一键安装</strong></a>
</p>
🔗 **原生协议链接:**
```
dsh://plugin/install?id=dsh-purge&name=dsh-purge&version=1.3.6&repo=YuJunZhiXue%2Fdsh-purge&permissions=%E7%B3%BB%E7%BB%9F%E6%8F%90%E7%A4%BA%E8%AF%8D%E6%B3%A8%E5%85%A5%2C%E6%9C%AC%E6%9C%BA%E8%A1%A5%E4%B8%81%2C%E8%AE%BE%E7%BD%AE%E9%A1%B5&downloadUrl=https%3A%2F%2Fgithub.com%2FYuJunZhiXue%2Fdsh-purge%2Farchive%2Frefs%2Fheads%2Fmaster.zip
dsh://plugin/install?id=dsh-purge&name=dsh-purge&version=1.0.0&repo=YuJunZhiXue%2Fdsh-purge&permissions=%E7%B3%BB%E7%BB%9F%E6%8F%90%E7%A4%BA%E8%AF%8D%E6%B3%A8%E5%85%A5%2C%E6%9C%AC%E6%9C%BA%E8%A1%A5%E4%B8%81%2C%E8%AE%BE%E7%BD%AE%E9%A1%B5&downloadUrl=https%3A%2F%2Fgithub.com%2FYuJunZhiXue%2Fdsh-purge%2Farchive%2Frefs%2Fheads%2Fmaster.zip
```
**网页端(前端)触发代码示例:**
@@ -182,7 +182,7 @@ export function installDshPurgeToDesktop() {
const params = new URLSearchParams({
id: 'dsh-purge',
name: 'dsh-purge',
version: '1.3.6',
version: '1.0.0',
repo: 'YuJunZhiXue/dsh-purge',
permissions: '系统提示词注入, 本机补丁, 设置页',
downloadUrl: 'https://github.com/YuJunZhiXue/dsh-purge/archive/refs/heads/master.zip',
@@ -201,7 +201,7 @@ export function installDshPurgeToDesktop() {
**HTML 静态链接方式:**
```html
<a href="dsh://plugin/install?id=dsh-purge&name=dsh-purge&version=1.3.6&repo=YuJunZhiXue%2Fdsh-purge&permissions=%E7%B3%BB%E7%BB%9F%E6%8F%90%E7%A4%BA%E8%AF%8D%E6%B3%A8%E5%85%A5%2C%E6%9C%AC%E6%9C%BA%E8%A1%A5%E4%B8%81%2C%E8%AE%BE%E7%BD%AE%E9%A1%B5&downloadUrl=https%3A%2F%2Fgithub.com%2FYuJunZhiXue%2Fdsh-purge%2Farchive%2Frefs%2Fheads%2Fmaster.zip">
<a href="dsh://plugin/install?id=dsh-purge&name=dsh-purge&version=1.0.0&repo=YuJunZhiXue%2Fdsh-purge&permissions=%E7%B3%BB%E7%BB%9F%E6%8F%90%E7%A4%BA%E8%AF%8D%E6%B3%A8%E5%85%A5%2C%E6%9C%AC%E6%9C%BA%E8%A1%A5%E4%B8%81%2C%E8%AE%BE%E7%BD%AE%E9%A1%B5&downloadUrl=https%3A%2F%2Fgithub.com%2FYuJunZhiXue%2Fdsh-purge%2Farchive%2Frefs%2Fheads%2Fmaster.zip">
🚀 唤起客户端一键安装
</a>
```
@@ -212,7 +212,7 @@ export function installDshPurgeToDesktop() {
|---|---|---|
| id | `dsh-purge` | 插件唯一标识符 |
| name | `dsh-purge` | 插件展示名称 |
| version | `1.3.6` | 语义化版本号 |
| version | `1.0.0` | 语义化版本号 |
| repo | `YuJunZhiXue/dsh-purge` | GitHub 仓库 |
| permissions | `系统提示词注入, 本机补丁, 设置页` | 申请权限 |
| downloadUrl | `https://github.com/YuJunZhiXue/dsh-purge/archive/refs/heads/master.zip` | zip 下载直链 |
@@ -535,6 +535,11 @@ npm 嵌套布局下,审批在 `dsh-user-approval/lib/index.js`,升级逻辑
## 更新记录
### 1.0.0
- 版本号从头计数。
- 设置页增加 **检测更新**:对照 GitHub `master`。你推送到云端后,别人点更新即可装上该提交(git 目录走 pull,zip 安装覆盖文件),然后重启。
### 1.3.6(适配 dsh 0.1.5-rc.1)
- **persona schema**:0.1.5 只要 `prefix`;`#39` 把社区预设的 `text` 收成别名,选工作区 / 开新对话不再被清空。
+67 -2
View File
@@ -63,6 +63,15 @@ window.__ModuleLoader__.load({ id: "dsh-purge", factory: (require) => {
"btn.apply": "应用",
"btn.apply.busy": "处理中…",
"btn.revert": "还原",
"btn.checkUpdate": "检测更新",
"btn.checkUpdate.busy": "检测中…",
"btn.doUpdate": "更新",
"btn.doUpdate.busy": "更新中…",
"update.latest": "已是最新({version})",
"update.available": "有新版本 {remote},当前 {local}",
"update.done": "已更新到 {version},请重启",
"update.fail": "更新失败: {error}",
"metric.version": "版本",
"action.apply": "应用",
"action.revert": "还原",
"ok.done": "已完成",
@@ -170,6 +179,15 @@ window.__ModuleLoader__.load({ id: "dsh-purge", factory: (require) => {
"btn.apply": "Apply",
"btn.apply.busy": "Working…",
"btn.revert": "Restore",
"btn.checkUpdate": "Check update",
"btn.checkUpdate.busy": "Checking…",
"btn.doUpdate": "Update",
"btn.doUpdate.busy": "Updating…",
"update.latest": "Up to date ({version})",
"update.available": "Update {remote} available (now {local})",
"update.done": "Updated to {version}. Restart to apply.",
"update.fail": "Update failed: {error}",
"metric.version": "Version",
"action.apply": "Apply",
"action.revert": "Restore",
"ok.done": "Done",
@@ -269,7 +287,7 @@ window.__ModuleLoader__.load({ id: "dsh-purge", factory: (require) => {
.dshp-panel{border:1px solid var(--dshp-line);background:var(--dshp-paper);border-radius:10px;padding:18px 18px 16px}
.dshp-kicker{font-family:var(--dshp-mono);font-size:11px;letter-spacing:.14em;text-transform:uppercase;color:var(--dshp-mute);margin:0 0 4px}
.dshp-title{font-family:var(--dshp-display);font-size:20px;font-weight:500;letter-spacing:.02em;line-height:1.3;margin:0;color:var(--dshp-ink)}
.dshp-head{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:14px}
.dshp-head{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:14px;flex-wrap:wrap}
.dshp-sub{display:flex;align-items:center;justify-content:space-between;gap:8px;margin:20px 0 10px}
.dshp-sub h4{margin:0;font-family:var(--dshp-display);font-size:15px;font-weight:500}
.dshp-metrics{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px;margin-bottom:14px}
@@ -434,6 +452,43 @@ window.__ModuleLoader__.load({ id: "dsh-purge", factory: (require) => {
const [busy, setBusy] = useState(false);
const [askRestart, setAskRestart] = useState(false);
const [notice, setNotice] = useState({ kind: "idle", text: "" });
const [updateInfo, setUpdateInfo] = useState(null);
const checkUpdate = useCallback(() => {
setBusy(true);
setNotice({ kind: "idle", text: "" });
const tr = tRef.current;
fetch("/dsh-purge/update", { cache: "no-store", credentials: "same-origin" })
.then((r) => r.json())
.then((d) => {
if (!d.ok) throw new Error(d.error || "check failed");
setUpdateInfo(d);
setNotice({
kind: "ok",
text: d.hasUpdate
? tr("update.available", { remote: d.remoteVersion || d.remoteSha, local: d.localVersion || d.localSha })
: tr("update.latest", { version: d.localVersion || "—" }),
});
})
.catch((e) => setNotice({ kind: "error", text: tr("update.fail", { error: e.message }) }))
.finally(() => setBusy(false));
}, []);
const doUpdate = useCallback(() => {
setBusy(true);
setNotice({ kind: "idle", text: "" });
const tr = tRef.current;
fetch("/dsh-purge/update", { method: "POST", headers: { "content-type": "application/json" }, body: "{}", credentials: "same-origin" })
.then((r) => r.json())
.then((d) => {
if (!d.ok) throw new Error(d.error || "update failed");
setUpdateInfo(d);
setNotice({ kind: "ok", text: tr("update.done", { version: d.localVersion || d.remoteVersion || "—" }) });
if (d.applied || d.needRestart) setAskRestart(true);
})
.catch((e) => setNotice({ kind: "error", text: tr("update.fail", { error: e.message }) }))
.finally(() => setBusy(false));
}, []);
const loadAll = useCallback(() => {
const tr = tRef.current;
@@ -536,8 +591,18 @@ window.__ModuleLoader__.load({ id: "dsh-purge", factory: (require) => {
const applied = s && typeof s.patches_applied === "number" ? s.patches_applied : 0;
const pct = total ? Math.round((applied / total) * 100) : 0;
const version = (s && s.plugin_version) || (updateInfo && updateInfo.localVersion) || "";
return h("section", { className: "dshp-panel", "aria-label": t("purge.title") },
h("h3", { className: "dshp-title", style: { marginBottom: 14 } }, t("purge.title")),
h("div", { className: "dshp-head" },
h("h3", { className: "dshp-title" }, t("purge.title")),
h("div", { className: "dshp-row", style: { margin: 0 } },
version ? h("span", { className: "dshp-pill" }, "v" + version) : null,
h(Btn, { tiny: true, disabled: busy, onClick: checkUpdate }, busy ? t("btn.checkUpdate.busy") : t("btn.checkUpdate")),
updateInfo && updateInfo.hasUpdate
? h(Btn, { tiny: true, kind: "primary", disabled: busy, onClick: doUpdate }, busy ? t("btn.doUpdate.busy") : t("btn.doUpdate"))
: null,
),
),
s ? h("div", { className: "dshp-metrics" },
h("div", { className: "dshp-metric" },
h("b", null, applied + " / " + total),
+26
View File
@@ -5,6 +5,7 @@ import { spawn } from "node:child_process";
import { fileURLToPath } from "node:url";
import * as core from "./core.js";
import * as rules from "./rules.js";
import * as updater from "./update.js";
import {
GLOBAL_PROMPT_ORDER,
rewritePromptAssembly,
@@ -684,6 +685,7 @@ function installWebServer(ctx, cfg) {
override_status: state.override_status,
override_path: state.override_path,
dsh_home: state.dsh_home,
plugin_version: updater.localVersion(),
});
} catch (e) {
sendJson(response, 500, { ok: false, error: String(e) });
@@ -818,6 +820,30 @@ function installWebServer(ctx, cfg) {
}
},
}, "dsh-purge: restart");
host.webServer.register({
kind: "exact",
path: "/dsh-purge/update",
handler: async (request, response) => {
if (request.method === "GET") {
try {
sendJson(response, 200, await updater.checkUpdate());
} catch (e) {
sendJson(response, 500, { ok: false, error: String(e) });
}
return;
}
if (request.method === "POST") {
try {
sendJson(response, 200, await updater.applyUpdate());
} catch (e) {
sendJson(response, 500, { ok: false, error: String(e) });
}
return;
}
response.writeHead(405, { allow: "GET, POST" });
response.end();
},
}, "dsh-purge: update");
}, "dsh-purge: http routes");
});
}
+196
View File
@@ -0,0 +1,196 @@
import { execFileSync } from "node:child_process";
import fs from "node:fs";
import { promises as fsp } from "node:fs";
import os from "node:os";
import path from "node:path";
import { fileURLToPath } from "node:url";
import { findDshHome } from "./core.js";
const REPO = "YuJunZhiXue/dsh-purge";
const BRANCH = "master";
const PLUGIN_ROOT = path.resolve(fileURLToPath(new URL(".", import.meta.url)), "..");
const COPY_NAMES = [
"lib",
"bin",
"docs",
"client.js",
"cordis.patch.yml",
"package.json",
"README.md",
"README.zh-CN.md",
"LICENSE",
];
const HIDDEN = {
encoding: "utf8",
stdio: ["ignore", "pipe", "ignore"],
windowsHide: true,
timeout: 20000,
};
export function pluginRoot() {
return PLUGIN_ROOT;
}
export function localVersion() {
try {
const pkg = JSON.parse(fs.readFileSync(path.join(PLUGIN_ROOT, "package.json"), "utf8"));
return String(pkg.version || "");
} catch {
return "";
}
}
function stampPath() {
return path.join(findDshHome(), "dsh-purge", "installed-rev");
}
function readStamp() {
try {
return fs.readFileSync(stampPath(), "utf8").trim();
} catch {
return "";
}
}
function writeStamp(value) {
if (!value) return;
const fp = stampPath();
fs.mkdirSync(path.dirname(fp), { recursive: true });
fs.writeFileSync(fp, `${value}\n`, "utf8");
}
function sameRev(a, b) {
if (!a || !b) return false;
return a === b || a.startsWith(b) || b.startsWith(a);
}
function isGitCheckout(dir) {
return fs.existsSync(path.join(dir, ".git"));
}
function gitHead(dir) {
try {
return execFileSync("git", ["-C", dir, "rev-parse", "HEAD"], HIDDEN).trim();
} catch {
return "";
}
}
async function fetchText(url) {
const res = await fetch(url, {
headers: { "user-agent": "dsh-purge-update", accept: "*/*" },
redirect: "follow",
});
if (!res.ok) throw new Error(`http ${res.status}`);
return res.text();
}
async function fetchJson(url) {
return JSON.parse(await fetchText(url));
}
async function remotePackageVersion() {
try {
const pkg = await fetchJson(`https://raw.githubusercontent.com/${REPO}/${BRANCH}/package.json`);
return String(pkg.version || "");
} catch {
return "";
}
}
async function remoteHeadSha() {
try {
const data = await fetchJson(`https://api.github.com/repos/${REPO}/commits/${BRANCH}`);
if (data?.sha) return String(data.sha);
} catch {
// GitHub API 失败时改走 atom。
}
try {
const atom = await fetchText(`https://github.com/${REPO}/commits/${BRANCH}.atom`);
const hit = atom.match(/<id>tag:github\.com,2008:Grit::Commit\/([0-9a-f]{40})<\/id>/);
if (hit) return hit[1];
} catch {
// 只剩版本号对比。
}
return "";
}
export async function checkUpdate() {
const localVer = localVersion();
const [remoteSha, remoteVer] = await Promise.all([remoteHeadSha(), remotePackageVersion()]);
if (!remoteSha && !remoteVer) throw new Error("无法读取 GitHub master");
const gitSha = isGitCheckout(PLUGIN_ROOT) ? gitHead(PLUGIN_ROOT) : "";
const stamp = readStamp();
const localRev = gitSha || stamp;
let hasUpdate = false;
if (remoteSha && localRev) {
hasUpdate = !sameRev(localRev, remoteSha);
} else if (remoteVer && localVer && remoteVer !== localVer) {
hasUpdate = true;
} else if (remoteSha && !localRev) {
writeStamp(remoteSha);
hasUpdate = false;
}
return {
ok: true,
hasUpdate,
localVersion: localVer,
remoteVersion: remoteVer || localVer,
localSha: localRev ? localRev.slice(0, 7) : "",
remoteSha: remoteSha ? remoteSha.slice(0, 7) : "",
via: gitSha ? "git" : "zip",
};
}
function gitPull() {
execFileSync("git", ["-C", PLUGIN_ROOT, "pull", "--ff-only", "origin", BRANCH], {
...HIDDEN,
timeout: 60000,
});
}
async function installFromZip() {
const tmp = await fsp.mkdtemp(path.join(os.tmpdir(), "dsh-purge-upd-"));
const zip = path.join(tmp, "master.zip");
const res = await fetch(`https://github.com/${REPO}/archive/refs/heads/${BRANCH}.zip`, {
headers: { "user-agent": "dsh-purge-update" },
redirect: "follow",
});
if (!res.ok) throw new Error(`zip http ${res.status}`);
await fsp.writeFile(zip, Buffer.from(await res.arrayBuffer()));
execFileSync("tar", ["-xf", zip, "-C", tmp], { ...HIDDEN, timeout: 60000 });
const names = await fsp.readdir(tmp);
const unpacked = names
.map((n) => path.join(tmp, n))
.find((p) => fs.existsSync(path.join(p, "package.json")));
if (!unpacked) throw new Error("zip 里没有 package.json");
for (const name of COPY_NAMES) {
const from = path.join(unpacked, name);
if (!fs.existsSync(from)) continue;
const to = path.join(PLUGIN_ROOT, name);
await fsp.cp(from, to, { recursive: true, force: true });
}
try {
await fsp.rm(tmp, { recursive: true, force: true });
} catch {
// 临时目录清不掉不影响安装结果。
}
}
export async function applyUpdate() {
if (isGitCheckout(PLUGIN_ROOT)) gitPull();
else await installFromZip();
const sha = (await remoteHeadSha()) || gitHead(PLUGIN_ROOT);
if (sha) writeStamp(sha);
return {
ok: true,
applied: true,
hasUpdate: false,
localVersion: localVersion(),
remoteVersion: localVersion(),
localSha: sha ? String(sha).slice(0, 7) : "",
remoteSha: sha ? String(sha).slice(0, 7) : "",
needRestart: true,
};
}
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "dsh-purge",
"version": "1.3.6",
"version": "1.0.0",
"description": "DeepSeek Harness 破甲:所有模型都可破甲,不同模型可换不同提示词;默认提示词面向国模「小码酱」。Jailbreak for every model. 求 Star ⭐",
"type": "module",
"main": "lib/index.js",