dsh-pet-live2d 3.1.1 → 3.1.2
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/CHANGELOG.md +26 -0
- package/README.md +8 -0
- package/lib/client.js +23 -3
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,31 @@
|
|
|
1
1
|
# 更新日志
|
|
2
2
|
|
|
3
|
+
## 3.1.2(2026-09-30)
|
|
4
|
+
|
|
5
|
+
### 修:官方桌面端(`dsh-app://` 外壳)里"贴图 404 / 加载失败"(issue #1 的真身)
|
|
6
|
+
|
|
7
|
+
现象(用户在 DeepSeek Harness 官方桌面端里实测):
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
[Loader.load] Failed to load dsh-app://api/live2d-pet/asset/ds-whale-girl/textures/texture_01.png
|
|
11
|
+
Error: [WorkerManager.loadImageBitmap] Failed to fetch … 404 Not Found
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
注意地址里 **`api` 占了 host 的位置** ✗。根因有两条叠在一起:
|
|
15
|
+
|
|
16
|
+
1. 官方桌面端的页面 origin 是 **`dsh-app://app`**(自定义协议,不是 http);
|
|
17
|
+
2. Live2D 引擎(Pixi)是在 **blob Worker** 里 `fetch` 贴图的,而 **blob Worker 里解析根相对
|
|
18
|
+
地址 `/api/...` 会把 host 丢掉** ⇒ 请求变成 `dsh-app://api/...` ⇒ 服务端收到的是
|
|
19
|
+
`/live2d-pet/asset/...`(少了 `/api`)⇒ 404 ⇒ 贴图全挂、模型加载失败。
|
|
20
|
+
|
|
21
|
+
修法:凡是交给引擎的地址(模型 `modelUrl`、Cubism Core、vendor bundle)都先拼成
|
|
22
|
+
**保住 host 的绝对地址** —— `<协议>//<host>/api/...`。http(s) 外壳下与相对地址等价
|
|
23
|
+
(驱动全绿),`dsh-app://app` 下这正是页面自己那些相对请求能通的形式。
|
|
24
|
+
|
|
25
|
+
(上一版 3.1.1 修的 `localStorage` 兜底是另一个真实问题:自定义协议 / opaque origin 下
|
|
26
|
+
**光访问 `localStorage` 就会抛 `SecurityError`**,抛在组件第一帧 ⇒ 宠物与设置页一起白掉。
|
|
27
|
+
两处都要有,才算真正"适配得了各种桌面外壳"。)
|
|
28
|
+
|
|
3
29
|
## 3.1.1(2026-09-30)
|
|
4
30
|
|
|
5
31
|
### 修:在某些桌面外壳里"宠物整个不出现"(`localStorage` 一访问就抛)
|
package/README.md
CHANGED
|
@@ -39,6 +39,14 @@ git clone https://github.com/A8Chann/dsh-pet-live2d
|
|
|
39
39
|
dsh plugin --profile web add "link:./dsh-pet-live2d/dsh-live2d-pet"
|
|
40
40
|
```
|
|
41
41
|
|
|
42
|
+
> **装到哪个 profile?** 取决于你在哪里用它:
|
|
43
|
+
>
|
|
44
|
+
> - 浏览器里跑的 `dsh web` ⇒ **`--profile web`**(上面几条都是这个);
|
|
45
|
+
> - **DeepSeek Harness 官方桌面客户端** ⇒ 它用的是 **`--profile desktop`**,例如
|
|
46
|
+
> `dsh plugin --profile desktop add dsh-pet-live2d`。
|
|
47
|
+
>
|
|
48
|
+
> 装完**重启一次**(插件在启动时加载,客户端 bundle 也不做热重载)。
|
|
49
|
+
|
|
42
50
|
### Cubism Core:不用手动装
|
|
43
51
|
|
|
44
52
|
`live2dcubismcore.min.js` 是 Live2D 株式会社的**专有运行时**,不能随插件分发 —— 但**你也不
|
package/lib/client.js
CHANGED
|
@@ -91,6 +91,26 @@ window.__ModuleLoader__.load({ id: "dsh-pet-live2d", factory: (require) => {
|
|
|
91
91
|
/** 显示层轮询间隔:桌面端接管/让位要在一秒内被看见。 */
|
|
92
92
|
const LAYER_POLL_MS = 1000;
|
|
93
93
|
|
|
94
|
+
// ---- 交给引擎的地址必须是"保住 host 的绝对地址" ----
|
|
95
|
+
//
|
|
96
|
+
// 症状(2026-09-30 官方桌面端实测):贴图全挂在
|
|
97
|
+
// `dsh-app://api/live2d-pet/asset/ds-whale-girl/textures/texture_01.png` 404
|
|
98
|
+
// —— 注意 host 位置被 `api` 占了:官方桌面端的页面 origin 是 `dsh-app://app`,
|
|
99
|
+
// 而 Pixi 是在 **blob Worker** 里 `fetch` 贴图的(`WorkerManager.loadImageBitmap`),
|
|
100
|
+
// blob Worker 里解析 `/api/...` 这种根相对地址会把 host 丢掉。
|
|
101
|
+
//
|
|
102
|
+
// 所以凡是交给引擎(`Live2DModel.from` / 脚本注入)的地址,都先拼成
|
|
103
|
+
// `<协议>//<host>/api/...`。http(s) 外壳下结果与相对地址等价(只是更长),
|
|
104
|
+
// 自定义协议外壳下这正是能通的那一种写法。
|
|
105
|
+
const URL_BASE = (() => {
|
|
106
|
+
const { protocol, host } = window.location;
|
|
107
|
+
if (host) return protocol + "//" + host;
|
|
108
|
+
const { origin } = window.location;
|
|
109
|
+
return typeof origin === "string" && origin !== "null" ? origin : "";
|
|
110
|
+
})();
|
|
111
|
+
const absolutize = (url) =>
|
|
112
|
+
typeof url === "string" && url.startsWith("/") && URL_BASE !== "" ? URL_BASE + url : url;
|
|
113
|
+
|
|
94
114
|
/**
|
|
95
115
|
* 桌面端注册进来的"跟随处理器"。
|
|
96
116
|
*
|
|
@@ -5390,13 +5410,13 @@ window.__ModuleLoader__.load({ id: "dsh-pet-live2d", factory: (require) => {
|
|
|
5390
5410
|
layoutRef.current = layout;
|
|
5391
5411
|
|
|
5392
5412
|
const boot = async () => {
|
|
5393
|
-
if (!await ensureCore(catalog.coreUrl)) {
|
|
5413
|
+
if (!await ensureCore(absolutize(catalog.coreUrl))) {
|
|
5394
5414
|
if (!disposed) setCoreMissing(true);
|
|
5395
5415
|
return;
|
|
5396
5416
|
}
|
|
5397
5417
|
if (disposed) return;
|
|
5398
5418
|
setCoreMissing(false);
|
|
5399
|
-
const vendor = await ensureVendor(catalog.vendorUrl);
|
|
5419
|
+
const vendor = await ensureVendor(absolutize(catalog.vendorUrl));
|
|
5400
5420
|
if (disposed) return;
|
|
5401
5421
|
if (vendor === undefined) throw new Error("vendor bundle unavailable");
|
|
5402
5422
|
configureVendor(vendor);
|
|
@@ -5432,7 +5452,7 @@ window.__ModuleLoader__.load({ id: "dsh-pet-live2d", factory: (require) => {
|
|
|
5432
5452
|
app.canvas.style.height = "100%";
|
|
5433
5453
|
stage.appendChild(app.canvas);
|
|
5434
5454
|
|
|
5435
|
-
const loaded = await vendor.Live2DModel.from(pet.modelUrl, {
|
|
5455
|
+
const loaded = await vendor.Live2DModel.from(absolutize(pet.modelUrl), {
|
|
5436
5456
|
autoUpdate: false,
|
|
5437
5457
|
autoHitTest: true,
|
|
5438
5458
|
autoFocus: false,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-pet-live2d",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.2",
|
|
4
4
|
"description": "Live2D 桌宠插件:为 DSH Web GUI 挂一只可拖动、会跟随鼠标、能换动作与表情的 Live2D 宠物。",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -49,8 +49,8 @@
|
|
|
49
49
|
}
|
|
50
50
|
},
|
|
51
51
|
"optionalDependencies": {
|
|
52
|
-
"dsh-pet-live2d-desktop-darwin-arm64": "3.1.
|
|
53
|
-
"dsh-pet-live2d-desktop-win32-x64": "3.1.
|
|
52
|
+
"dsh-pet-live2d-desktop-darwin-arm64": "3.1.2",
|
|
53
|
+
"dsh-pet-live2d-desktop-win32-x64": "3.1.2"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
56
|
"esbuild": "^0.25.10",
|