dsh-pet-live2d 3.1.1 → 3.1.3
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 +28 -18
- package/README.md +8 -0
- package/lib/client.js +23 -3
- package/lib/index.js +10 -0
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,30 +1,40 @@
|
|
|
1
1
|
# 更新日志
|
|
2
2
|
|
|
3
|
-
## 3.1.
|
|
3
|
+
## 3.1.3(2026-10-01)
|
|
4
|
+
|
|
5
|
+
### 修:设置里选「桌面」后,桌面上什么都没有(手动双击同一个 exe 却正常)
|
|
6
|
+
|
|
7
|
+
插件拉起的桌面端会以「挂载模式」去 DSH 那里取宠物数据,而它拿到的地址一直退回默认端口
|
|
8
|
+
3080 —— 在官方桌面客户端下那个端口没人听,于是桌面上空的。现在改成同时看请求的 `Host`
|
|
9
|
+
头(官方客户端的页面地址是 `dsh-app://`,这种外壳下只有 `Host` 是真实地址)。
|
|
10
|
+
|
|
11
|
+
### 修:官方桌面客户端里贴图全 404、宠物加载失败(issue #1)
|
|
12
|
+
|
|
13
|
+
官方客户端的页面地址是 `dsh-app://`,而引擎在 Worker 里按相对地址取贴图时,地址里的
|
|
14
|
+
`/api` 会被当成主机名 ⇒ 贴图全部 404。现在交给引擎的地址一律拼成保住主机名的绝对地址。
|
|
4
15
|
|
|
5
|
-
###
|
|
16
|
+
### 修:某些桌面外壳里宠物和设置页一起白掉
|
|
6
17
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
禁用 storage)。它抛在组件的第一帧里 ⇒ **宠物和设置页一起白掉**,现象看起来就像"这个插件
|
|
11
|
-
不支持我的桌面端"。
|
|
18
|
+
自定义协议或隐私设置下,**一访问 `localStorage` 就会抛异常**,而插件原来到处直接用它。
|
|
19
|
+
现在全部走带兜底的封装:拿不到就退回内存存储 —— 本次会话内位置、大小、装扮照常工作,
|
|
20
|
+
只是关掉窗口不留存。
|
|
12
21
|
|
|
13
|
-
|
|
22
|
+
### 改:macOS(arm64)的桌面端进了主包声明
|
|
14
23
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
24
|
+
装插件时会自动带上 mac 桌面端(在这之前只能从 Release 下 zip)。
|
|
25
|
+
|
|
26
|
+
## 3.1.2(2026-09-30)
|
|
27
|
+
|
|
28
|
+
### 修:官方桌面客户端里"加载失败"(issue #1)
|
|
29
|
+
|
|
30
|
+
`dsh-app://` 外壳下引擎取贴图的地址会丢主机名 ⇒ 404。现已改为传给引擎的地址保住主机名。
|
|
31
|
+
|
|
32
|
+
## 3.1.1(2026-09-30)
|
|
18
33
|
|
|
19
|
-
|
|
20
|
-
(`dsh.bundle` / `dsh.client` / `slots`)—— 所以换成 `http://127.0.0.1:<端口>` 之外的外壳
|
|
21
|
-
地址也不该受影响。
|
|
34
|
+
### 修:某些桌面外壳里宠物与设置页一起白掉
|
|
22
35
|
|
|
23
|
-
|
|
36
|
+
这些外壳里访问 `localStorage` 会抛异常;现已加兜底,拿不到就用内存存储。
|
|
24
37
|
|
|
25
|
-
`dsh-pet-live2d-desktop-darwin-arm64` 已在上一版发上 npm,这一版把主包的
|
|
26
|
-
`optionalDependencies` 补上它 —— mac 用户装插件时会自动带上桌面端(在这之前只能从
|
|
27
|
-
Release 下 zip)。
|
|
28
38
|
|
|
29
39
|
## 3.1.0(2026-09-29)
|
|
30
40
|
|
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/lib/index.js
CHANGED
|
@@ -1392,8 +1392,18 @@ function layerRoute(display) {
|
|
|
1392
1392
|
return
|
|
1393
1393
|
}
|
|
1394
1394
|
// 页面自己报来的地址就是 DSH 的地址(端口是配置的,猜会猜错)。
|
|
1395
|
+
//
|
|
1396
|
+
// ⚠️ 但**官方桌面客户端的页面 origin 是 `dsh-app://app`**(自定义协议)—— 那个值
|
|
1397
|
+
// 进不了 `setDshUrl`(它只收 `http(s)://`),于是会一直退回 3080 兜底:
|
|
1398
|
+
// 壳以挂载模式连上一个没人听的端口 ⇒ 桌面上什么都没有(用户 2026-09-30 报的
|
|
1399
|
+
// "插件里点桌面打开的 exe 显示不出宠物,直接双击倒是能出"就是这个)。
|
|
1400
|
+
// 所以**同时看 `Host` 头** —— 自定义协议下应用会把请求转给本地服务,Host 才是真的。
|
|
1395
1401
|
const origin = request.headers?.origin
|
|
1396
1402
|
if (typeof origin === 'string') display.setDshUrl(origin)
|
|
1403
|
+
const host = request.headers?.host
|
|
1404
|
+
if (typeof host === 'string' && /^[\w.\-]+(:\d+)?$/.test(host)) {
|
|
1405
|
+
display.setDshUrl('http://' + host)
|
|
1406
|
+
}
|
|
1397
1407
|
// 每次读状态都顺手 reconcile 一次:设置页点完马上能看到结果,不用等下一个 tick。
|
|
1398
1408
|
const status = display.reconcile()
|
|
1399
1409
|
sendJson(response, 200, {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-pet-live2d",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.3",
|
|
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.3",
|
|
53
|
+
"dsh-pet-live2d-desktop-win32-x64": "3.1.3"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
56
|
"esbuild": "^0.25.10",
|