mirror of
https://github.com/YuJunZhiXue/dsh-purge.git
synced 2026-11-28 10:10:22 +08:00
fix: 发布 1.1.47,演练台环境适配与首次用户须知。
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
81c48bf465
commit
b7c14005c3
13 files changed
+522
-297
No files matched your search
+28
-16
@@ -80,11 +80,14 @@ export function looksLikeDesktopName(p) {
|
||||
n.endsWith("/dsh desktop") ||
|
||||
n.endsWith("/dsh desktop.app") ||
|
||||
n.includes("dsh-desktop") ||
|
||||
n.includes("/deepseek harness/") ||
|
||||
n.includes("/deepseek-harness/") ||
|
||||
n.includes("/deepseekharness") ||
|
||||
/\/deepseek[\s._-]*harness(\/|$)/.test(n) ||
|
||||
n.includes("/deepseek harness.app/") ||
|
||||
n.endsWith("/deepseek harness.app") ||
|
||||
/\/dsh desktop\.exe$/i.test(n) ||
|
||||
/\/deepseek harness\.exe$/i.test(n) ||
|
||||
/\/deepseek-harness\.exe$/i.test(n)
|
||||
/\/deepseek[\s._-]*harness\.exe$/i.test(n)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -101,12 +104,16 @@ function sameBase(name, expected) {
|
||||
|
||||
export function isDesktopExecutable(fp) {
|
||||
const base = path.basename(String(fp || "")).toLowerCase();
|
||||
return base === "dsh desktop.exe" || base === "dsh desktop" || OFFICIAL_HARNESS_BASES.has(base);
|
||||
if (base === "dsh desktop.exe" || base === "dsh desktop") return true;
|
||||
if (OFFICIAL_HARNESS_BASES.has(base)) return true;
|
||||
return /^deepseek[\s._-]*harness(\.exe)?$/.test(base);
|
||||
}
|
||||
|
||||
/** 只有官方 DeepSeek Harness 会把宿主封进 app.asar 并在「应用」时解开。第三方 DSH Desktop 不走这条。 */
|
||||
export function isOfficialHarnessExecutable(fp) {
|
||||
return OFFICIAL_HARNESS_BASES.has(path.basename(String(fp || "")).toLowerCase());
|
||||
const base = path.basename(String(fp || "")).toLowerCase();
|
||||
if (OFFICIAL_HARNESS_BASES.has(base)) return true;
|
||||
return /^deepseek[\s._-]*harness(\.exe)?$/.test(base);
|
||||
}
|
||||
|
||||
/** 某个安装目录下可能的 resources 文件夹(mac 大小写敏感盘要 Resources 和 resources 都试)。 */
|
||||
@@ -267,7 +274,7 @@ function exeDirFromRegistryValue(value) {
|
||||
let cachedRegistryDirs;
|
||||
/** 从卸载登记读安装目录。盘符跟着用户安装位置,不写死。 */
|
||||
export function registryInstallDirs() {
|
||||
if (cachedRegistryDirs) return cachedRegistryDirs;
|
||||
if (cachedRegistryDirs !== undefined) return cachedRegistryDirs;
|
||||
if (process.platform !== "win32") {
|
||||
cachedRegistryDirs = [];
|
||||
return cachedRegistryDirs;
|
||||
@@ -280,15 +287,14 @@ export function registryInstallDirs() {
|
||||
timeout: 15000,
|
||||
});
|
||||
} catch {
|
||||
cachedRegistryDirs = [];
|
||||
return cachedRegistryDirs;
|
||||
return [];
|
||||
}
|
||||
let rows = [];
|
||||
try {
|
||||
const parsed = JSON.parse(String(text || "").replace(/^\uFEFF/, "").trim() || "[]");
|
||||
rows = Array.isArray(parsed) ? parsed : parsed ? [parsed] : [];
|
||||
} catch {
|
||||
rows = [];
|
||||
return [];
|
||||
}
|
||||
const found = [];
|
||||
for (const row of rows) {
|
||||
@@ -371,7 +377,7 @@ if ($paths) { @($paths) | ConvertTo-Json -Compress }
|
||||
|
||||
let cachedRunningExes;
|
||||
function runningOfficialExecutables() {
|
||||
if (cachedRunningExes) return cachedRunningExes;
|
||||
if (cachedRunningExes !== undefined) return cachedRunningExes;
|
||||
if (process.platform !== "win32") {
|
||||
cachedRunningExes = [];
|
||||
return cachedRunningExes;
|
||||
@@ -384,15 +390,15 @@ function runningOfficialExecutables() {
|
||||
timeout: 15000,
|
||||
});
|
||||
} catch {
|
||||
cachedRunningExes = [];
|
||||
return cachedRunningExes;
|
||||
// 探测失败不缓存空结果,否则整次进程都找不到正在跑的客户端。
|
||||
return [];
|
||||
}
|
||||
let rows = [];
|
||||
try {
|
||||
const parsed = JSON.parse(String(text || "").replace(/^\uFEFF/, "").trim() || "[]");
|
||||
rows = Array.isArray(parsed) ? parsed : parsed ? [parsed] : [];
|
||||
} catch {
|
||||
rows = [];
|
||||
return [];
|
||||
}
|
||||
cachedRunningExes = uniquePaths(rows.map((item) => String(item || "").trim()).filter((fp) => isDesktopExecutable(fp) && isFile(fp)));
|
||||
return cachedRunningExes;
|
||||
@@ -426,7 +432,7 @@ if ($out.Count) { @($out) | ConvertTo-Json -Compress }
|
||||
|
||||
let cachedShortcutExes;
|
||||
function shortcutOfficialExecutables() {
|
||||
if (cachedShortcutExes) return cachedShortcutExes;
|
||||
if (cachedShortcutExes !== undefined) return cachedShortcutExes;
|
||||
if (process.platform !== "win32") {
|
||||
cachedShortcutExes = [];
|
||||
return cachedShortcutExes;
|
||||
@@ -439,20 +445,26 @@ function shortcutOfficialExecutables() {
|
||||
timeout: 15000,
|
||||
});
|
||||
} catch {
|
||||
cachedShortcutExes = [];
|
||||
return cachedShortcutExes;
|
||||
return [];
|
||||
}
|
||||
let rows = [];
|
||||
try {
|
||||
const parsed = JSON.parse(String(text || "").replace(/^\uFEFF/, "").trim() || "[]");
|
||||
rows = Array.isArray(parsed) ? parsed : parsed ? [parsed] : [];
|
||||
} catch {
|
||||
rows = [];
|
||||
return [];
|
||||
}
|
||||
cachedShortcutExes = uniquePaths(rows.map((item) => String(item || "").trim()).filter((fp) => isDesktopExecutable(fp) && isFile(fp)));
|
||||
return cachedShortcutExes;
|
||||
}
|
||||
|
||||
/** 点「应用」前清掉失败的空缓存,重新找本机 exe。 */
|
||||
export function clearDesktopLocateCache() {
|
||||
cachedRunningExes = undefined;
|
||||
cachedShortcutExes = undefined;
|
||||
cachedRegistryDirs = undefined;
|
||||
}
|
||||
|
||||
function extraDiscoveredInstallDirs(env = process.env) {
|
||||
return uniquePaths([
|
||||
...homeSiblingInstalls(env),
|
||||
|
||||
Reference in new issue
Block a user