dsh-splash-launcher 1.3.0 → 2.0.0

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/DSH-GUI.exe CHANGED
Binary file
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # DSH GUI
2
2
 
3
- > DeepSeek Harness(dsh)Web GUI 的 Windows 一键启动器:双击即弹出无边框启动动画,后台拉起 `dsh web`,GUI 真正加载完成后无缝淡入;关闭窗口自动停服务。
3
+ > DeepSeek Harness(dsh)Web GUI 的 Windows 一键启动器:双击即用**自绘标题栏 + WebView2 内嵌**的窗口播放 splash 动画作为唯一启动画布(任务栏图标从窗口出现那一刻就是黑鲸,不再闪 Chrome/Edge 默认图标;标题栏颜色随主题统一),后台拉起 `dsh web`,GUI 就绪后揭示;关闭窗口自动停服务。
4
4
 
5
5
  启动动画借鉴 [SPlayer-Next](https://github.com/SPlayer-Dev/SPlayer-Next) 的思路:SVG `stroke-dashoffset` “一笔一划”书写效果——鲸鱼 Logo 升起呼吸,`deepseek` 官方字标浮现,`HARNESS` 七个字母逐笔描边。
6
6
 
@@ -8,7 +8,7 @@
8
8
 
9
9
  ## 效果截图
10
10
 
11
- **启动动画(WPF 无边框,HARNESS 逐笔描边)**
11
+ **启动动画(浏览器 splash,HARNESS 逐笔描边)**
12
12
 
13
13
  ![启动动画](docs/screenshots/startup-animation.png)
14
14
 
@@ -20,14 +20,16 @@
20
20
 
21
21
  ## 功能特性
22
22
 
23
- - **点击即出动画**:WPF 原生动画窗口,不等待浏览器冷启动,双击后立刻播放;
24
- - **便携单文件**:`splash.html` 与 SVG/PNG 素材内嵌进 exe,`DSH-GUI.exe` 单独一个文件即可运行;同目录放置同名素材文件可覆盖内嵌版本(自定义动画,无需重编译);
23
+ - **点击即出动画**:以 WebView2 内嵌的 splash 动画作为唯一启动画布,双击后立刻打开动画,无双层窗口互相抢层级;
24
+ - **窗口即原生**:不再丢给 Chrome/Edge,而是启动器自己开一个窗口(`DSH-GUI.exe`)——**任务栏图标从窗口出现那一刻就是黑鲸**(不再闪浏览器默认图标 / 低分辨率占位图),**标题栏颜色随 dsh 主题统一**;
25
+ - **便携单文件**:`splash.html`、SVG/PNG 素材、WebView2 SDK 托管 DLL 与原生 loader 全部内嵌进 exe,`DSH-GUI.exe` 单独一个文件即可运行;同目录放置同名素材文件可覆盖内嵌版本(自定义动画,无需重编译);
25
26
  - **一笔一划描边**:`HARNESS` 七个字母按 CSS `cubic-bezier(0.25,0.1,0.25,1)` 缓动逐笔书写,笔尖连续、首帧空白;
26
- - **后台加载、就绪切换**:启动动画期间,真实 GUI 在浏览器后台(同源 iframe)完成加载,检测到官方启动页(`Loading plugins…`)消失后才淡出动画,不会出现“动画播完又加载”的断档;
27
- - **无 PowerShell**:启动器是单个 C#/WPF 程序,无脚本进程,规避“PowerShell 木马”类安全软件启发式误报;
27
+ - **后台加载、就绪切换**:动画终态与“服务端 splash(hold)”是同款画面,跳转肉眼无切换;真实 GUI 在隐藏 iframe 中预加载(官方 `Loading plugins…` 页不可见),检测到启动卡片消失(GUI 就绪)后 splash 淡出揭示——动画→GUI 全程无缝,无“动画播完又加载”的断档;
28
+ - **启动器内做认证**:一次性启动 token 由启动器自己换成会话 cookie(不交给页面,避免一次性/进程绑定语义导致的失效),再注入 WebView2;WebView2 与 iframe 只访问干净的 `/`;
29
+ - **无 PowerShell**:启动器是单个 C# 程序,无脚本进程,规避“PowerShell 木马”类安全软件启发式误报;
28
30
  - **开即启动、关即退出**:窗口关闭后自动结束本次启动的 `dsh web` 服务;端口已有服务时只开窗口、不接管生命周期;
29
31
  - **可配置**:工作目录与端口可通过环境变量或 `workspace.txt` 修改;
30
- - **深浅色跟随**:启动动画跟随 dsh 设置里的“外观”选项(浅色/深色/跟随系统),浅色为接近白色的淡蓝,深色保留原深蓝黑;
32
+ - **深浅色跟随**:启动动画与标题栏跟随 dsh 设置里的“外观”选项(浅色/深色/跟随系统);标题栏与 GUI 侧边栏同色:浅色极浅灰 `#f9fafb`(深色文字/图标),深色 `#1b1b1c`;
31
33
  - **开源友好**:单文件 C# 源码 + `build.cmd`,使用 Windows 自带 `csc.exe` 编译,无需外部工具链。
32
34
 
33
35
  ## 快速开始
@@ -44,10 +46,22 @@
44
46
 
45
47
  环境要求:
46
48
 
47
- - Windows 10 / 11
49
+ - Windows 10 / 11(含 Microsoft Edge WebView2 Runtime,随 Edge 自带,缺失时使用[独立安装包](https://developer.microsoft.com/microsoft-edge/webview2/));
48
50
  - 已通过 npm 全局安装 DeepSeek Harness:`npm install -g @deepseek-ai/dsh`(`dsh web` 可用);
49
51
  - Node.js(npm 全局安装 dsh 时自带依赖);
50
- - Microsoft Edge Google Chrome(二选一,自动探测)。
52
+ - .NET Framework 4.6.2+(Win10/11 自带)。
53
+
54
+ 首次构建前,需在 `packages\ms.webview2\bin` 放置 WebView2 SDK(来自 NuGet 包 `Microsoft.Web.WebView2`):
55
+
56
+ ```powershell
57
+ # 一次性:下载并解出 SDK 到项目(任选方法,目标三文件:
58
+ # Microsoft.Web.WebView2.Core.dll / Microsoft.Web.WebView2.Wpf.dll / WebView2Loader.dll(x64))
59
+ $ver="1.0.4191.47"
60
+ $pk="packages\ms.webview2"; New-Item -ItemType Directory -Force -Path "$pk\bin" | Out-Null
61
+ Invoke-WebRequest "https://api.nuget.org/v3-flatcontainer/microsoft.web.webview2/$ver/microsoft.web.webview2.$ver.nupkg" -OutFile "$pk\wv2.nupkg"
62
+ Expand-Archive "$pk\wv2.nupkg" -DestinationPath "$pk\pkg" -Force
63
+ Copy-Item "$pk\pkg\lib\net462\Microsoft.Web.WebView2.Core.dll","$pk\pkg\lib\net462\Microsoft.Web.WebView2.Wpf.dll","$pk\pkg\runtimes\win-x64\native\WebView2Loader.dll" "$pk\bin\"
64
+ ```
51
65
 
52
66
  构建(双击或命令行运行):
53
67
 
@@ -55,7 +69,7 @@
55
69
  build.cmd
56
70
  ```
57
71
 
58
- 生成自包含的 `DSH-GUI.exe`(黑鲸图标,素材已内嵌为资源)。构建仅使用 Windows 自带的 `C:\Windows\Microsoft.NET\Framework64\v4.0.30319\csc.exe`。
72
+ 生成自包含的 `DSH-GUI.exe`(黑鲸图标,素材已内嵌为资源)。构建仅使用 Windows 自带的 `C:\Windows\Microsoft.NET\Framework64\v4.0.30319\csc.exe`;WebView2 SDK 的托管 DLL 与原生 loader 被内嵌进 exe,运行时释放到 `%LocalAppData%\DSH-GUI\bin` 并加载,**无需随包分发外部 DLL**。
59
73
 
60
74
  ### 使用
61
75
 
@@ -84,32 +98,37 @@ dsh plugin --profile web add dsh-splash-launcher
84
98
 
85
99
  ```
86
100
  双击 DSH-GUI.exe
87
- ├─ 端口已占用 ────────────────→ 直接打开 GUI 窗口(不显示动画、不接管服务)
101
+ ├─ 端口已占用 ────────────────→ 直接打开 WebView2 GUI 窗口(不显示动画、不接管服务)
88
102
  └─ 端口空闲
89
- ├─ 立即显示 WPF 无边框启动动画(≈0ms,不等浏览器)
90
- ├─ 解析 dsh 安装路径(npm root -g + node require.resolve)
91
- ├─ 将 splash 素材同步进 dsh-web-frontend/dist(同源 iframe 探测的前提)
103
+ ├─ 路径解析(缓存命中则 ~0ms;否则已知目录探测 + 并行解析,写入 resolved.cache)
104
+ ├─ 打开自绘标题栏窗口并内嵌 WebView2,播放 file:// splash 动画(唯一启动画布)
105
+ ├─ 将 splash 素材同步进 dsh-web-frontend/dist(服务端 splash 同源的前提)
92
106
  ├─ 后台启动 `node <dsh>/lib/bin.js web`(隐藏窗口)
93
107
  ├─ 轮询端口就绪(最多 90s)
94
- ├─ 以相同尺寸/位置在动画背后打开浏览器 `--app` 窗口
95
- └─ splash.html(hold) 用隐藏 iframe 加载 `/`
96
- │ └─ 检测到官方启动卡片消失 揭示 iframe,并同步标题
97
- ├─ WPF 检测到浏览器标题包含 "DeepSeek Harness" → 淡出动画
98
- └─ 浏览器窗口关闭 taskkill 结束本次 dsh web 进程树
108
+ ├─ 从服务输出抓取一次性启动 token → 用启动器自己完成 token→cookie 交换(303 + Set-Cookie;
109
+ 轮询期间反复重扫最新 token,兼容插件树重载导致的 token 轮换)
110
+ ├─ 把会话 cookie 注入 WebView2(host-only @127.0.0.1,SameSite=Strict)
111
+ ├─ 跳转到服务端 splash(hold=1 终态,与动画终态同款画面,肉眼无切换):
112
+ │ 隐藏 iframe 预加载真实 GUI(官方 Loading plugins… 藏在 iframe 里,不可见),
113
+ │ 检测到 `_boot_*` 启动卡消失(GUI 就绪)后 splash 淡出揭示——动画→GUI 全程无缝
114
+ └─ 窗口关闭 → taskkill 结束本次 dsh web 进程树
99
115
  ```
100
116
 
117
+
101
118
  ## 项目结构
102
119
 
103
120
  ```
104
121
  dsh-gui/
105
- ├─ DSH-GUI.cs # 启动器全部源码(C# 5 / WPF,单文件)
106
- ├─ build.cmd # 构建脚本(Windows 自带 csc.exe)
107
- ├─ splash.html # 浏览器侧启动页(hold 态 + 后台 iframe 预加载 + 就绪检测)
122
+ ├─ DSH-GUI.cs # 启动器全部源码(C# 5,单文件;WebView2 宿主 + 自绘标题栏)
123
+ ├─ build.cmd # 构建脚本(Windows 自带 csc.exe,内嵌 WebView2 SDK
124
+ ├─ splash.html # 启动页(hold 态 + 后台 iframe 预加载 + 就绪检测)
108
125
  ├─ deepseek-wordmark.svg # 官方 deepseek 字标(提取自 dsh 前端)
109
126
  ├─ whale.png # 黑鲸 Logo(256px,透明底)
110
127
  ├─ whale-anim.svg # 鲸鱼描边动画(可选版式 logo=draw)
111
128
  ├─ icons/
112
- │ └─ whale-black.ico # 黑鲸图标(exe 与快捷方式共用)
129
+ │ └─ whale-black.ico # 黑鲸图标(exe 与窗口/任务栏共用)
130
+ ├─ packages/
131
+ │ └─ ms.webview2/bin # WebView2 SDK(构建引用 + 内嵌;见下)
113
132
  ├─ LICENSE # MIT + 品牌素材说明
114
133
  └─ README.md
115
134
  ```
@@ -131,19 +150,21 @@ DSH-GUI.exe --selftest
131
150
 
132
151
  | 想调什么 | 位置 |
133
152
  |---|---|
134
- | 描边速度 | `SplashWindow.DrawSeconds`(默认 0.22s/字母,线性速度) |
135
- | 相邻字母起笔间隔 | `SplashWindow.LetterStep`(默认 0.14s,重叠书写) |
136
- | 动画窗口尺寸 | `Program.WinW / WinH`(默认 1100×720 |
137
- | 最短动画时长 | `SplashWindow.MinShowSec`(默认 2.0s) |
138
- | 就绪判定标题 | `SplashWindow.AppTitle`(按“包含”匹配) |
153
+ | 描边速度 | `splash.html` 的 `.splash-harness .letter` `animation` 时长(0.22s/字母) |
154
+ | 相邻字母起笔间隔 | `splash.html` `.splash-harness path:nth-of-type(n)` `animation-delay` |
155
+ | 动画/窗口尺寸 | `Program.WinW / WinH`(默认 1100×720,`DSH-GUI.cs`) |
156
+ | 标题栏颜色 | `DshWindow.BuildLayout` 的 `barColor / barText`(随 dsh 主题深浅色),`DSH-GUI.cs` |
157
+ | 版式(鲸鱼描边) | `Program.SplashStyle` 改为 `"&logo=draw"`(`DSH-GUI.cs`) |
139
158
 
140
159
  ## 已知问题
141
160
 
142
- ### 1. 任务栏图标会先闪一下 Chrome/Edge 默认图标
143
- 浏览器 `--app` 窗口创建时,任务栏按钮先使用浏览器进程自带图标,页面 `favicon`(黑鲸)加载完成后才切换,因此会出现极短暂的一闪。这是浏览器自身的图标占位机制,没有命令行参数可预设;当前动画窗口会盖住这段过程,实际看到界面时已是黑鲸图标。彻底隐藏需要 Win32 控制窗口显隐,可能引起页面节流、拖慢启动,暂不实现。
161
+ ### 1. ~~任务栏图标会先闪一下 Chrome/Edge 默认图标~~ ✅ 已解决
162
+ 旧版用浏览器 `--app` 窗口,任务栏按钮先使用浏览器进程自带图标,页面 `favicon` 加载完成后才切换,因此有一闪。已成为 WebView2 宿主后:窗口是启动器自己的,`Window.Icon`(黑鲸)在窗口创建时即设置,**任务栏从窗口出现那一刻就是黑鲸,不再闪默认图标**;标题栏颜色也随主题统一(深色 = 侧边栏深色 `#1b1b1c`,浅色 = 侧边栏浅灰 `#f9fafb`)。
163
+
164
+ **新增:WebView2 Runtime 依赖**:运行需要 Microsoft Edge WebView2 Runtime(Win10/11 随 Edge 自带)。若缺失,窗口会提示安装,无法回退到浏览器 `--app` 模式。
144
165
 
145
166
  ### 2. 启动有一定等待时间
146
- 启动时长主要来自:`dsh web` 服务引导 + 浏览器冷启动 + 前端插件装载。动画会覆盖全部等待过程并持续到 GUI 就绪,属于“可见但不可压缩”的时间。首次运行、杀毒软件实时扫描、机械硬盘会进一步加长。可通过 WPF 描边速度(见上)让动画与等待时长更匹配。
167
+ 启动时长主要来自:`dsh web` 服务引导 + 浏览器冷启动 + 前端插件装载,动画会覆盖绝大多数等待过程并持续到 GUI 就绪,属于“可见但基本不可压缩”的时间。首次运行、杀毒软件实时扫描、机械硬盘会进一步加长。启动器自身的路径解析已缓存(`resolved.cache`)且最早预热浏览器,能显著缩短总时长;动画节奏可在 `splash.html` 的 CSS 里调节。
147
168
 
148
169
  ### 3. SmartScreen / 安全软件可能误报(未签名 exe)
149
170
  本程序会启动隐藏进程、结束后台进程、复制文件,这类“类管理工具”行为可能触发启发式防护(例如卡巴斯基 PDM:Trojan.Win32.Generic 对旧版 PowerShell 脚本的误报)。建议:
@@ -157,8 +178,8 @@ DSH-GUI.exe --selftest
157
178
  ### 5. 同源预加载依赖 dist 写入权限
158
179
  启动器需要把 `splash.html` 等素材复制到 npm 全局的 `dsh-web-frontend/dist` 目录。若该目录不可写,会自动退回“文件页动画 → 就绪后直接跳转 GUI”模式(素材内嵌于 exe,此模式下自动释放到 `%LocalAppData%\DSH-GUI\assets`),此时会短暂看到官方 HARNESS 加载页。
159
180
 
160
- ### 6. 就绪判定依赖标题
161
- WPF 以浏览器窗口标题包含 `DeepSeek Harness` 判定 GUI 就绪;若官方前端修改标题结构,可能需要同步更新 `SplashWindow.AppTitle`。
181
+ ### 6. 就绪判定依赖官方启动卡片
182
+ 浏览器 splash 以同源 iframe 里官方启动卡片(`_boot_*` class)消失判定 GUI 就绪;若官方前端改了启动卡片的 class 结构,可能需要同步更新 `splash.html` 里的 `appReady()` 判定。
162
183
 
163
184
  ## 许可证
164
185
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "dsh-splash-launcher",
3
- "version": "1.3.0",
4
- "description": "DSH Windows one-click launcher with a stroke-by-stroke startup animation: ships a self-contained DSH-GUI.exe and registers the desktop_launch agent tool.",
3
+ "version": "2.0.0",
4
+ "description": "DSH Windows one-click launcher: opens the browser splash animation immediately, boots dsh web, and reveals the GUI when ready; also registers the desktop_launch agent tool.",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",
7
7
  "scripts": {
package/splash.html CHANGED
@@ -155,14 +155,14 @@
155
155
  filter: var(--logo-filter);
156
156
  will-change: transform, opacity;
157
157
  animation:
158
- splash-rise 0.5s cubic-bezier(0.16, 1, 0.3, 1) both,
158
+ splash-rise 0.4s cubic-bezier(0.16, 1, 0.3, 1) both,
159
159
  splash-flicker 1.8s ease-in-out 0.5s infinite;
160
160
  }
161
161
  .splash-logo.draw {
162
162
  width: 96px;
163
163
  height: 96px;
164
164
  filter: none;
165
- animation: splash-rise 0.5s cubic-bezier(0.16, 1, 0.3, 1) both;
165
+ animation: splash-rise 0.4s cubic-bezier(0.16, 1, 0.3, 1) both;
166
166
  }
167
167
 
168
168
  .splash-brand {
@@ -179,7 +179,7 @@
179
179
  margin-top: 4px;
180
180
  filter: var(--wordmark-filter);
181
181
  will-change: transform, opacity;
182
- animation: splash-rise 0.5s cubic-bezier(0.16, 1, 0.3, 1) 0.1s both;
182
+ animation: splash-rise 0.4s cubic-bezier(0.16, 1, 0.3, 1) 0.08s both;
183
183
  }
184
184
 
185
185
  /* “HARNESS”七个字母:与 SPlayer-Next 的 Next 相同的描边动画,作为视觉重点 */
@@ -196,16 +196,16 @@
196
196
  stroke-dasharray: 400;
197
197
  stroke-dashoffset: 400;
198
198
  will-change: stroke-dashoffset;
199
- /* 每个字母 0.22s,前一个未写完下一个就开始,linear 线性速度,整体约 1.3s */
200
- animation: splash-draw 0.22s linear forwards;
201
- }
202
- .splash-harness path:nth-of-type(1) { animation-delay: 0.20s; }
203
- .splash-harness path:nth-of-type(2) { animation-delay: 0.34s; }
204
- .splash-harness path:nth-of-type(3) { animation-delay: 0.48s; }
205
- .splash-harness path:nth-of-type(4) { animation-delay: 0.62s; }
206
- .splash-harness path:nth-of-type(5) { animation-delay: 0.76s; }
207
- .splash-harness path:nth-of-type(6) { animation-delay: 0.90s; }
208
- .splash-harness path:nth-of-type(7) { animation-delay: 1.04s; }
199
+ /* 每个字母 0.22s -> 1.25x 加快即 0.176s;前一个未写完下一个就开始,linear 线性速度,整体约 1.0s */
200
+ animation: splash-draw 0.176s linear forwards;
201
+ }
202
+ .splash-harness path:nth-of-type(1) { animation-delay: 0.16s; }
203
+ .splash-harness path:nth-of-type(2) { animation-delay: 0.27s; }
204
+ .splash-harness path:nth-of-type(3) { animation-delay: 0.38s; }
205
+ .splash-harness path:nth-of-type(4) { animation-delay: 0.50s; }
206
+ .splash-harness path:nth-of-type(5) { animation-delay: 0.61s; }
207
+ .splash-harness path:nth-of-type(6) { animation-delay: 0.72s; }
208
+ .splash-harness path:nth-of-type(7) { animation-delay: 0.83s; }
209
209
 
210
210
  /* 浅色模式下换用更深的渐变,保证 HARNESS 在接近白色的背景上清晰可见 */
211
211
  @media (prefers-color-scheme: light) {
@@ -230,7 +230,7 @@
230
230
  font-size: 12px;
231
231
  letter-spacing: 2px;
232
232
  color: var(--muted);
233
- animation: splash-rise-footer 0.5s cubic-bezier(0.16, 1, 0.3, 1) 0.36s both;
233
+ animation: splash-rise-footer 0.4s cubic-bezier(0.16, 1, 0.3, 1) 0.288s both;
234
234
  }
235
235
 
236
236
  /* hold 模式:直接呈现动画结束态(WPF 即时启动页 → 浏览器启动页无缝衔接) */
@@ -318,6 +318,11 @@
318
318
  var timeoutSec = Math.max(15, parseInt(qs.get('timeout') || '90', 10) || 90);
319
319
  // 双击 splash.html 打开(无参数)= 动画循环预览
320
320
  var demo = qs.get('demo') === '1' || !qs.has('target');
321
+ // 预热窗口专用:只播放动画,不探测端口、不自行跳转,由启动器手动接管交接
322
+ var stay = qs.get('stay') === '1';
323
+ // wait=token:预热窗口轮询同目录 token.js(由启动器在服务就绪+拿到 token 后写入),
324
+ // 读到 token 即代表服务就绪,原地自跳转到带 token 的同源 splash——单窗口、无缝、无闪烁。
325
+ var waitToken = qs.get('wait') === 'token';
321
326
  // logo=draw:切换成鲸鱼本体一笔一划的旧版式
322
327
  var drawLogo = qs.get('logo') === 'draw';
323
328
  // 由 dsh 服务托管(同源):可后台 iframe 加载真实 GUI 并检测就绪
@@ -343,6 +348,43 @@
343
348
  return;
344
349
  }
345
350
 
351
+ if (stay) {
352
+ // 预热窗口只做动画展示,交给启动器 ClosePrewarmBrowser 关闭并打开正式窗口
353
+ return;
354
+ }
355
+
356
+ if (waitToken) {
357
+ // 单窗口自跳转:轮询同目录 token.js,拿到 token 后直接跳到带 token 的 GUI 根路径
358
+ // (服务端换 cookie 后 303 回干净路径)。不再经手 /splash.html 中间页——
359
+ // dsh 静态 fallback 的注册时机会让该页短暂 404,曾导致“动画后 404”的间歇性失败。
360
+ var base0 = target.replace(/\/+$/, '');
361
+ var navServed = function (token) {
362
+ if (leaving) return;
363
+ leaving = true;
364
+ location.replace(base0 + '/?token=' + encodeURIComponent(token));
365
+ };
366
+ var pollToken = function () {
367
+ if (leaving) return;
368
+ if (window.__DSH_TOKEN) { navServed(window.__DSH_TOKEN); return; }
369
+ if ((performance.now() - startedAt) > timeoutSec * 1000) {
370
+ // 兜底:极低概率 token 一直没来,直接进 target(无 token 可能 401,但已属异常兜底)
371
+ leaving = true; location.replace(target);
372
+ return;
373
+ }
374
+ var s = document.createElement('script');
375
+ s.src = 'token.js?v=' + Date.now();
376
+ s.onload = function () {
377
+ if (window.__DSH_TOKEN) { navServed(window.__DSH_TOKEN); }
378
+ else setTimeout(pollToken, 300);
379
+ };
380
+ s.onerror = function () { setTimeout(pollToken, 300); };
381
+ document.head.appendChild(s);
382
+ setTimeout(pollToken, 600);
383
+ };
384
+ pollToken();
385
+ return;
386
+ }
387
+
346
388
  var frame = document.getElementById('appFrame');
347
389
  frame.setAttribute('allow', 'clipboard-read; clipboard-write; fullscreen; autoplay');
348
390
 
@@ -408,8 +450,10 @@
408
450
  }
409
451
 
410
452
  if (served) {
411
- /* 同源模式:后台加载真实 GUI,真正就绪后再揭示 */
412
- frame.src = '/';
453
+ /* 同源模式:后台加载真实 GUI,真正就绪后再揭示。
454
+ alpha.3+ 的根路径需要 token 认证:target 携带 token 时首次加载完成换 cookie,
455
+ 服务端 303 回到干净根路径;无 target 参数时退回原来的 '/'。 */
456
+ frame.src = target;
413
457
  var minBeforeReveal = hold ? 250 : splashAnimMs;
414
458
  var revealDeadline = startedAt + timeoutSec * 1000;
415
459
  (function watch() {
@@ -430,7 +474,8 @@
430
474
  if (up && elapsed >= splashAnimMs) {
431
475
  if (handoff) {
432
476
  var base = target.replace(/\/+$/, '');
433
- fadeAndGo(base + '/splash.html?hold=1&timeout=60' + (drawLogo ? '&logo=draw' : ''));
477
+ // 把带 token target 传给同源 splash,alpha.3+ 的根路径认证才能通过
478
+ fadeAndGo(base + '/splash.html?hold=1&timeout=60&target=' + encodeURIComponent(target) + (drawLogo ? '&logo=draw' : ''));
434
479
  } else {
435
480
  fadeAndGo(target);
436
481
  }