Files
dsh-enhancements/tools/dsh-app.ps1.README.md
T
江晨 096e5af69b fix: 修复 dsh.ico 帧偏移 bug + 托盘图标加固 + BOM 经验
- tools/repair-ico.ps1: 检测并修复 ICO 帧偏移量未计目录长度的损坏模式
- assets/dsh.ico: 已修复(原文件偏移全错,.NET Icon 无法加载)
- tools/dsh-app.ps1: 归档加固版托盘脚本(图标加载兜底)
- tools/dsh-app.ps1.README.md: 修复记录 + UTF-8 BOM 踩坑
2026-08-17 12:53:53 +08:00

29 lines
1.5 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# dsh-app.ps1 — DeepSeek Harness 托盘应用壳(归档参考版)
> 实际部署位置:`C:\Users\a1703\.dsh\bin\dsh-app.ps1`(桌面快捷方式 `DeepSeek Harness.lnk` 指向它)。
> 本文件为当前版本的归档副本。**必须保留 UTF-8 BOM**(见下方"踩坑"),
> 机器相关路径($DshBin 的 npx 缓存位置)在新机器需修改。
## 功能
- 双击快捷方式:检测 3080 端口 → 未运行则拉起 `node <dsh bin.js> web` → 托盘常驻
- 托盘右键:打开主界面(Edge `--app` 独立窗口)/ 退出(停止服务并退出)
- 单实例保护(Mutex
## 2026-08-17 修复记录
1. **托盘图标报错 `操作成功完成`**:根因是 `dsh.ico` 帧偏移量少算了目录长度(6+count*16),
.NET `System.Drawing.Icon` 无法解析。修复:`tools/repair-ico.ps1`(检测首帧偏移为 0 的
损坏模式 → 所有帧偏移 + 目录长度 → 验证)。本机 `dsh.ico` 与 web 前端 `favicon.ico` 均已修复。
2. **图标加载加固**`$notify.Icon` 加载失败时回退(同目录其他 .ico → 系统图标)并写日志。
## 踩坑:UTF-8 BOM 必须保留
- Windows PowerShell 5.1 读取**无 BOM** 的 .ps1 按 ANSI(GBK) 解析 → 中文变乱码、
引号被吞 → 整个脚本解析失败(表现为托盘静默退出)。
-`edit`/`write` 工具改写本文件后必须补 BOM
```powershell
$c = [System.IO.File]::ReadAllText($f, [System.Text.Encoding]::UTF8)
[System.IO.File]::WriteAllText($f, $c, (New-Object System.Text.UTF8Encoding($true)))
```