mirror of
https://github.com/YuJunZhiXue/dsh-purge.git
synced 2026-11-28 10:20:22 +08:00
1.1.73: adapt DSH 0.2.1-rc.2, Apache-2.0, lab-only default-deny.
This commit is contained in:
1 parent
8df4406a7c
commit
1ea067189c
114 files changed
+21198
-5183
No files matched your search
+1
-16
@@ -1,7 +1,7 @@
|
||||
import { createRequire } from "node:module";
|
||||
import { fileURLToPath } from "node:url";
|
||||
import path from "node:path";
|
||||
import { isAsarSealedPath, isInsideDesktopInstall } from "./desktop.js";
|
||||
import { isAsarSealedPath } from "./desktop.js";
|
||||
import { diskFs, fsFor } from "./extract-asar.js";
|
||||
|
||||
const MARK = "__dshPurgeHideConsole";
|
||||
@@ -232,26 +232,11 @@ export function resolveDshBinRoot(hint, { fs, path: nodePath } = {}) {
|
||||
|
||||
const IMPORT_LINE = `import "./${IMPORT_MARK}.js"; // [dsh-purge] hide-console`;
|
||||
|
||||
function isPackagedDesktopDshRoot(root) {
|
||||
if (!root) return false;
|
||||
const n = String(root).replace(/\\/g, "/").toLowerCase();
|
||||
if (n.includes("/resources/app/dsh")) return true;
|
||||
if (n.includes("deepseekharnessdesktop")) return true;
|
||||
try {
|
||||
return isInsideDesktopInstall(root);
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
export function installHideConsoleIntoBin(aiBase, { fs, path: nodePath } = {}) {
|
||||
if (process.platform !== "win32") return "skipped_not_win32";
|
||||
if (isElectronHost()) return "skipped_electron";
|
||||
const p = nodePath ?? requirePath();
|
||||
const root = resolveDshBinRoot(aiBase, { fs, path: p });
|
||||
if (!root) return "missing_bin";
|
||||
// 官方 / 社区桌面:改 bin.js 会让重启直接打不开。
|
||||
if (isPackagedDesktopDshRoot(root)) return "skipped_desktop";
|
||||
// 源码部署的 apps/cli/lib 是 tsdown 产物:只准读、不准写 sidecar / 改 bin.js(#41)。
|
||||
if (looksLikeSourceCliRoot(root, { fs, path: p })) return "skipped_source_cli";
|
||||
const nodeFs = ioFor(fs, root);
|
||||
|
||||
Reference in new issue
Block a user