dsh-folia 4.26.0-pre.32 → 4.26.0-pre.34
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/lib/boot/index.js +4 -1
- package/lib/client.js +6 -3
- package/lib/routes/boot.js +2 -1
- package/package.json +1 -1
package/lib/boot/index.js
CHANGED
|
@@ -85,7 +85,10 @@ export function writeBoot(patch) {
|
|
|
85
85
|
// items 与 clipId 保持一致:写 items 时把 clipId 定成第一条(旧读路径仍能工作)
|
|
86
86
|
if (Array.isArray(next.items)) {
|
|
87
87
|
next.items = next.items.filter((x) => typeof x === 'string' && x);
|
|
88
|
-
|
|
88
|
+
// ⚠️ 只有「没显式给 clipId」时才用 items[0] 兜底。
|
|
89
|
+
// 真实事故:select 传了 clipId+items,被这里强制改成 items[0] ⇒ 点「使用」切不过去。
|
|
90
|
+
const explicit = Object.prototype.hasOwnProperty.call(patch, 'clipId') && typeof patch.clipId === 'string' && patch.clipId;
|
|
91
|
+
if (next.items.length) { if (!explicit || !next.items.includes(explicit)) next.clipId = next.items[0]; }
|
|
89
92
|
else if (typeof next.clipId === 'string' && next.clipId) next.items = [next.clipId];
|
|
90
93
|
} else if (typeof next.clipId === 'string' && next.clipId) {
|
|
91
94
|
next.items = [next.clipId];
|
package/lib/client.js
CHANGED
|
@@ -18066,15 +18066,18 @@ window.__ModuleLoader__.load({
|
|
|
18066
18066
|
}
|
|
18067
18067
|
if (kind === "select") setNote({ ok: true, text: weT("已选中「{name}」,下次启动生效", { name: label }) });
|
|
18068
18068
|
if (kind === "remove") setNote({ ok: true, text: weT("已删除:{name}", { name: label }) });
|
|
18069
|
-
|
|
18069
|
+
if (kind === "import") setNote({ ok: true, text: weT("已导入:{name}", { name: label }) });
|
|
18070
18070
|
if (kind === "toggle") setNote({ ok: true, text: payload.enabled ? weT("开机动画已开启") : weT("开机动画已关闭") });
|
|
18071
18071
|
if (kind === "settings") setNote({ ok: true, text: weT("已保存") });
|
|
18072
18072
|
// 开关/参数类:宿主把整份 boot 配置回给我们({ ok, ...boot }),直接并进 state,
|
|
18073
18073
|
// **不再 load(true) 重拉整表** —— 那次重拉会让所有控件先禁用再恢复,视觉上就是闪一下。
|
|
18074
|
-
if (kind === "toggle" || kind === "settings") {
|
|
18074
|
+
if (kind === "toggle" || kind === "settings" || kind === "select") {
|
|
18075
|
+
// 宿主把整份 boot 配置回给我们(含 clipId/items/poolMode/transition/act1)⇒ 直接并进 state。
|
|
18076
|
+
// select 以前走 load(true):会重拉站点候选(两跳网络),"切换慢"就是这个原因。
|
|
18075
18077
|
setState((prev) => (prev ? { ...prev, ...r } : prev));
|
|
18076
18078
|
} else {
|
|
18077
|
-
|
|
18079
|
+
// 删除/导入只刷新本地清单,不重拉站点候选(load(false) 走 30s 缓存)
|
|
18080
|
+
await load(false);
|
|
18078
18081
|
}
|
|
18079
18082
|
} else {
|
|
18080
18083
|
const code = (r && r.error) || "failed";
|
package/lib/routes/boot.js
CHANGED
|
@@ -424,7 +424,8 @@ disposers.push(webServer.register({
|
|
|
424
424
|
if (!id) { sendJson(res, 400, { ok: false, error: 'bad-id' }); return; }
|
|
425
425
|
if (!clipExists(id)) { sendJson(res, 404, { ok: false, error: 'not-installed' }); return; }
|
|
426
426
|
const cur = readBoot();
|
|
427
|
-
|
|
427
|
+
// 选中的一律提到池首:poolMode=first 时下次启动立刻就是它
|
|
428
|
+
const items = [id, ...(Array.isArray(cur.items) ? cur.items : []).filter((x) => x !== id)];
|
|
428
429
|
const boot = writeBoot({ clipId: id, items, enabled: true });
|
|
429
430
|
if (typeof log === 'function') log(`[boot] selected ${id}`);
|
|
430
431
|
sendJson(res, 200, { ok: true, ...boot });
|