dsh-auto-open-web 0.1.13 → 0.1.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.en.md +12 -3
- package/README.md +11 -3
- package/host-publish/DshAppWindow.exe +0 -0
- package/host-publish/DshAppWindow.exe.config +6 -0
- package/host-publish/DshAppWindow.pdb +0 -0
- package/host-publish/Microsoft.Web.WebView2.WinForms.dll +0 -0
- package/host-publish/Microsoft.Web.WebView2.Wpf.dll +0 -0
- package/host-publish/WebView2Loader.dll +0 -0
- package/lib/client.js +17 -6
- package/lib/index.js +53 -8
- package/package.json +1 -1
- package/host-publish/DshAppWindow.deps.json +0 -94
- package/host-publish/DshAppWindow.dll +0 -0
- package/host-publish/DshAppWindow.runtimeconfig.json +0 -20
- package/host-publish/Microsoft.Web.WebView2.Core.xml +0 -6662
- package/host-publish/Microsoft.Web.WebView2.WinForms.xml +0 -504
- package/host-publish/Microsoft.Web.WebView2.Wpf.xml +0 -1902
package/README.en.md
CHANGED
|
@@ -68,7 +68,11 @@ cleanup.
|
|
|
68
68
|
- Windows 10 1803+ / Windows 11 / Windows Server 2016+
|
|
69
69
|
(Win7/8.1 reached end of support in 2023-01, see Microsoft announcements)
|
|
70
70
|
- WebView2 Runtime (evergreen, usually preinstalled with Edge; verified with 151.x locally)
|
|
71
|
-
- .NET 10 runtime
|
|
71
|
+
- **No .NET 10 runtime required**: since 0.1.15 the host targets **.NET Framework 4.7.2**,
|
|
72
|
+
built into Windows 10 1803+ / Windows 11 (4.8.x on Win11) — no .NET Core/10 runtime or
|
|
73
|
+
self-contained publish is needed. The build machine needs a .NET SDK and the .NET
|
|
74
|
+
Framework 4.x targeting packs (installed with VS/SDK; without them add the
|
|
75
|
+
`Microsoft.NETFramework.ReferenceAssemblies` NuGet package to the csproj).
|
|
72
76
|
|
|
73
77
|
## Configuration
|
|
74
78
|
|
|
@@ -201,8 +205,13 @@ without touching the package.
|
|
|
201
205
|
plugin-generated DSH .ico (`~/.dsh/auto-open-web-icon.ico`), independent of browser taskbar
|
|
202
206
|
identity rules. The .ico is built by fetching the local `favicon.svg` and rasterizing it with
|
|
203
207
|
**sharp** (bundled with the deployment, resolved upward at runtime, not declared as a dependency)
|
|
204
|
-
into 16/32/48/64/128/256 PNGs
|
|
205
|
-
|
|
208
|
+
into 16/32/48/64/128/256 PNGs.
|
|
209
|
+
- **Fixed-icon policy (since 0.1.14)**: once written, the .ico is cached and reused — later
|
|
210
|
+
starts return the existing non-empty cache directly (no favicon fetch / rasterization, so the
|
|
211
|
+
icon cannot vanish on a transient favicon/sharp failure, and starts are faster); it is
|
|
212
|
+
generated only when the cache is missing. **Extra safety net**: `host/icon.ico` (same source as
|
|
213
|
+
the cache) is embedded into the host exe via `<ApplicationIcon>`, so even with a missing cache
|
|
214
|
+
the window/taskbar shows the DSH icon instead of the default one.
|
|
206
215
|
|
|
207
216
|
## Platform support
|
|
208
217
|
|
package/README.md
CHANGED
|
@@ -63,7 +63,11 @@ Job Object(强杀也生效)+ 退出清理结束进程树。
|
|
|
63
63
|
- Windows 10 1803+ / Windows 11 / Windows Server 2016+
|
|
64
64
|
(Win7/8.1 已于 2023-01 终止支持,见微软公告)
|
|
65
65
|
- WebView2 Runtime(常青版,通常随 Edge 预装;本机已验证 151.x)
|
|
66
|
-
- .NET 10
|
|
66
|
+
- **无 .NET 10 运行时要求**:宿主自 0.1.15 起目标 **.NET Framework 4.7.2**,
|
|
67
|
+
由 Windows 10 1803+ / Windows 11 **操作系统自带**(Win11 为 4.8.x),
|
|
68
|
+
无需安装任何 .NET Core/10/自包含运行时。构建机需 .NET SDK 与 .NET
|
|
69
|
+
Framework 4.x 定位包(随 VS/SDK 安装;无定位包时给 csproj 加
|
|
70
|
+
`Microsoft.NETFramework.ReferenceAssemblies` NuGet 包)。
|
|
67
71
|
|
|
68
72
|
## 配置
|
|
69
73
|
|
|
@@ -191,8 +195,12 @@ dsh plugin --profile web remove dsh-auto-open-web # 同时移除依赖与对
|
|
|
191
195
|
- **任务栏/窗口图标(WebView2 宿主)**:宿主进程直接设置 `Form.Icon` = 插件生成的
|
|
192
196
|
DSH .ico(`~/.dsh/auto-open-web-icon.ico`),与浏览器任务栏身份机制无关。
|
|
193
197
|
.ico 来源:抓取本机 `favicon.svg`,用 **sharp**(部署自带,运行时向上解析,
|
|
194
|
-
未声明为依赖)栅格化为 16/32/48/64/128/256 PNG
|
|
195
|
-
|
|
198
|
+
未声明为依赖)栅格化为 16/32/48/64/128/256 PNG 后组装。
|
|
199
|
+
- **图标固定策略(自 0.1.14)**:生成的 .ico 一经写盘即**缓存固定**——后续启动
|
|
200
|
+
检测到缓存存在且非空就直接复用,不再抓取 favicon/栅格化(图标不会因某次
|
|
201
|
+
favicon 或 sharp 瞬时失败而消失,启动也更快);仅缓存缺失时生成一次。
|
|
202
|
+
另有**兜底**:`host/icon.ico`(与缓存同源)已通过 `<ApplicationIcon>`
|
|
203
|
+
嵌入宿主 exe,即使缓存文件缺失,窗口/任务栏也显示 DSH 图标而非默认图标。
|
|
196
204
|
|
|
197
205
|
## 平台支持
|
|
198
206
|
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/lib/client.js
CHANGED
|
@@ -94,15 +94,26 @@ window.__ModuleLoader__.load({
|
|
|
94
94
|
injectCss(CONTROLS_TAG, CONTROLS_CSS)
|
|
95
95
|
|
|
96
96
|
// ── 共享模块 ─────────────────────────────────────────────────────────
|
|
97
|
-
//
|
|
98
|
-
//
|
|
99
|
-
|
|
97
|
+
// 快照 store 解析顺序(与 gowin 插件同款,双版本兼容):
|
|
98
|
+
// @deepseek-ai/dsh-client-store(当前壳层静态模块,dsh >= 0.1.2-alpha.1)
|
|
99
|
+
// → @deepseek-ai/dsh-client-runtime(rc8 动态包) → 内置最小实现。
|
|
100
|
+
// 缺失或版本不含 createSnapshotStore 时退化为内置实现,绝不抛错。
|
|
101
|
+
var createSnapshotStore = null
|
|
100
102
|
try {
|
|
101
|
-
|
|
103
|
+
createSnapshotStore = require('@deepseek-ai/dsh-client-store').createSnapshotStore
|
|
102
104
|
} catch (e) {
|
|
103
|
-
console.error('[auto-open-web]
|
|
105
|
+
console.error('[auto-open-web] dsh-client-store require failed:', e !== null && e !== undefined && e.message !== undefined ? e.message : String(e))
|
|
106
|
+
}
|
|
107
|
+
if (createSnapshotStore === undefined || createSnapshotStore === null) {
|
|
108
|
+
try {
|
|
109
|
+
createSnapshotStore = require('@deepseek-ai/dsh-client-runtime').createSnapshotStore
|
|
110
|
+
} catch (e) {
|
|
111
|
+
console.error('[auto-open-web] dsh-client-runtime require failed:', e !== null && e !== undefined && e.message !== undefined ? e.message : String(e))
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
if (createSnapshotStore === undefined || createSnapshotStore === null) {
|
|
115
|
+
createSnapshotStore = fallbackSnapshotStore
|
|
104
116
|
}
|
|
105
|
-
var createSnapshotStore = runtime !== null && runtime.createSnapshotStore !== undefined ? runtime.createSnapshotStore : fallbackSnapshotStore
|
|
106
117
|
function fallbackSnapshotStore(init) {
|
|
107
118
|
let value = init
|
|
108
119
|
const listeners = new Set()
|
package/lib/index.js
CHANGED
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
* (WebView2 宿主例外:随 DSH 退出而关闭)。
|
|
32
32
|
*/
|
|
33
33
|
import { spawn } from 'node:child_process';
|
|
34
|
-
import { existsSync, rmSync, writeFileSync } from 'node:fs';
|
|
34
|
+
import { existsSync, rmSync, statSync, writeFileSync } from 'node:fs';
|
|
35
35
|
import { createRequire } from 'node:module';
|
|
36
36
|
import { join } from 'node:path';
|
|
37
37
|
import { pathToFileURL } from 'node:url';
|
|
@@ -354,8 +354,13 @@ function normalizeState(next) {
|
|
|
354
354
|
// ── 图标栅格化(WebView2 宿主窗口图标需要 .ico;共通) ─────────────────────
|
|
355
355
|
//
|
|
356
356
|
// GUI 自带的 manifest 只有 SVG 图标(favicon.svg)。这里抓取本机 favicon.svg,
|
|
357
|
-
// 用 sharp(部署自带,运行时向上解析,未声明为依赖)栅格化为多尺寸 PNG
|
|
358
|
-
// 再组装成 .ico 供宿主窗口的 Form.Icon 使用;失败仅告警(
|
|
357
|
+
// 用 sharp(部署自带,运行时向上解析,未声明为依赖)栅格化为多尺寸 PNG,
|
|
358
|
+
// 再组装成 .ico 供宿主窗口的 Form.Icon 使用;失败仅告警(宿主退回内置图标)。
|
|
359
|
+
//
|
|
360
|
+
// **图标固定策略**(0.1.14):生成的 .ico 缓存于 `~/.dsh/auto-open-web-icon.ico`,
|
|
361
|
+
// 缓存存在且非空时**直接复用,不再每次启动抓取 favicon 并栅格化**——图标一经
|
|
362
|
+
// 生成即固定不变,也不会因某次启动的 favicon/sharp 瞬时失败而消失;
|
|
363
|
+
// 仅缓存缺失(首次运行/被删除)时生成一次,之后永不改写。
|
|
359
364
|
let iconCache = null;
|
|
360
365
|
let iconFetching = null;
|
|
361
366
|
|
|
@@ -414,13 +419,15 @@ function buildIco(pngs) {
|
|
|
414
419
|
return Buffer.concat([header, ...entries, ...sizes.map((s) => pngs.get(s))]);
|
|
415
420
|
}
|
|
416
421
|
|
|
417
|
-
/** 生成宿主窗口用的 DSH .ico(缓存于 ~/.dsh/auto-open-web-icon.ico),失败返回 null。
|
|
422
|
+
/** 生成宿主窗口用的 DSH .ico(缓存于 ~/.dsh/auto-open-web-icon.ico),失败返回 null。
|
|
423
|
+
* 缓存存在且非空时直接复用(固定图标,不再生成);仅在缓存缺失时生成并写盘。 */
|
|
418
424
|
async function ensureIconFile(server) {
|
|
425
|
+
const out = join(dshHome(), 'auto-open-web-icon.ico');
|
|
419
426
|
try {
|
|
427
|
+
if (existsSync(out) && statSync(out).size > 0) return out;
|
|
420
428
|
const icons = await getIcons(server);
|
|
421
429
|
if (icons === null) return null;
|
|
422
430
|
const ico = buildIco(icons.pngs);
|
|
423
|
-
const out = join(dshHome(), 'auto-open-web-icon.ico');
|
|
424
431
|
writeFileSync(out, ico);
|
|
425
432
|
return out;
|
|
426
433
|
} catch (error) {
|
|
@@ -474,6 +481,17 @@ export function apply(ctx, config) {
|
|
|
474
481
|
return;
|
|
475
482
|
}
|
|
476
483
|
|
|
484
|
+
// 认证 GUI 地址:当前 dsh web 的连接服务提供带进程启动令牌的 URL(browser-auth:
|
|
485
|
+
// 首次访问 /?token= 交换签名 cookie;直接打开裸地址会得到 401「authentication
|
|
486
|
+
// required」)。连接服务缺失时以裸地址兜底(旧版 dsh 无认证,行为不变)。
|
|
487
|
+
const guiUrl = () => {
|
|
488
|
+
const base = `http://127.0.0.1:${String(server.port)}`;
|
|
489
|
+
const connection = ctx.get('connection');
|
|
490
|
+
return connection !== undefined && typeof connection.authenticatedUrl === 'function'
|
|
491
|
+
? connection.authenticatedUrl(base)
|
|
492
|
+
: base;
|
|
493
|
+
};
|
|
494
|
+
|
|
477
495
|
// ---- 配置状态:行配置为种子;settings 命名空间持久化(设置卡片写入) ----
|
|
478
496
|
const settingsSvc = ctx.get('settings');
|
|
479
497
|
let scope = null;
|
|
@@ -566,7 +584,7 @@ export function apply(ctx, config) {
|
|
|
566
584
|
sendJson(res, 200, { ok: false, error: 'webServer 端口不可用,请稍后重试' });
|
|
567
585
|
return;
|
|
568
586
|
}
|
|
569
|
-
const url =
|
|
587
|
+
const url = guiUrl();
|
|
570
588
|
const result = await testBrowserLaunch(resolved.exe, resolved.browser, url);
|
|
571
589
|
if (result.ok !== true) {
|
|
572
590
|
sendJson(res, 200, { ok: false, error: result.error });
|
|
@@ -590,7 +608,7 @@ export function apply(ctx, config) {
|
|
|
590
608
|
console.error('[auto-open-web] webServer port unavailable; not opening anything');
|
|
591
609
|
return;
|
|
592
610
|
}
|
|
593
|
-
const url =
|
|
611
|
+
const url = guiUrl();
|
|
594
612
|
|
|
595
613
|
// 与官方相同的打开抑制:--no-open(webStartup.openBrowser === false)或
|
|
596
614
|
// SSH 会话时不打开任何窗口/页面(官方同样不交接)。
|
|
@@ -660,5 +678,32 @@ export function apply(ctx, config) {
|
|
|
660
678
|
// 行为与未安装本插件时的官方默认完全一致。
|
|
661
679
|
await fallbackOpen('appWindow disabled (official default-browser handoff)');
|
|
662
680
|
};
|
|
663
|
-
|
|
681
|
+
// 与官方 web-app 相同:等连接服务就绪后打开,URL 才携带启动令牌
|
|
682
|
+
// (browser-auth)。双版本兼容:旧版 dsh(rc8)没有连接服务或它没有
|
|
683
|
+
// authenticatedUrl——后者会走 guiUrl 的裸地址回退;前者等待数秒仍无
|
|
684
|
+
// 连接服务时以裸地址兜底打开,保持 rc8 原有的自动打开行为。
|
|
685
|
+
let opened = false;
|
|
686
|
+
const openOnce = () => {
|
|
687
|
+
if (opened) return;
|
|
688
|
+
opened = true;
|
|
689
|
+
// 与官方 web-app 的 announceReady 完全相同:等 Loader 树完全 settle 后再
|
|
690
|
+
// 打开。否则窗口会在宿主控制器(workspace/session-controller)仍未就绪时
|
|
691
|
+
// 首载,工作区/会话列表为空,必须刷新一次才能看到。
|
|
692
|
+
const settled = ctx.get('loader')?.await?.();
|
|
693
|
+
if (settled === undefined) {
|
|
694
|
+
void attempt();
|
|
695
|
+
return;
|
|
696
|
+
}
|
|
697
|
+
void settled.then(() => {
|
|
698
|
+
// 树在等待期间被退出(SIGTERM / appExit):静默跳过。
|
|
699
|
+
if (ctx.get('webServer') === undefined) return;
|
|
700
|
+
void attempt();
|
|
701
|
+
}, () => { /* 启动失败由 fail-loud 报告 */ });
|
|
702
|
+
};
|
|
703
|
+
if (ctx.get('connection') !== undefined) {
|
|
704
|
+
openOnce();
|
|
705
|
+
} else {
|
|
706
|
+
ctx.inject(['connection'], () => { openOnce(); });
|
|
707
|
+
setTimeout(() => { if (ctx.get('connection') === undefined) openOnce(); }, 5000);
|
|
708
|
+
}
|
|
664
709
|
}
|
package/package.json
CHANGED
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"runtimeTarget": {
|
|
3
|
-
"name": ".NETCoreApp,Version=v10.0",
|
|
4
|
-
"signature": ""
|
|
5
|
-
},
|
|
6
|
-
"compilationOptions": {},
|
|
7
|
-
"targets": {
|
|
8
|
-
".NETCoreApp,Version=v10.0": {
|
|
9
|
-
"DshAppWindow/0.1.5": {
|
|
10
|
-
"dependencies": {
|
|
11
|
-
"Microsoft.Web.WebView2": "1.0.3124.44",
|
|
12
|
-
"Microsoft.Web.WebView2.Core": "1.0.3124.44",
|
|
13
|
-
"Microsoft.Web.WebView2.WinForms": "1.0.3124.44",
|
|
14
|
-
"Microsoft.Web.WebView2.Wpf": "1.0.3124.44"
|
|
15
|
-
},
|
|
16
|
-
"runtime": {
|
|
17
|
-
"DshAppWindow.dll": {}
|
|
18
|
-
}
|
|
19
|
-
},
|
|
20
|
-
"Microsoft.Web.WebView2/1.0.3124.44": {
|
|
21
|
-
"runtimeTargets": {
|
|
22
|
-
"runtimes/win-arm64/native/WebView2Loader.dll": {
|
|
23
|
-
"rid": "win-arm64",
|
|
24
|
-
"assetType": "native",
|
|
25
|
-
"fileVersion": "1.0.3124.44"
|
|
26
|
-
},
|
|
27
|
-
"runtimes/win-x64/native/WebView2Loader.dll": {
|
|
28
|
-
"rid": "win-x64",
|
|
29
|
-
"assetType": "native",
|
|
30
|
-
"fileVersion": "1.0.3124.44"
|
|
31
|
-
},
|
|
32
|
-
"runtimes/win-x86/native/WebView2Loader.dll": {
|
|
33
|
-
"rid": "win-x86",
|
|
34
|
-
"assetType": "native",
|
|
35
|
-
"fileVersion": "1.0.3124.44"
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
},
|
|
39
|
-
"Microsoft.Web.WebView2.Core/1.0.3124.44": {
|
|
40
|
-
"runtime": {
|
|
41
|
-
"Microsoft.Web.WebView2.Core.dll": {
|
|
42
|
-
"assemblyVersion": "1.0.3124.44",
|
|
43
|
-
"fileVersion": "1.0.3124.44"
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
},
|
|
47
|
-
"Microsoft.Web.WebView2.WinForms/1.0.3124.44": {
|
|
48
|
-
"runtime": {
|
|
49
|
-
"Microsoft.Web.WebView2.WinForms.dll": {
|
|
50
|
-
"assemblyVersion": "1.0.3124.44",
|
|
51
|
-
"fileVersion": "1.0.3124.44"
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
},
|
|
55
|
-
"Microsoft.Web.WebView2.Wpf/1.0.3124.44": {
|
|
56
|
-
"runtime": {
|
|
57
|
-
"Microsoft.Web.WebView2.Wpf.dll": {
|
|
58
|
-
"assemblyVersion": "1.0.3124.44",
|
|
59
|
-
"fileVersion": "1.0.3124.44"
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
},
|
|
65
|
-
"libraries": {
|
|
66
|
-
"DshAppWindow/0.1.5": {
|
|
67
|
-
"type": "project",
|
|
68
|
-
"serviceable": false,
|
|
69
|
-
"sha512": ""
|
|
70
|
-
},
|
|
71
|
-
"Microsoft.Web.WebView2/1.0.3124.44": {
|
|
72
|
-
"type": "package",
|
|
73
|
-
"serviceable": true,
|
|
74
|
-
"sha512": "sha512-sQb+ACD3ILvHxztxqCWLbhYmFNf5dH0HPhVKFYg020rpeQPkadH0nkVOSsgfSyBDMLypI9iMBeD6uVcVxsKLkg==",
|
|
75
|
-
"path": "microsoft.web.webview2/1.0.3124.44",
|
|
76
|
-
"hashPath": "microsoft.web.webview2.1.0.3124.44.nupkg.sha512"
|
|
77
|
-
},
|
|
78
|
-
"Microsoft.Web.WebView2.Core/1.0.3124.44": {
|
|
79
|
-
"type": "reference",
|
|
80
|
-
"serviceable": false,
|
|
81
|
-
"sha512": ""
|
|
82
|
-
},
|
|
83
|
-
"Microsoft.Web.WebView2.WinForms/1.0.3124.44": {
|
|
84
|
-
"type": "reference",
|
|
85
|
-
"serviceable": false,
|
|
86
|
-
"sha512": ""
|
|
87
|
-
},
|
|
88
|
-
"Microsoft.Web.WebView2.Wpf/1.0.3124.44": {
|
|
89
|
-
"type": "reference",
|
|
90
|
-
"serviceable": false,
|
|
91
|
-
"sha512": ""
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
}
|
|
Binary file
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"runtimeOptions": {
|
|
3
|
-
"tfm": "net10.0",
|
|
4
|
-
"frameworks": [
|
|
5
|
-
{
|
|
6
|
-
"name": "Microsoft.NETCore.App",
|
|
7
|
-
"version": "10.0.0"
|
|
8
|
-
},
|
|
9
|
-
{
|
|
10
|
-
"name": "Microsoft.WindowsDesktop.App",
|
|
11
|
-
"version": "10.0.0"
|
|
12
|
-
}
|
|
13
|
-
],
|
|
14
|
-
"configProperties": {
|
|
15
|
-
"System.Reflection.Metadata.MetadataUpdater.IsSupported": false,
|
|
16
|
-
"System.Runtime.Serialization.EnableUnsafeBinaryFormatterSerialization": false,
|
|
17
|
-
"CSWINRT_USE_WINDOWS_UI_XAML_PROJECTIONS": false
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
}
|