Skip to content

DeepSeek Harness Tauri 桌面版 | Only 8mb installer, zero environment setup, preset plugins, Windows / macOS / Linux.

Handle alpha boot bundle URLs

hairyfe6d8575c1c3d
diff --git a/src-tauri/src/service/workflow/utils.rs b/src-tauri/src/service/workflow/utils.rs
index 195fa6f1..34348b9d 100644
--- a/src-tauri/src/service/workflow/utils.rs
+++ b/src-tauri/src/service/workflow/utils.rs
@@ -60,17 +60,18 @@ pub(super) fn client_urls_from_boot_html(port: u16, html: &str) -> Option<Vec<St
let Some(src_end) = rest.find('\"') else {
continue;
};
- let src = &rest[..src_end];
- if is_client_bundle_path(src) {
- paths.push(src.to_string());
+ let src = decode_html_attribute(&rest[..src_end]);
+ if is_client_bundle_path(&src) {
+ paths.push(src);
}
}
for entry in entries {
let Some(url) = entry.get("url").and_then(|v| v.as_str()) else {
continue;
};
- if is_client_bundle_path(url) {
- paths.push(url.to_string());
+ let url = decode_html_attribute(url);
+ if is_client_bundle_path(&url) {
+ paths.push(url);
}
}
paths.sort();
@@ -86,8 +87,24 @@ pub(super) fn client_urls_from_boot_html(port: u16, html: &str) -> Option<Vec<St
)
}
+/// 还原 boot HTML 属性/JSON 中的有限命名实体。
+///
+/// alpha 核心的 combo URL 使用 `&rev=...`,HTML 注入后会变成 `&amp;rev=...`;
+/// 解析前还原它,否则 reqwest 会把实体名当成真实查询参数的一部分。
+fn decode_html_attribute(value: &str) -> String {
+ value
+ .replace("&amp;", "&")
+ .replace("&quot;", "\"")
+ .replace("&#39;", "'")
+ .replace("&lt;", "<")
+ .replace("&gt;", ">")
+}
+
fn is_client_bundle_path(path: &str) -> bool {
- path.starts_with("/plugins/") && path.contains("/client.js") && !path.starts_with("//")
+ // alpha combo 路由合法地使用 `/plugins/??<package>/client.js&rev=...`:
+ // 第一个 `?` 是路由约定,第二个是 combo payload 的起始标记,不能把它拼成
+ // `/plugins/??` 再交给 URL 解析器时丢掉一个问号。
+ path.starts_with("/plugins/") && path.contains("client.js") && !path.starts_with("//")
}
/// 判断健康检查响应是不是可用的插件 bundle。
@@ -413,6 +430,15 @@ mod tests {
assert!(client_urls_from_boot_html(3099, html).is_none());
}
+ /// alpha combo bundle 的 script src 位于 HTML 属性时,`&rev=` 会编码为
+ /// `&amp;rev=`;探测 URL 必须先还原实体,否则服务端收到错误资源地址并返回 404。
+ #[test]
+ fn boot_html_decodes_combo_bundle_attribute_url() {
+ let html = r#"<script src="/plugins/??@deepseek-ai/dsh-client-modules/client.js&amp;rev=cddf5581d5d5"></script><script>globalThis["__DSH_BOOT__"] = {"entries":[]}</script>"#;
+ let urls = client_urls_from_boot_html(3081, html).expect("boot graph");
+ assert_eq!(urls, vec!["http://127.0.0.1:3081/plugins/??@deepseek-ai/dsh-client-modules/client.js&rev=cddf5581d5d5"]);
+ }
+
#[test]
fn health_probe_plugin_urls_target_client_bundles_not_spa_root() {
let urls = health_probe_plugin_urls(3080);
diff --git a/src/store/modules/harness/store.ts b/src/store/modules/harness/store.ts
index 19cc0bef..97de6dda 100644
--- a/src/store/modules/harness/store.ts
+++ b/src/store/modules/harness/store.ts
@@ -75,7 +75,9 @@ const restartFlight = new SingleFlight<void>()
const iframeReloadGate = new BoundedReloadGate(3)
let iframeRefreshTimer: ReturnType<typeof setTimeout> | undefined
-/** 构建带时间戳的 iframe URL,避免 WebView2 缓存旧页面 */
+/** 构建带时间戳的 iframe URL,避免 WebView2 缓存旧页面。
+ * alpha 鉴权由启动前的桌面端 patch 处理,iframe 永远不携带启动 token;旧核心
+ * 同样继续使用原有的缓存查询参数。 */
function generateTimestampedUrl(baseUrl: string): string {
const timestamp = Date.now()
const separator = baseUrl.includes('?') ? '&' : '?'