mirror of
https://github.com/YuJunZhiXue/dsh-purge.git
synced 2026-11-28 10:50:22 +08:00
fix: 收录 DSH NEXT 识别与单测(#174 #175)
Co-authored-by: Cursor <cursoragent@cursor.com> #171/#173 已在 1.1.80;#174 按官方 asar 路径认 DSH NEXT,不把任意 app.asar 当桌面。
This commit is contained in:
1 parent
fee23ac031
commit
5344d7e1cb
14 files changed
+322
-862
No files matched your search
+35
-7
@@ -118,6 +118,12 @@ export function looksLikeDesktopName(p) {
|
||||
n.endsWith("/dsh desktop") ||
|
||||
n.endsWith("/dsh desktop.app") ||
|
||||
n.includes("dsh-desktop") ||
|
||||
n.includes("/dsh next/") ||
|
||||
n.includes("/dsh next.app/") ||
|
||||
n.endsWith("/dsh next") ||
|
||||
n.endsWith("/dsh next.app") ||
|
||||
n.includes("dsh-next") ||
|
||||
n.includes("dsh-desktop-next") ||
|
||||
n.includes("/deepseek harness/") ||
|
||||
n.includes("/deepseek-harness/") ||
|
||||
n.includes("/deepseekharness") ||
|
||||
@@ -130,6 +136,7 @@ export function looksLikeDesktopName(p) {
|
||||
n.endsWith("/deepseek bot") ||
|
||||
n.endsWith("/deepseek bot.app") ||
|
||||
/\/dsh desktop\.exe$/i.test(n) ||
|
||||
/\/dsh next\.exe$/i.test(n) ||
|
||||
/\/deepseek[\s._-]*harness\.exe$/i.test(n) ||
|
||||
/\/deepseek[\s._-]*bot\.exe$/i.test(n)
|
||||
);
|
||||
@@ -140,6 +147,10 @@ const OFFICIAL_HARNESS_BASES = new Set([
|
||||
"deepseek-harness.exe",
|
||||
"deepseek harness",
|
||||
"deepseek-harness",
|
||||
"dsh next.exe",
|
||||
"dsh next",
|
||||
"dsh-next.exe",
|
||||
"dsh-next",
|
||||
]);
|
||||
|
||||
/**
|
||||
@@ -164,11 +175,15 @@ export function looksLikeDesktopNameTail(p) {
|
||||
return (
|
||||
tail === "dsh desktop" ||
|
||||
tail === "dsh desktop.app" ||
|
||||
tail === "dsh next" ||
|
||||
tail === "dsh next.app" ||
|
||||
tail === "deepseek harness" ||
|
||||
tail === "deepseek harness.app" ||
|
||||
tail === "deepseek-harness" ||
|
||||
tail === "deepseekharness" ||
|
||||
/^dsh-desktop/.test(tail) ||
|
||||
/^dsh-next/.test(tail) ||
|
||||
/^dsh[\s._-]*next(\.exe)?$/.test(tail) ||
|
||||
/^deepseek[\s._-]*harness(\.exe)?$/.test(tail) ||
|
||||
tail === "deepseek bot" ||
|
||||
tail === "deepseek bot.app" ||
|
||||
@@ -185,15 +200,18 @@ function sameBase(name, expected) {
|
||||
export function isDesktopExecutable(fp) {
|
||||
const base = path.basename(String(fp || "")).toLowerCase();
|
||||
if (base === "dsh desktop.exe" || base === "dsh desktop") return true;
|
||||
if (base === "dsh next.exe" || base === "dsh next") return true;
|
||||
if (OFFICIAL_HARNESS_BASES.has(base)) return true;
|
||||
if (/^deepseek[\s._-]*bot(\.exe)?$/.test(base) || /^ds[\s._-]*bot(\.exe)?$/.test(base)) return true;
|
||||
if (/^dsh[\s._-]*next(\.exe)?$/.test(base)) return true;
|
||||
return /^deepseek[\s._-]*harness(\.exe)?$/.test(base);
|
||||
}
|
||||
|
||||
/** 只有官方 DeepSeek Harness 会把宿主封进 app.asar 并在「应用」时解开。第三方 DSH Desktop 不走这条。 */
|
||||
/** 官方 DeepSeek Harness 和带 asar 的 DSH NEXT 会解开 app.asar。第三方 DSH Desktop 不走这条。 */
|
||||
export function isOfficialHarnessExecutable(fp) {
|
||||
const base = path.basename(String(fp || "")).toLowerCase();
|
||||
if (OFFICIAL_HARNESS_BASES.has(base)) return true;
|
||||
if (/^dsh[\s._-]*next(\.exe)?$/.test(base)) return true;
|
||||
return /^deepseek[\s._-]*harness(\.exe)?$/.test(base);
|
||||
}
|
||||
|
||||
@@ -249,16 +267,20 @@ function exeCandidatesBeside(dir) {
|
||||
path.join(dir, "deepseek-harness"),
|
||||
path.join(dir, "DSH Desktop.exe"),
|
||||
path.join(dir, "DSH Desktop"),
|
||||
path.join(dir, "DSH NEXT.exe"),
|
||||
path.join(dir, "DSH NEXT"),
|
||||
path.join(dir, "DeepSeek Bot.exe"),
|
||||
path.join(dir, "DeepSeek-Bot.exe"),
|
||||
path.join(dir, "DeepSeek Bot"),
|
||||
path.join(dir, "MacOS", "DeepSeek Harness"),
|
||||
path.join(dir, "MacOS", "deepseek-harness"),
|
||||
path.join(dir, "MacOS", "DSH Desktop"),
|
||||
path.join(dir, "MacOS", "DSH NEXT"),
|
||||
path.join(dir, "MacOS", "DeepSeek Bot"),
|
||||
path.join(dir, "Contents", "MacOS", "DeepSeek Harness"),
|
||||
path.join(dir, "Contents", "MacOS", "deepseek-harness"),
|
||||
path.join(dir, "Contents", "MacOS", "DSH Desktop"),
|
||||
path.join(dir, "Contents", "MacOS", "DSH NEXT"),
|
||||
path.join(dir, "Contents", "MacOS", "DeepSeek Bot"),
|
||||
];
|
||||
}
|
||||
@@ -324,7 +346,7 @@ function trustedInstallDir(dir) {
|
||||
|
||||
const REGISTRY_INSTALL_SCRIPT = `
|
||||
[Console]::OutputEncoding = [System.Text.UTF8Encoding]::new($false)
|
||||
$names = @('DeepSeek Harness','DSH Desktop','DeepSeek Bot','DS Bot')
|
||||
$names = @('DeepSeek Harness','DSH Desktop','DSH NEXT','DeepSeek Bot','DS Bot')
|
||||
$roots = @(
|
||||
'HKCU:\\Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall',
|
||||
'HKLM:\\Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall',
|
||||
@@ -400,6 +422,7 @@ const PORTABLE_INSTALL_NAMES = [
|
||||
"DeepseekHarnessDesktop",
|
||||
"DeepSeekHarnessDesktop",
|
||||
"DSH Desktop",
|
||||
"DSH NEXT",
|
||||
"deepseek-harness",
|
||||
];
|
||||
|
||||
@@ -456,7 +479,7 @@ function walkParentsForOfficialExe(start, maxUp = 8) {
|
||||
|
||||
const PROCESS_EXE_SCRIPT = `
|
||||
[Console]::OutputEncoding = [System.Text.UTF8Encoding]::new($false)
|
||||
$re = 'DeepSeek Harness\\.exe$|deepseek-harness\\.exe$|DSH Desktop\\.exe$'
|
||||
$re = 'DeepSeek Harness\\.exe$|deepseek-harness\\.exe$|DSH Desktop\\.exe$|DSH NEXT\\.exe$'
|
||||
$paths = @(Get-CimInstance Win32_Process -ErrorAction SilentlyContinue |
|
||||
Where-Object { $_.ExecutablePath -and $_.ExecutablePath -match $re } |
|
||||
Select-Object -ExpandProperty ExecutablePath)
|
||||
@@ -505,7 +528,7 @@ $roots = @(
|
||||
[Environment]::GetFolderPath('Desktop'),
|
||||
[Environment]::GetFolderPath('CommonDesktopDirectory')
|
||||
) | Where-Object { $_ }
|
||||
$pats = @('*DeepSeek*Harness*.lnk','*DSH Desktop*.lnk','*deepseek-harness*.lnk')
|
||||
$pats = @('*DeepSeek*Harness*.lnk','*DSH Desktop*.lnk','*DSH NEXT*.lnk','*deepseek-harness*.lnk','*dsh-next*.lnk')
|
||||
$out = New-Object System.Collections.Generic.List[string]
|
||||
foreach ($root in $roots) {
|
||||
if (-not (Test-Path -LiteralPath $root)) { continue }
|
||||
@@ -585,23 +608,28 @@ export function commonDesktopInstallDirs(env = process.env, input = {}) {
|
||||
...extraDiscoveredInstallDirs(env, { discover }),
|
||||
path.join(local, "Programs", "DeepSeek Harness"),
|
||||
path.join(local, "Programs", "DSH Desktop"),
|
||||
path.join(local, "Programs", "DSH NEXT"),
|
||||
path.join(local, "Programs", "DeepSeek Bot"),
|
||||
path.join(local, "DeepSeek Harness"),
|
||||
path.join(local, "DSH NEXT"),
|
||||
path.join(local, "DeepSeek Bot"),
|
||||
...(pf
|
||||
? [path.join(pf, "DeepSeek Harness"), path.join(pf, "DSH Desktop"), path.join(pf, "DeepSeek Bot")]
|
||||
? [path.join(pf, "DeepSeek Harness"), path.join(pf, "DSH Desktop"), path.join(pf, "DSH NEXT"), path.join(pf, "DeepSeek Bot")]
|
||||
: []),
|
||||
...(pf86
|
||||
? [path.join(pf86, "DeepSeek Harness"), path.join(pf86, "DSH Desktop"), path.join(pf86, "DeepSeek Bot")]
|
||||
? [path.join(pf86, "DeepSeek Harness"), path.join(pf86, "DSH Desktop"), path.join(pf86, "DSH NEXT"), path.join(pf86, "DeepSeek Bot")]
|
||||
: []),
|
||||
"/Applications/DeepSeek Harness.app",
|
||||
"/Applications/DSH Desktop.app",
|
||||
"/Applications/DSH NEXT.app",
|
||||
"/Applications/DeepSeek Bot.app",
|
||||
path.join(home, "Applications", "DeepSeek Harness.app"),
|
||||
path.join(home, "Applications", "DSH Desktop.app"),
|
||||
path.join(home, "Applications", "DSH NEXT.app"),
|
||||
path.join(home, "Applications", "DeepSeek Bot.app"),
|
||||
"/opt/DeepSeek Harness",
|
||||
"/opt/deepseek-harness",
|
||||
"/opt/DSH NEXT",
|
||||
"/usr/lib/DeepSeek Harness",
|
||||
"/usr/lib/deepseek-harness",
|
||||
"/usr/share/deepseek-harness",
|
||||
@@ -923,7 +951,7 @@ const ASAR_SWAP_PS1 = [
|
||||
" [Parameter(Mandatory = $true)][string]$ExePath",
|
||||
")",
|
||||
"$ErrorActionPreference = 'Continue'",
|
||||
"$names = @('DeepSeek Harness', 'DSH Desktop')",
|
||||
"$names = @('DeepSeek Harness', 'DSH Desktop', 'DSH NEXT')",
|
||||
"$installRoot = (Split-Path -Parent $ExePath).TrimEnd('\\')",
|
||||
"$exeNorm = $ExePath.ToLower()",
|
||||
"function Stop-HarnessInstall {",
|
||||
|
||||
Reference in new issue
Block a user