mirror of
https://github.com/YuJunZhiXue/dsh-purge.git
synced 2026-11-28 06:40:22 +08:00
docs: 按网络安全红队表述改 README,补严正声明
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
ff61342936
commit
443f23136c
6 files changed
+106
-71
No files matched your search
+9
-7
@@ -13,7 +13,6 @@ import {
|
||||
revertHideConsoleFromBin,
|
||||
} from "./hide-console.js";
|
||||
import * as desktop from "./desktop.js";
|
||||
import { defaultPromptInjectText } from "./default-prompt-data.js";
|
||||
import { adapterFor, detectSurface } from "./surface.js";
|
||||
|
||||
const isWindows = process.platform === "win32";
|
||||
@@ -4227,14 +4226,16 @@ export function hashOverride(text) {
|
||||
}
|
||||
|
||||
export function defaultOverrideText() {
|
||||
try {
|
||||
if (fs.existsSync(DEFAULT_OVERRIDE_FILE)) {
|
||||
return fs.readFileSync(DEFAULT_OVERRIDE_FILE, "utf8");
|
||||
const extra = String(process.env.DSH_PURGE_DEFAULT_PROMPT || "").trim();
|
||||
const candidates = extra ? [extra, DEFAULT_OVERRIDE_FILE] : [DEFAULT_OVERRIDE_FILE];
|
||||
for (const fp of candidates) {
|
||||
try {
|
||||
if (fp && fs.existsSync(fp)) return fs.readFileSync(fp, "utf8");
|
||||
} catch {
|
||||
/* next */
|
||||
}
|
||||
} catch {
|
||||
/* use embedded seed */
|
||||
}
|
||||
return defaultPromptInjectText();
|
||||
return "";
|
||||
}
|
||||
|
||||
export function defaultOverrideHash() {
|
||||
@@ -4333,6 +4334,7 @@ export async function installOverride(dshHome, force = false) {
|
||||
await fsp.mkdir(dshHome, { recursive: true });
|
||||
if (!force && await isUserCustomizedOverride(dshHome)) return "exists";
|
||||
const bundled = defaultOverrideText();
|
||||
if (!normalizeOverride(bundled)) return fs.existsSync(fp) ? "empty" : "missing";
|
||||
await fsp.writeFile(fp, bundled, "utf8");
|
||||
await markOverrideCustomized(dshHome, false, bundled);
|
||||
return "wrote";
|
||||
|
||||
Reference in new issue
Block a user