dsh-folia 4.23.6 → 4.23.8
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/client.js +1009 -49
- package/lib/download-queue.js +225 -26
- package/lib/features.js +2 -0
- package/lib/route-registry.js +10 -0
- package/lib/routes/boot.js +2 -1
- package/lib/routes/cache.js +448 -0
- package/lib/routes/diag.js +80 -0
- package/lib/routes/downloads.js +31 -2
- package/lib/routes/inventory.js +23 -11
- package/lib/routes/pets.js +2 -1
- package/lib/routes/skins.js +16 -2
- package/lib/switch-cache-family.js +152 -0
- package/package.json +2 -1
package/lib/client.js
CHANGED
|
@@ -745,6 +745,13 @@ window.__ModuleLoader__.load({
|
|
|
745
745
|
"站点上还没有桌宠。": "No pets on the site yet.",
|
|
746
746
|
"站点不可达": "Site unreachable",
|
|
747
747
|
"预览尺寸": "Preview-size",
|
|
748
|
+
// ── 4.23.8 壁纸切换:点击反馈 / 已缓存角标 ──
|
|
749
|
+
// 「已缓存」是**族级**结论(原画或 1080p 任一档已落地),所以英文不做 "downloaded"
|
|
750
|
+
// 那种"确指这一条"的措辞 —— 那一层语义由 `local`(精确)承担,只在排障里用。
|
|
751
|
+
"已缓存": "Cached",
|
|
752
|
+
"已在本地缓存(原画或 1080p 任一档已落地),点它不必等网络":
|
|
753
|
+
"Cached locally (original or 1080p variant is already on disk) — no network wait",
|
|
754
|
+
"正在切换,请稍候": "Switching, please wait",
|
|
748
755
|
|
|
749
756
|
// ── 第二轮补词:来源筛选 / 页签引导条 / 桌宠提示 / 模型名(专有名词不译,但必须在册)──
|
|
750
757
|
"开机动画": "Boot animation",
|
|
@@ -902,6 +909,38 @@ window.__ModuleLoader__.load({
|
|
|
902
909
|
"已设为用原画(下载链路不可用,下次点这张会直连原画):{name}": "Set to use the original (the download queue is unavailable, so the next click streams the original): {name}",
|
|
903
910
|
"已设为用原画(入队失败,下次点这张会直连原画):{name}": "Set to use the original (queueing failed, so the next click streams the original): {name}",
|
|
904
911
|
"已改回自动选档:{name}": "Back to automatic quality selection: {name}",
|
|
912
|
+
|
|
913
|
+
// ── 4.23.7「缓存管理」(系统 → 缓存位置 → 这一段)────────────────────────────
|
|
914
|
+
"缓存管理": "Cache management",
|
|
915
|
+
"个文件": "files",
|
|
916
|
+
"不在可清理目录内": "Outside the clearable location",
|
|
917
|
+
"媒体库": "Media library",
|
|
918
|
+
"站点媒体": "Site media",
|
|
919
|
+
"皮肤包": "Skin packages",
|
|
920
|
+
"已装皮肤": "Installed skins",
|
|
921
|
+
"Electron 缓存": "Electron cache",
|
|
922
|
+
"需重启 DSH": "Needs a DSH restart",
|
|
923
|
+
"正在统计缓存用量…": "Measuring cache usage…",
|
|
924
|
+
"合计 {size}({n} 个文件)· 缓存都可再生,随时可删": "Total {size} ({n} files) · all cache is regenerable and safe to delete",
|
|
925
|
+
"媒体库(壁纸/开机动画/桌宠)": "Media library (wallpapers / boot animations / pets)",
|
|
926
|
+
"站点媒体缓存": "Site media cache",
|
|
927
|
+
"重新统计各层用量(只读,不改盘)": "Re-measure usage (read-only, no disk changes)",
|
|
928
|
+
"清空媒体": "Clear media",
|
|
929
|
+
"删除已下载的壁纸 / 开机动画 / 桌宠(可重新下载)": "Delete downloaded wallpapers / boot animations / pets (they can be downloaded again)",
|
|
930
|
+
"清空站点媒体": "Clear site media",
|
|
931
|
+
"清空皮肤包": "Clear skin packages",
|
|
932
|
+
"清空已装皮肤…": "Clear installed skins…",
|
|
933
|
+
"清空已装皮肤(等于把皮肤中心的皮肤全部卸载,需二次确认)": "Clear installed skins (uninstalls every skin in the skin center; asks for confirmation)",
|
|
934
|
+
"确认清空已装皮肤": "Confirm clearing installed skins",
|
|
935
|
+
"确认卸载全部已装皮肤(不可撤销)": "Confirm uninstalling every installed skin (cannot be undone)",
|
|
936
|
+
"清空 Electron 缓存": "Clear Electron cache",
|
|
937
|
+
"清的是 Electron 自己的 Cache / GPUCache;占用中的文件请重启 DSH 后彻底生效": "Clears Electron's own Cache / GPUCache; files still in use are removed after restarting DSH",
|
|
938
|
+
"一键清理(不含皮肤)": "Clean up (without skins)",
|
|
939
|
+
"清掉除「已装皮肤」以外的全部缓存": "Clear every cache except installed skins",
|
|
940
|
+
"读取缓存用量失败:{error}": "Failed to measure cache usage: {error}",
|
|
941
|
+
"清理失败:{error}": "Cleanup failed: {error}",
|
|
942
|
+
"已清理 {name}:释放 {size}({n} 个文件)": "Cleared {name}: released {size} ({n} files)",
|
|
943
|
+
"已清理 {name}:释放 {size}({n} 个文件);{failed} 个文件被占用,重启 DSH 后彻底生效": "Cleared {name}: released {size} ({n} files); {failed} file(s) in use will be removed after restarting DSH",
|
|
905
944
|
};
|
|
906
945
|
|
|
907
946
|
// ── 内联模块:src/i18n-copy-picker.js —— 英文词表域:壁纸选择器与快捷面板(picker-* · quick-panel · sidebar-right · theme-follow)(构建期注入;勿手改本段)──
|
|
@@ -15978,11 +16017,111 @@ window.__ModuleLoader__.load({
|
|
|
15978
16017
|
sel.cacheDirNote),
|
|
15979
16018
|
sel.cacheDirError && React.createElement("div", { className: "we-picker__error" },
|
|
15980
16019
|
sel.cacheDirError),
|
|
16020
|
+
// 4.23.7:「缓存管理」—— 同一节里**接在缓存位置之后**(搬动/新增节都会改
|
|
16021
|
+
// 「系统」页签的节序列,那是 `verify-scene-live` 的细锚;这条是"同一节的又一组行")。
|
|
16022
|
+
renderCacheManagerBlock(ctx),
|
|
15981
16023
|
),
|
|
15982
16024
|
),
|
|
15983
16025
|
);
|
|
15984
16026
|
}
|
|
15985
16027
|
|
|
16028
|
+
/**
|
|
16029
|
+
* 「缓存管理」这一组行(4.23.7):五层用量 + 五个清理按钮 + 释放量提示。
|
|
16030
|
+
*
|
|
16031
|
+
* 为什么放在**同一个节**里(不新开 `we-picker__section`):
|
|
16032
|
+
* 「系统」页签的节序列与控件标签序列是 `test/verify-scene-live.mjs` 的硬锚
|
|
16033
|
+
* (它是纯搬动唯一会破坏的东西)。缓存位置与缓存管理回答的是同一个问题
|
|
16034
|
+
* ("这些可再生的文件占了我多少地方"),合成一节既准确又不改那条锚。
|
|
16035
|
+
*
|
|
16036
|
+
* 为什么按钮是**显式五个**而不是"一个清全部的开关 + 勾选":
|
|
16037
|
+
* `skins`(已装皮肤)清掉等于把皮肤中心的皮肤**全部卸载**,是不可撤销的破坏性动作;
|
|
16038
|
+
* 它必须是**用户单独指到**的那一个按钮(二次确认),不能被"一键清理"顺手带走。
|
|
16039
|
+
* `electron`(Electron 自己的 Cache/GPUCache)被占用是常态 ⇒ 只能尽力删并提示重启。
|
|
16040
|
+
*/
|
|
16041
|
+
function renderCacheManagerBlock(ctx) {
|
|
16042
|
+
const { sel, onClearCache, onClearCacheSkins, onRefreshCacheUsage, armedConfirm, onDisarmConfirm } = ctx;
|
|
16043
|
+
const usage = sel && sel.cacheUsage;
|
|
16044
|
+
const items = (usage && Array.isArray(usage.items)) ? usage.items : [];
|
|
16045
|
+
const rowOf = (t) => items.find((x) => x && x.target === t) || null;
|
|
16046
|
+
const busy = Boolean(sel && sel.cacheBusy);
|
|
16047
|
+
const clearing = Boolean(sel && sel.cacheBusy === "clear");
|
|
16048
|
+
const fmt = (n) => (typeof fmtCacheBytes === "function" ? fmtCacheBytes(n) : String(n));
|
|
16049
|
+
const clear = (targets) => { try { onClearCache(targets); } catch { /* 处理器缺失不影响渲染 */ } };
|
|
16050
|
+
const btn = (key, label, targets, title) => React.createElement("button", {
|
|
16051
|
+
key, type: "button", className: "we-picker__btn",
|
|
16052
|
+
disabled: busy || !items.length,
|
|
16053
|
+
title: title || label,
|
|
16054
|
+
onClick: () => clear(targets),
|
|
16055
|
+
}, label);
|
|
16056
|
+
const line = (t, label, extra) => {
|
|
16057
|
+
const row = rowOf(t);
|
|
16058
|
+
const bytes = row ? Number(row.bytes) || 0 : 0;
|
|
16059
|
+
const files = row ? Number(row.files) || 0 : 0;
|
|
16060
|
+
const within = !row || row.within !== false;
|
|
16061
|
+
return React.createElement("div", { className: "we-picker__row", key: "cache-usage-" + t },
|
|
16062
|
+
React.createElement("span", { className: "we-picker__hint we-picker__label" }, label),
|
|
16063
|
+
React.createElement("span", { className: "we-picker__uploads-path" },
|
|
16064
|
+
within ? fmt(bytes) + " · " + files + " " + weT("个文件") : weT("不在可清理目录内")),
|
|
16065
|
+
extra ? React.createElement("span", { className: "we-picker__hint" }, extra) : null,
|
|
16066
|
+
);
|
|
16067
|
+
};
|
|
16068
|
+
const pendingSkins = String(armedConfirm || "") === "cache:skins";
|
|
16069
|
+
return React.createElement(React.Fragment, null,
|
|
16070
|
+
// ⚠️ 这一行**故意不用** `we-picker__section-label`:那会把「缓存管理」算成第八个"节",
|
|
16071
|
+
// 改掉 `verify-scene-live` 的节序列锚(见上面"为什么放在同一个节里")。
|
|
16072
|
+
React.createElement("div", { className: "we-picker__row", key: "cache-mgr-head" },
|
|
16073
|
+
React.createElement("span", { className: "we-picker__ctl" }, weT("缓存管理")),
|
|
16074
|
+
React.createElement("button", {
|
|
16075
|
+
className: "we-picker__btn", type: "button",
|
|
16076
|
+
disabled: busy, title: weT("重新统计各层用量(只读,不改盘)"),
|
|
16077
|
+
onClick: () => { try { onRefreshCacheUsage(); } catch { /* ignore */ } },
|
|
16078
|
+
}, weT("刷新")),
|
|
16079
|
+
),
|
|
16080
|
+
React.createElement("div", { className: "we-picker__hint", key: "cache-mgr-total" },
|
|
16081
|
+
usage
|
|
16082
|
+
? weT("合计 {size}({n} 个文件)· 缓存都可再生,随时可删", {
|
|
16083
|
+
size: fmt((usage.total && usage.total.bytes) || 0),
|
|
16084
|
+
n: (usage.total && usage.total.files) || 0,
|
|
16085
|
+
})
|
|
16086
|
+
: weT("正在统计缓存用量…")),
|
|
16087
|
+
line("library", weT("媒体库(壁纸/开机动画/桌宠)")),
|
|
16088
|
+
line("site-media", weT("站点媒体缓存")),
|
|
16089
|
+
line("skins-zip", weT("皮肤包")),
|
|
16090
|
+
line("skins", weT("已装皮肤")),
|
|
16091
|
+
line("electron", weT("Electron 缓存"), weT("需重启 DSH")),
|
|
16092
|
+
React.createElement("div", { className: "we-picker__row", key: "cache-mgr-actions" },
|
|
16093
|
+
btn("clear-library", weT("清空媒体"), ["library"], weT("删除已下载的壁纸 / 开机动画 / 桌宠(可重新下载)")),
|
|
16094
|
+
btn("clear-site-media", weT("清空站点媒体"), ["site-media"]),
|
|
16095
|
+
btn("clear-skins-zip", weT("清空皮肤包"), ["skins-zip"]),
|
|
16096
|
+
// 破坏性:清掉 = 皮肤中心那边的皮肤全部卸载。两段式(上膛 → 确认)。
|
|
16097
|
+
pendingSkins
|
|
16098
|
+
? React.createElement(React.Fragment, null,
|
|
16099
|
+
React.createElement("button", {
|
|
16100
|
+
key: "clear-skins-confirm", type: "button", className: "we-picker__btn",
|
|
16101
|
+
disabled: clearing, title: weT("确认卸载全部已装皮肤(不可撤销)"),
|
|
16102
|
+
onClick: () => { try { onClearCacheSkins(); } catch { /* ignore */ } },
|
|
16103
|
+
}, weT("确认清空已装皮肤")),
|
|
16104
|
+
React.createElement("button", {
|
|
16105
|
+
key: "clear-skins-cancel", type: "button", className: "we-picker__btn",
|
|
16106
|
+
onClick: () => { try { onDisarmConfirm(); } catch { /* ignore */ } },
|
|
16107
|
+
}, weT("取消")))
|
|
16108
|
+
: React.createElement("button", {
|
|
16109
|
+
key: "clear-skins", type: "button", className: "we-picker__btn",
|
|
16110
|
+
disabled: busy || !items.length,
|
|
16111
|
+
title: weT("清空已装皮肤(等于把皮肤中心的皮肤全部卸载,需二次确认)"),
|
|
16112
|
+
onClick: () => { try { onClearCacheSkins(); } catch { /* ignore */ } },
|
|
16113
|
+
}, weT("清空已装皮肤…")),
|
|
16114
|
+
btn("clear-electron", weT("清空 Electron 缓存"), ["electron"], weT("清的是 Electron 自己的 Cache / GPUCache;占用中的文件请重启 DSH 后彻底生效")),
|
|
16115
|
+
btn("clear-all-but-skins", weT("一键清理(不含皮肤)"),
|
|
16116
|
+
["library", "site-media", "skins-zip", "electron"], weT("清掉除「已装皮肤」以外的全部缓存")),
|
|
16117
|
+
),
|
|
16118
|
+
sel && sel.cacheNote
|
|
16119
|
+
&& React.createElement("div", { className: "we-picker__hint", key: "cache-mgr-note" }, sel.cacheNote),
|
|
16120
|
+
sel && sel.cacheError
|
|
16121
|
+
&& React.createElement("div", { className: "we-picker__error", key: "cache-mgr-err" }, sel.cacheError),
|
|
16122
|
+
);
|
|
16123
|
+
}
|
|
16124
|
+
|
|
15986
16125
|
function renderAdvancedDiagSection(ctx) {
|
|
15987
16126
|
const { onToggleLiveDiag, sel } = ctx;
|
|
15988
16127
|
return React.createElement(React.Fragment, null,
|
|
@@ -19963,7 +20102,25 @@ window.__ModuleLoader__.load({
|
|
|
19963
20102
|
tabIndex: 0,
|
|
19964
20103
|
"aria-selected": w.id === sel.id ? "true" : "false",
|
|
19965
20104
|
title: w.title,
|
|
19966
|
-
|
|
20105
|
+
// **按下即反馈**(4.23.8 / 需求 G1):只做同步 DOM,不等任何请求 —— 第一处视觉
|
|
20106
|
+
// 变化必须在 50ms 内出现,否则用户会以为"没点上"。`weSwitchBegin` 顺带记下
|
|
20107
|
+
// clickFeedbackMs(点击 → 第一处视觉变化),收尾时摘下 pressed 与 aria-busy。
|
|
20108
|
+
onPointerDown: (ev) => {
|
|
20109
|
+
try { weSwitchBegin(ev && ev.currentTarget); } catch { /* 反馈是增强 */ }
|
|
20110
|
+
// 视频壁纸的提交前预热也借这一枪(按下到抬手是白捡的窗口)。
|
|
20111
|
+
try { warmVideoForPointer(ev, true); } catch { /* 预热是增强 */ }
|
|
20112
|
+
},
|
|
20113
|
+
onClick: () => {
|
|
20114
|
+
// 连点防护(G7):切换进行中再点别的卡 ⇒ **只保留最后一个**,并当面说明。
|
|
20115
|
+
// 为什么不静默忽略:用户最后点的就是他真正想看的,全丢掉等于让他再点一次。
|
|
20116
|
+
try {
|
|
20117
|
+
if (weSwitchQueuePick(w.id, () => applySelection(w.id, { fromManual: true }))) {
|
|
20118
|
+
try { lfSay(weT("正在切换,请稍候"), true); } catch { /* ignore */ }
|
|
20119
|
+
return;
|
|
20120
|
+
}
|
|
20121
|
+
} catch { /* 队列是增强 */ }
|
|
20122
|
+
applySelection(w.id, { fromManual: true });
|
|
20123
|
+
},
|
|
19967
20124
|
onKeyDown: cardKeyDown,
|
|
19968
20125
|
// 预取:悬停 300ms ⇒ 把**后面第一张**站点条目按 low 优先级拉一份到本地
|
|
19969
20126
|
// (见 src/local-first.js 的 lfSchedulePrefetch)。它只占 wallpaper 自己的槽,
|
|
@@ -19980,6 +20137,15 @@ window.__ModuleLoader__.load({
|
|
|
19980
20137
|
})
|
|
19981
20138
|
: null),
|
|
19982
20139
|
React.createElement("span", { className: "we-qp__item-title" }, w.title),
|
|
20140
|
+
// 「已缓存」角标(需求 B7 / 成因 ⑤):判据是**族级** `localReady` —— 原画或 1080p
|
|
20141
|
+
// 任一档已落地都算"点下去不用等网络"。这是用户唯一能看到的"为什么这张会快",
|
|
20142
|
+
// 也是排障时区分「在等解码」与「在等网络」的那一眼。
|
|
20143
|
+
w.localReady === true
|
|
20144
|
+
? React.createElement("span", {
|
|
20145
|
+
className: "we-qp__item-cached",
|
|
20146
|
+
title: weT("已在本地缓存(原画或 1080p 任一档已落地),点它不必等网络"),
|
|
20147
|
+
}, weT("已缓存"))
|
|
20148
|
+
: null,
|
|
19983
20149
|
w.id === sel.id
|
|
19984
20150
|
? React.createElement("span", { className: "we-qp__item-badge" }, weT("当前"))
|
|
19985
20151
|
: React.createElement("span", { className: "we-qp__item-type" }, CARD_TYPE_LABELS[w.type] || weT("壁纸")),
|
|
@@ -20110,7 +20276,20 @@ window.__ModuleLoader__.load({
|
|
|
20110
20276
|
tabIndex: 0,
|
|
20111
20277
|
"aria-selected": w.id === sel.id ? "true" : "false",
|
|
20112
20278
|
title: w.title,
|
|
20113
|
-
|
|
20279
|
+
// 与列表行**同一套**点击反馈 / 连点防护(需求 G6:不许另写一套)。
|
|
20280
|
+
onPointerDown: (ev) => {
|
|
20281
|
+
try { weSwitchBegin(ev && ev.currentTarget); } catch { /* 反馈是增强 */ }
|
|
20282
|
+
try { warmVideoForPointer(ev, true); } catch { /* 预热是增强 */ }
|
|
20283
|
+
},
|
|
20284
|
+
onClick: () => {
|
|
20285
|
+
try {
|
|
20286
|
+
if (weSwitchQueuePick(w.id, () => applySelection(w.id, { fromManual: true }))) {
|
|
20287
|
+
try { lfSay(weT("正在切换,请稍候"), true); } catch { /* ignore */ }
|
|
20288
|
+
return;
|
|
20289
|
+
}
|
|
20290
|
+
} catch { /* 队列是增强 */ }
|
|
20291
|
+
applySelection(w.id, { fromManual: true });
|
|
20292
|
+
},
|
|
20114
20293
|
onKeyDown: cardKeyDown,
|
|
20115
20294
|
// 卡片档与列表行同一套预取触发器(见 qpRenderRow / src/local-first.js)。
|
|
20116
20295
|
onMouseEnter: () => { try { lfSchedulePrefetch(w.id, sel.id); } catch { /* 预取是增强 */ } },
|
|
@@ -20789,51 +20968,52 @@ window.__ModuleLoader__.load({
|
|
|
20789
20968
|
videoWarm = null;
|
|
20790
20969
|
if (warmHoverTimer && typeof clearTimeout === "function") {
|
|
20791
20970
|
try { clearTimeout(warmHoverTimer); } catch { /* ignore */ }
|
|
20792
|
-
warmHoverTimer = 0;
|
|
20793
20971
|
}
|
|
20972
|
+
warmHoverTimer = 0;
|
|
20794
20973
|
if (!w) return;
|
|
20795
20974
|
if (w.timer && typeof clearTimeout === "function") { try { clearTimeout(w.timer); } catch { /* ignore */ } }
|
|
20796
|
-
|
|
20975
|
+
// ⚠️ **不再动元素**(4.23.8):预热元素现在住在**常驻双元素池**里,生命周期归池。
|
|
20976
|
+
// 旧实现在这里 `removeAttribute("src") + load()` 把元素清空 —— 那一手会连池里那个
|
|
20977
|
+
// 元素**已经解好的首帧**一起扔掉,下次切换又变冷启动(正是本版要修的东西)。
|
|
20978
|
+
// 这里只清"最近预热过哪条地址"的记账。
|
|
20797
20979
|
}
|
|
20798
20980
|
/**
|
|
20799
|
-
*
|
|
20981
|
+
* 预热一个视频源 —— **到首帧,不是只到元数据**(4.23.8)。
|
|
20982
|
+
*
|
|
20983
|
+
* 旧实现在这里自建一个 `<video>`、只 `preload="metadata"`、**绝不 play()**,理由是
|
|
20984
|
+
* "预热不得引进第二个解码器"(4K 双解码实测卡顿)。那条取舍在当时是对的,但它把
|
|
20985
|
+
* **首帧解码整段留在了关键路径上** —— 用户点一下要等的那 0.5–2s 主要就是这一段。
|
|
20986
|
+
*
|
|
20987
|
+
* 池化之后这条约束换了形态:交叉淡化期本来就会同时存在"旧元素 + 新元素"两个解码器,
|
|
20988
|
+
* 池容量恒为 2 ⇒ 把**池里的备用元素**预热到首帧**没有增加峰值**,只是把"新建"换成"复用"。
|
|
20989
|
+
* 于是可以安全地推进到首帧:预热元素 `muted` 播起来,首帧解出后再切换就只剩一次 play()。
|
|
20800
20990
|
*
|
|
20801
|
-
*
|
|
20802
|
-
* ·
|
|
20803
|
-
* ·
|
|
20804
|
-
* · 单槽位:换一个候选就把上一个释放掉(点选来回扫不会攒下一串解复用器)。
|
|
20991
|
+
* 不变量:
|
|
20992
|
+
* · 预热**只动池里不在屏上的那个元素**(`weSwitchArm` 内部有这条闸);
|
|
20993
|
+
* · 同一 url 幂等;任何时刻最多一个池元素被预热占用。
|
|
20805
20994
|
*/
|
|
20806
20995
|
function warmVideoUrl(url) {
|
|
20807
20996
|
const u = String(url || "");
|
|
20808
20997
|
if (!u || typeof document === "undefined" || typeof document.createElement !== "function") return;
|
|
20809
20998
|
if (videoWarm && videoWarm.url === u) return;
|
|
20810
20999
|
disposeWarmVideo();
|
|
20811
|
-
let el;
|
|
20812
|
-
try { el = document.createElement("video"); } catch { return; }
|
|
20813
|
-
if (!el || typeof el.load !== "function") return;
|
|
20814
21000
|
try {
|
|
20815
|
-
el
|
|
20816
|
-
el
|
|
20817
|
-
el
|
|
20818
|
-
|
|
20819
|
-
|
|
20820
|
-
|
|
20821
|
-
|
|
20822
|
-
|
|
20823
|
-
|
|
20824
|
-
|
|
20825
|
-
|
|
20826
|
-
|
|
20827
|
-
|
|
20828
|
-
|
|
20829
|
-
|
|
20830
|
-
|
|
20831
|
-
const w = videoWarm;
|
|
20832
|
-
if (!w || w.url !== String(url || "")) return null;
|
|
20833
|
-
videoWarm = null;
|
|
20834
|
-
if (w.timer && typeof clearTimeout === "function") { try { clearTimeout(w.timer); } catch { /* ignore */ } }
|
|
20835
|
-
liveLog("video-warm", "领养预热元素 " + String(w.el.readyState === undefined ? "-" : w.el.readyState) + " rs");
|
|
20836
|
-
return w.el;
|
|
21001
|
+
const el = weSwitchPoolPick(u);
|
|
21002
|
+
if (!el) return;
|
|
21003
|
+
weSwitchArm(el, u, null);
|
|
21004
|
+
videoWarm = { url: u, el, timer: 0 };
|
|
21005
|
+
liveLog("video-warm", "池内预热(到首帧) " + u.slice(Math.max(0, u.lastIndexOf("/") + 1)).slice(-24));
|
|
21006
|
+
} catch { /* 预热是增强:任何异常都不许影响切换 */ }
|
|
21007
|
+
}
|
|
21008
|
+
/**
|
|
21009
|
+
* 领养预热好的元素 —— 4.23.8 起**恒为 null**。
|
|
21010
|
+
*
|
|
21011
|
+
* 预热元素现在住在池里,由 `buildVideoMedia` 的 `weSwitchPoolPick()` 直接命中
|
|
21012
|
+
*(同 URL 且首帧已解),不再需要"单独一个槽位"这条中间态。保留这个函数是为了让
|
|
21013
|
+
* `buildVideoMedia` 的两条分支(领养 / 池化)都保持可读,且行为显式。
|
|
21014
|
+
*/
|
|
21015
|
+
function consumeWarmVideo() {
|
|
21016
|
+
return null;
|
|
20837
21017
|
}
|
|
20838
21018
|
/**
|
|
20839
21019
|
* 指针落到某张壁纸卡上时预热它。
|
|
@@ -20937,7 +21117,23 @@ window.__ModuleLoader__.load({
|
|
|
20937
21117
|
const prepared = consumePreparedMedia("VIDEO", sel.url);
|
|
20938
21118
|
// 预热元素(见 VIDEO_WARM_TTL_MS 那段):领养它 ⇒ 建层那一刻解复用器已经在位。
|
|
20939
21119
|
const warmed = prepared ? null : consumeWarmVideo(sel.url);
|
|
20940
|
-
|
|
21120
|
+
// **池化(4.23.8)**,但**只接"用户点击驱动"的切换**:没有点击上下文时
|
|
21121
|
+
// `weSwitchClickPlayer()` 返回 null ⇒ 落到一次性播放器,语义与旧实现逐字等价。
|
|
21122
|
+
// 为什么这样切:轮换/启动恢复/revalidate 三条路径各有自己的就绪判据与 smoke 判据
|
|
21123
|
+
//(`rotation-live-smoke` / `rotation-prepared-leak-smoke` / `rotation-smoke`),
|
|
21124
|
+
// 它们的既有契约就是"视频档每层新建一个 `<video>`、且不预热"—— 那条契约是为避开
|
|
21125
|
+
// 双解码与「GIF→静图→正片」的观感。用户报的"点已缓存壁纸卡一下"走的是**点击**这条路。
|
|
21126
|
+
// 新建 `<video>` = 解码器重建,正是那条诉求的结构性主因(`layerWantKey()` 把
|
|
21127
|
+
// `selection.url` 算进层键 ⇒ 换一张键必变 ⇒ 旧层让出 LAYER_ID ⇒ 建新层 ⇒ 再 new 一个
|
|
21128
|
+
// 元素 ⇒ 资源选择 / 取 moov / 首帧解码整段压在点击的关键路径上)。
|
|
21129
|
+
// 创生点只剩 `weSwitchNewPlayer()` 一处(见 video-switch.js),别处不许再造。
|
|
21130
|
+
// `typeof` 守卫:`test/verify-transcode-state.mjs` 这类判据把本文件**单文件**当模块加载,
|
|
21131
|
+
// 那时池模块不在作用域里 —— 与既有 `activeRotationGroup` 的探法同一套(缺省走安全方向)。
|
|
21132
|
+
const pooled = (prepared || warmed) ? null
|
|
21133
|
+
: (typeof weSwitchClickPlayer === "function" ? weSwitchClickPlayer(sel.url) : null);
|
|
21134
|
+
// 退化分支(只给单文件沙箱用:那里没有池模块)—— 正常构建永远走上面两条。
|
|
21135
|
+
const media = prepared || warmed || pooled
|
|
21136
|
+
|| (typeof weSwitchDetachedPlayer === "function" ? weSwitchDetachedPlayer() : document.createElement("video"));
|
|
20941
21137
|
const tok = String(sel.url || "").split("/").pop();
|
|
20942
21138
|
const rc = selection.transcodeReady;
|
|
20943
21139
|
const useCached = Boolean(rc && rc.url && rc.fps === selection.fpsCap && rc.token === tok);
|
|
@@ -20974,6 +21170,17 @@ window.__ModuleLoader__.load({
|
|
|
20974
21170
|
&& (sel.type !== "video" || /\/video-preview\//.test(sel.previewUrl) || siteStaticThumb);
|
|
20975
21171
|
if (stillPreview) media.poster = sel.previewUrl;
|
|
20976
21172
|
}
|
|
21173
|
+
// 池元素:把"装载去重 + 预热到首帧"交给池。上面那条 `media.src = …` 已经赋过地址,
|
|
21174
|
+
// `weSwitchArm` 据此**不会重复 load**(需求 A5:同一 src 已加载 ⇒ 直接 play);
|
|
21175
|
+
// 同时把这次要播的地址 / 是否抽帧版 / 缓存族是否命中告诉切换状态机(度量要用)。
|
|
21176
|
+
if (pooled) {
|
|
21177
|
+
const armedSrc = String(media.src || (useCached ? rc.url : sel.url) || "");
|
|
21178
|
+
weSwitchAttachPlayer(media, armedSrc, {
|
|
21179
|
+
is1080p: Boolean(useCached),
|
|
21180
|
+
cacheFamilyHit: sel.cacheFamilyHit === true,
|
|
21181
|
+
});
|
|
21182
|
+
weSwitchArm(media, armedSrc, null);
|
|
21183
|
+
}
|
|
20977
21184
|
media.autoplay = true;
|
|
20978
21185
|
// 轮播「当前视频播完就换下一张」档(issue #230 后续)必须**关掉 loop** ——
|
|
20979
21186
|
// `loop` 会让元素循环播放、`ended` 永远不触发,那条轮换信号就发不出来。
|
|
@@ -21630,7 +21837,10 @@ window.__ModuleLoader__.load({
|
|
|
21630
21837
|
(async () => {
|
|
21631
21838
|
const item = await lfFindItem(id);
|
|
21632
21839
|
if (!item || !item.mediaProxy) return; // 非站点条目:交给原路径
|
|
21633
|
-
|
|
21840
|
+
// **族级命中就够**(4.23.8 / 成因 ⑤):原画或 1080p 任一档已落地 ⇒ 播放走
|
|
21841
|
+
// `/folia/local-media/`,不必再入队。只认 `local`(精确)会让「下的是 1080p、
|
|
21842
|
+
// 播的是原画」这一族每次都白排一次下载 —— 那正是用户说的"已下载好还卡"。
|
|
21843
|
+
if (item.localReady === true || item.local === true) return;
|
|
21634
21844
|
const label = String(item.title || id);
|
|
21635
21845
|
if (LF_STATE.inflight.has(id)) { lfSay(`正在下载到本地:${label}`, true); return; }
|
|
21636
21846
|
let job = null;
|
|
@@ -21696,6 +21906,10 @@ window.__ModuleLoader__.load({
|
|
|
21696
21906
|
screenHeight: lfScreenHeight(),
|
|
21697
21907
|
};
|
|
21698
21908
|
if (Array.isArray(it.variants) && it.variants.length) entry.variants = it.variants;
|
|
21909
|
+
// 4.23.7:站点清单给的 sha256(部分条目为空)随条目带给队列 —— 下载完成后按它验内容。
|
|
21910
|
+
// 空串不发(宿主侧同样只认 64 位十六进制),免得把"没给"写成"给了个空的"。
|
|
21911
|
+
const sha = String(it.sha256 || "").trim().toLowerCase();
|
|
21912
|
+
if (/^[0-9a-f]{64}$/.test(sha)) entry.sha256 = sha;
|
|
21699
21913
|
if (lfPreferOriginal(it.id)) entry.quality = "original";
|
|
21700
21914
|
return entry;
|
|
21701
21915
|
}
|
|
@@ -21748,6 +21962,13 @@ window.__ModuleLoader__.load({
|
|
|
21748
21962
|
busy: false, // 是否有预取请求在飞
|
|
21749
21963
|
seen: new Set(), // 已预取过的 id(避免来回 hover 反复打宿主的 downloads/add)
|
|
21750
21964
|
};
|
|
21965
|
+
/**
|
|
21966
|
+
* 每次预取的张数(4.23.8 / 需求 C8)。**2** 而不是 1:
|
|
21967
|
+
* 之前只预取 1 张,于是"下一张 → 再点一下下一张"的第二下必然落在冷源上;
|
|
21968
|
+
* 取 2 张把这条链也盖住,代价只是多一个 low 优先级任务(不抢用户点击的槽)。
|
|
21969
|
+
* 顺序即优先级:第 1 张是**紧邻的下一张**,第 2 张才是再下一张。
|
|
21970
|
+
*/
|
|
21971
|
+
const LF_PREFETCH_COUNT = 2;
|
|
21751
21972
|
|
|
21752
21973
|
function lfCancelPrefetch() {
|
|
21753
21974
|
if (LF_PREFETCH.timer) { try { clearTimeout(LF_PREFETCH.timer); } catch { /* ignore */ } }
|
|
@@ -21781,27 +22002,42 @@ window.__ModuleLoader__.load({
|
|
|
21781
22002
|
if (i >= 0) { pool = p; at = i; break; }
|
|
21782
22003
|
}
|
|
21783
22004
|
if (!pool) return;
|
|
21784
|
-
|
|
21785
|
-
|
|
22005
|
+
// **按列表顺序取前 2 张**(4.23.8 / 需求 C8):顺序即优先级 —— 第 1 张就是"下一张"。
|
|
22006
|
+
// 跳过:非站点条目 / 族级已落地(`localReady`,已缓存的不必预取)/ 正在播的那张 /
|
|
22007
|
+
// 本次会话已经预取过的。
|
|
22008
|
+
const picks = [];
|
|
22009
|
+
for (let k = at + 1; k < pool.length && k <= at + 8 && picks.length < LF_PREFETCH_COUNT; k += 1) {
|
|
21786
22010
|
const cand = pool[k];
|
|
21787
|
-
if (!cand || !cand.mediaProxy
|
|
22011
|
+
if (!cand || !cand.mediaProxy) continue;
|
|
22012
|
+
if (cand.localReady === true || cand.local === true) continue;
|
|
21788
22013
|
if (playingId && String(cand.id) === playingId) continue;
|
|
21789
|
-
|
|
21790
|
-
|
|
22014
|
+
if (LF_PREFETCH.seen.has(String(cand.id))) continue;
|
|
22015
|
+
picks.push(cand);
|
|
21791
22016
|
}
|
|
21792
|
-
if (!
|
|
21793
|
-
const nextId = String(next.id);
|
|
21794
|
-
if (LF_PREFETCH.seen.has(nextId)) return;
|
|
22017
|
+
if (!picks.length) return;
|
|
21795
22018
|
// 已有 job(排队/在跑/已完成)⇒ 宿主侧本来就会去重,这里先问一次列表是为了
|
|
21796
|
-
//
|
|
22019
|
+
// **不白占预取名额**,也让 `seen` 只在真的发出去时才记账。
|
|
22020
|
+
let jobs = [];
|
|
21797
22021
|
try {
|
|
21798
22022
|
const resp = await apiJson("/downloads/list");
|
|
21799
22023
|
const doc = (resp && resp.data) || resp || {};
|
|
21800
|
-
|
|
21801
|
-
if (jobs.some((j) => j && j.url === next.media && j.status !== "failed" && j.status !== "cancelled")) return;
|
|
22024
|
+
jobs = Array.isArray(doc.jobs) ? doc.jobs : [];
|
|
21802
22025
|
} catch { return; }
|
|
21803
|
-
|
|
21804
|
-
|
|
22026
|
+
const fresh = picks.filter((c) => !jobs.some((j) => j
|
|
22027
|
+
&& j.url === c.media && j.status !== "failed" && j.status !== "cancelled"));
|
|
22028
|
+
if (!fresh.length) return;
|
|
22029
|
+
for (const c of fresh) LF_PREFETCH.seen.add(String(c.id));
|
|
22030
|
+
// 第 1 张就是"**下一张**"(顺序即优先级)。单张走既有那条口径(priority=low,
|
|
22031
|
+
// 不抢用户点击的 high);只有真的取到 2 张时才批量发一次 —— 宿主 `/downloads/add`
|
|
22032
|
+
// 本来就收数组,2 张 = 2 个 low 任务,不会变成 high。
|
|
22033
|
+
const next = fresh[0];
|
|
22034
|
+
if (fresh.length === 1) {
|
|
22035
|
+
await apiPostJson("/downloads/add", { items: [{ kind: "wallpaper", url: next.media, priority: "low" }] }, { parse: "always" });
|
|
22036
|
+
return;
|
|
22037
|
+
}
|
|
22038
|
+
await apiPostJson("/downloads/add", {
|
|
22039
|
+
items: fresh.map((c) => ({ kind: "wallpaper", url: c.media, priority: "low" })),
|
|
22040
|
+
}, { parse: "always" });
|
|
21805
22041
|
} finally {
|
|
21806
22042
|
LF_PREFETCH.busy = false;
|
|
21807
22043
|
}
|
|
@@ -22541,6 +22777,612 @@ window.__ModuleLoader__.load({
|
|
|
22541
22777
|
return api;
|
|
22542
22778
|
}
|
|
22543
22779
|
|
|
22780
|
+
// ── 内联模块:src/video-switch.js —— 壁纸切换手感:双元素池 / 首帧预热 / 点击反馈 / switchLatencyMs 与 clickFeedbackMs 度量(构建期注入;勿手改本段)──
|
|
22781
|
+
/*
|
|
22782
|
+
* video-switch.js — **已缓存壁纸的切换手感**:常驻双元素池 / 首帧预热 / 点击反馈 / 切换度量。
|
|
22783
|
+
*
|
|
22784
|
+
* ── 为什么要有这个文件 ────────────────────────────────────────────────────────
|
|
22785
|
+
* 用户实测:「点已下载好的壁纸会卡一下才播,Wallpaper Engine 切换很流畅」。
|
|
22786
|
+
* 实测把这条主观描述拆成**两条独立的成本**,它们必须在同一处被量出来,否则改一处
|
|
22787
|
+
* 就会被另一处盖掉:
|
|
22788
|
+
*
|
|
22789
|
+
* ① **元素重建**(恒在):`src/live-layer.js` 的 `layerWantKey()` 把 `selection.url`
|
|
22790
|
+
* 算进层键 ⇒ 换一张视频壁纸键必变 ⇒ 旧层让出 `LAYER_ID` ⇒ `obtainLayerNode()`
|
|
22791
|
+
* 新建 div ⇒ `buildVideoMedia()` 新建 `<video>`。于是**资源选择 → 取 moov →
|
|
22792
|
+
* 解复用器初始化 → 首帧解码**整段都压在点击的关键路径上。
|
|
22793
|
+
* (`src/media-prep.js` 对视频档**故意**不跑准备链,所以 `consumePreparedMedia`
|
|
22794
|
+
* 在手动点击时恒为 null —— 这条后门对视频档实际是关着的。)
|
|
22795
|
+
*
|
|
22796
|
+
* ② **缓存族不命中**(条件性,但离群最大):`lib/routes/downloads.js` 的
|
|
22797
|
+
* `libraryDest()` 拿**最终 URL 的 basename** 做散列,原画 `x.mp4` 与 1080p
|
|
22798
|
+
* `x-1080p.mp4` 是两条独立缓存。于是「已经下好了」的壁纸可能仍然 `local:false`
|
|
22799
|
+
* ⇒ `mediaProxy` 回落到 `/folia/site-media/` 代理 ⇒ 走一次 客户端→宿主→上游
|
|
22800
|
+
* 的 HTTP 中继,甚至重新入队。
|
|
22801
|
+
*
|
|
22802
|
+
* ── 本文件拥有的东西 ──────────────────────────────────────────────────────────
|
|
22803
|
+
* · **常驻双元素池**:一对长生命周期的 `<video>`(`we-pool-1` / `we-pool-2`),
|
|
22804
|
+
* **永不再 `createElement("video")`**。可见的那个在屏上,另一个预热下一张的
|
|
22805
|
+
* **首帧**(不是只到 metadata —— 那正是 `video-layer.js` 预热槽位止步的地方)。
|
|
22806
|
+
* 切换时把预热好的元素**整体搬进新层**:同文档内 reparent `<video>` 不重载
|
|
22807
|
+
* (iframe 才会),元素身份不变、解码器连续、首帧已在 ⇒ `play()` 即出画。
|
|
22808
|
+
* · **切换状态机**:`idle → priming → preloading → swapping → playing`
|
|
22809
|
+
* (超时进 `buffering`,失败进 `failed`)。键盘 / 滚轮 / 「下一张」全部走**同一条**
|
|
22810
|
+
* `weSwitchBegin()`,不另写一套。
|
|
22811
|
+
* · **点击反馈**:按下即同步置 pressed / `aria-busy`,并记录 `clickFeedbackMs`。
|
|
22812
|
+
* · **度量**:`switchLatencyMs` / `clickFeedbackMs` / `cacheFamilyHit` / `is1080p`
|
|
22813
|
+
* 四字段的环形缓冲(最近 20 次),同时打 console 与上报
|
|
22814
|
+
* `POST /folia/diag/switch-stats`(宿主侧 `/folia/diag/switch-stats` 读回)。
|
|
22815
|
+
* · **掉帧提示**:`requestVideoFrameCallback` 统计出 < 24fps 且持续 2s ⇒ 置
|
|
22816
|
+
* `weSwitchJank`,面板据此提示「建议切换 1080p」。
|
|
22817
|
+
*
|
|
22818
|
+
* ── 不变量(改动前先读,都是踩过的坑)─────────────────────────────────────────
|
|
22819
|
+
* ① **绝不在"已上屏"的元素上换 src**。换源会清掉当前帧 ⇒ 屏上只剩层底色(纯色帧)。
|
|
22820
|
+
* `src/video-layer.js` 的 `layerStillPending()` 与
|
|
22821
|
+
* `test/verify-transcode-state.mjs` 都在盯着这条。本文件的做法是:
|
|
22822
|
+
* 换 src 只发生在**不在屏上**的池元素上(它此刻在预热)。
|
|
22823
|
+
* ② **同一 src 已加载就绝不重复 `load()`**:同值重启资源选择等于白跑一次取数。
|
|
22824
|
+
* 判据在 `weSwitchArm()`:`el.__weUrl === url && readyState >= 1` ⇒ 直接复用。
|
|
22825
|
+
* ③ **池容量恒为 2**:第三个解码器一律不建(`test/verify-switch-smooth.mjs` 数
|
|
22826
|
+
* `createElement("video")` 的调用次数)。旧元素在淡出**之后**才回到池里复用。
|
|
22827
|
+
* ④ **本文件零顶层可执行语句**:它会被 `scripts/build-client.mjs` 内联到 bundle
|
|
22828
|
+
* 顶部,顶层读别的模块的 `const` 会撞 TDZ(见 docs/CODE-STRUCTURE.md §5)。
|
|
22829
|
+
* 所有跨模块调用(`apiPostJson` / `liveLog`)都只在**函数体里**发生。
|
|
22830
|
+
*/
|
|
22831
|
+
|
|
22832
|
+
// ── 常量(全部是用户感知口径,不是内部实现细节)──────────────────────────────
|
|
22833
|
+
// 交叉淡入时长:150–250ms 是需求区间,取中值。短于此观感是"跳变",长于此会被
|
|
22834
|
+
// 当成"又卡了一下"——两个方向都坏。
|
|
22835
|
+
const WE_SWITCH_FADE_MS = 200;
|
|
22836
|
+
// 缓冲提示阈值:1.5s 内没进到可播状态就出「正在缓冲 x%」,而不是留一块空白/旧壁纸
|
|
22837
|
+
// 让人以为"点了没反应"。
|
|
22838
|
+
const WE_SWITCH_BUFFER_HINT_MS = 1500;
|
|
22839
|
+
// 度量环形缓冲:只留最近 20 次(需求 D9)。
|
|
22840
|
+
const WE_SWITCH_STATS_MAX = 20;
|
|
22841
|
+
// 掉帧判定:< 24fps 且持续 2s(需求 D10)。
|
|
22842
|
+
const WE_SWITCH_JANK_FPS = 24;
|
|
22843
|
+
const WE_SWITCH_JANK_HOLD_MS = 2000;
|
|
22844
|
+
// 池容量:恒为 2(可见 + 预热)。绝不再大 —— 每个元素是一个解码器。
|
|
22845
|
+
const WE_SWITCH_POOL_SIZE = 2;
|
|
22846
|
+
// pressed 态的**视觉兜底**复位:切换失败/没人收尾时别让卡片永久"按着"。
|
|
22847
|
+
// ⚠️ 它只复位**视觉**,不结算状态机 —— 慢切换是合法的(未缓存的源本来就慢),
|
|
22848
|
+
// 到点就把上下文结算掉会让「正在缓冲 x%」这条提示**永远来不及出现**
|
|
22849
|
+
// (1.2s 的视觉兜底 < 1.5s 的缓冲阈值,实测就是这么互相打架的)。
|
|
22850
|
+
const WE_SWITCH_PRESS_MS = 1200;
|
|
22851
|
+
// 状态机硬上限:真正的"永远等不到"必须收口,否则连点会被永久挡住。
|
|
22852
|
+
// 取值远大于缓冲阈值,让缓冲提示有充分的展示窗口。
|
|
22853
|
+
const WE_SWITCH_HARD_MS = 60000;
|
|
22854
|
+
|
|
22855
|
+
// ── 池与状态 ──────────────────────────────────────────────────────────────────
|
|
22856
|
+
const weSwitchPool = []; // [{ id, el }] 长度恒 ≤ WE_SWITCH_POOL_SIZE
|
|
22857
|
+
let weSwitchVisibleEl = null; // 此刻在屏上的那个池元素(== LAYER_ID 层里的 video)
|
|
22858
|
+
let weSwitchCtx = null; // 本次切换的上下文(状态机 / 计时)
|
|
22859
|
+
const weSwitchStats = []; // 最近 20 条度量
|
|
22860
|
+
let weSwitchJank = null; // { fps, at } 掉帧结论(空 = 无结论)
|
|
22861
|
+
let weSwitchJankSeen = { fps: 0, since: 0 };
|
|
22862
|
+
|
|
22863
|
+
/** 池元素 → "它在不在屏上"。测试与回收都用它。 */
|
|
22864
|
+
function weSwitchIsVisible(el) {
|
|
22865
|
+
return Boolean(el) && el === weSwitchVisibleEl;
|
|
22866
|
+
}
|
|
22867
|
+
|
|
22868
|
+
/**
|
|
22869
|
+
* 造一个池元素。**这是本仓库唯一允许 `createElement("video")` 的壁纸播放器入口**
|
|
22870
|
+
*(`video-layer.js` 的 `buildVideoMedia` 已改为向池申请,不再自建)。
|
|
22871
|
+
*/
|
|
22872
|
+
function weSwitchNewPlayer(slot) {
|
|
22873
|
+
let el;
|
|
22874
|
+
try { el = document.createElement("video"); } catch { return null; }
|
|
22875
|
+
if (!el) return null;
|
|
22876
|
+
const id = "we-pool-" + String(slot + 1);
|
|
22877
|
+
try { el.dataset.wePlayerId = id; } catch { /* 精简 DOM 没有 dataset */ }
|
|
22878
|
+
// preload=auto 与 `video-layer.js` 的建层口径一致:moov 在文件尾部,缺省会取完
|
|
22879
|
+
// moov 就停,真正取帧要等 play()。
|
|
22880
|
+
try { el.preload = "auto"; } catch { /* ignore */ }
|
|
22881
|
+
try { el.muted = true; } catch { /* ignore */ }
|
|
22882
|
+
try { el.loop = true; } catch { /* ignore */ }
|
|
22883
|
+
try { el.autoplay = false; } catch { /* ignore */ }
|
|
22884
|
+
try { el.setAttribute("playsinline", ""); } catch { /* ignore */ }
|
|
22885
|
+
if (!el.__wePlayers) { try { el.__wePlayers = []; } catch { /* ignore */ } }
|
|
22886
|
+
return el;
|
|
22887
|
+
}
|
|
22888
|
+
|
|
22889
|
+
/** 池惰性初始化:第一次申请时才建,最多两个。 */
|
|
22890
|
+
function weSwitchPoolEnsure() {
|
|
22891
|
+
if (weSwitchPool.length >= WE_SWITCH_POOL_SIZE) return weSwitchPool;
|
|
22892
|
+
if (typeof document === "undefined" || typeof document.createElement !== "function") return weSwitchPool;
|
|
22893
|
+
for (let slot = weSwitchPool.length; slot < WE_SWITCH_POOL_SIZE; slot += 1) {
|
|
22894
|
+
const el = weSwitchNewPlayer(slot);
|
|
22895
|
+
if (el) weSwitchPool.push({ id: "we-pool-" + String(slot + 1), slot, el });
|
|
22896
|
+
}
|
|
22897
|
+
return weSwitchPool;
|
|
22898
|
+
}
|
|
22899
|
+
|
|
22900
|
+
/**
|
|
22901
|
+
* 给某个 URL 挑一个池元素。
|
|
22902
|
+
*
|
|
22903
|
+
* 优先级(顺序即"切换能有多快"的顺序):
|
|
22904
|
+
* ① 已经预热好这个 URL 且**首帧已解**的 ⇒ 直接命中(最快:只剩 play);
|
|
22905
|
+
* ② 已经带着这个 URL(metadata 到位)的 ⇒ 续用,不重设 src;
|
|
22906
|
+
* ③ **还没装任何 URL** 的空闲元素(第一次用池时的常态);
|
|
22907
|
+
* ④ 不在屏上、但装着**别的** URL 的(拿它换源 —— 它不在屏上,换源安全)。
|
|
22908
|
+
* ⑤ 全都占着且都在屏上(只可能是"旧层还没淡完")⇒ 仍返回一个不在屏上的:
|
|
22909
|
+
* 宁可复用也不能新建(不变量 ③)。
|
|
22910
|
+
*
|
|
22911
|
+
* ⚠️ ③ 必须排在 ④ 前面:否则连着为两张不同的壁纸申请时,第二张会拿到**刚被第一张
|
|
22912
|
+
* 占用的那个元素**,两次申请返回同一个节点(H11「同一玩家实例不被替换」直接失效,
|
|
22913
|
+
* 而且第一张的预热白做)。这条是实测出来的缺陷,别按"反正都是池元素"糊过去。
|
|
22914
|
+
*/
|
|
22915
|
+
function weSwitchPoolPick(url) {
|
|
22916
|
+
const pool = weSwitchPoolEnsure();
|
|
22917
|
+
const u = String(url || "");
|
|
22918
|
+
const visible = weSwitchVisibleEl;
|
|
22919
|
+
// ①②:同一个 URL 的元素
|
|
22920
|
+
let sameMeta = null;
|
|
22921
|
+
for (const p of pool) {
|
|
22922
|
+
if (!p || !p.el) continue;
|
|
22923
|
+
if (String(p.el.__weUrl || "") === u) {
|
|
22924
|
+
if (Number(p.el.readyState) >= 2) return p.el; // ①
|
|
22925
|
+
if (!sameMeta) sameMeta = p.el; // ②
|
|
22926
|
+
}
|
|
22927
|
+
}
|
|
22928
|
+
if (sameMeta) return sameMeta;
|
|
22929
|
+
// ③:空元素(从未装过 URL),且不在屏上。
|
|
22930
|
+
// 选中即**登记 URL 占位**:否则连着为两张不同壁纸申请时会两次都返回同一个空元素
|
|
22931
|
+
// (两次申请之间没有 arm 的话,第二个元素永远"看起来还是空的")—— 那会让第一张的
|
|
22932
|
+
// 预热白做,也让 H11「同一玩家实例不被替换」失效。arm 会把它真正装上(`__weUrl`
|
|
22933
|
+
// 赋值 + `src` + `load()`),这里的登记只是"这一格有主了"。
|
|
22934
|
+
for (const p of pool) {
|
|
22935
|
+
if (p && p.el && p.el !== visible && !String(p.el.__weUrl || "")) {
|
|
22936
|
+
try { p.el.__weUrl = u; } catch { /* ignore */ }
|
|
22937
|
+
return p.el;
|
|
22938
|
+
}
|
|
22939
|
+
}
|
|
22940
|
+
// ④:装着别的 URL、不在屏上的
|
|
22941
|
+
for (const p of pool) {
|
|
22942
|
+
if (p && p.el && p.el !== visible) {
|
|
22943
|
+
try { p.el.__weUrl = u; } catch { /* ignore */ }
|
|
22944
|
+
return p.el;
|
|
22945
|
+
}
|
|
22946
|
+
}
|
|
22947
|
+
// ⑤:兜底(不该走到)
|
|
22948
|
+
return pool.length ? pool[0].el : null;
|
|
22949
|
+
}
|
|
22950
|
+
|
|
22951
|
+
/**
|
|
22952
|
+
* 把一个池元素装到指定 URL 上,并把它推到"首帧已解"。
|
|
22953
|
+
*
|
|
22954
|
+
* ⚠️ 三条不变量在这里落地:
|
|
22955
|
+
* · 同 URL 已加载 ⇒ **不重设 src、不 load()**(不变量 ②);
|
|
22956
|
+
* · 换 src 只发生在不在屏上的元素上(不变量 ①)—— 在屏的那个由调用方在
|
|
22957
|
+
* `weSwitchPublish()` 之后才被换下来;
|
|
22958
|
+
* · 装车即播(muted):只有播起来 `requestVideoFrameCallback` 才会报首帧,
|
|
22959
|
+
* 隐藏态静音播放不产生声音,池容量 2 保证解码器数量与既有交叉淡化时相同。
|
|
22960
|
+
*/
|
|
22961
|
+
function weSwitchArm(el, url, posterUrl) {
|
|
22962
|
+
if (!el) return null;
|
|
22963
|
+
const u = String(url || "");
|
|
22964
|
+
if (!u) return el;
|
|
22965
|
+
// poster 幂等:同值不重设(重设会重新拉一次缩略图)。
|
|
22966
|
+
if (posterUrl && String(el.poster || "") !== String(posterUrl)) {
|
|
22967
|
+
try { el.poster = posterUrl; } catch { /* ignore */ }
|
|
22968
|
+
}
|
|
22969
|
+
// 这条地址**已经装在这个元素上**了吗?两种来源都算"已装":
|
|
22970
|
+
// · 池自己装的(`__weUrl`);
|
|
22971
|
+
// · 调用方刚赋过 `media.src`(`el.src`)—— `buildVideoMedia` 走的就是这条路。
|
|
22972
|
+
// 已装 ⇒ **绝不重复赋 src / load()**(需求 A5:同值重启资源选择等于白跑一次取数)。
|
|
22973
|
+
const same = String(el.__weUrl || "") === u || String(el.src || "") === u;
|
|
22974
|
+
if (!same) {
|
|
22975
|
+
// 不变量 ①:换源只允许发生在**不在屏上**的元素上(在屏换源 = 清掉当前帧 = 纯色帧)。
|
|
22976
|
+
if (weSwitchIsVisible(el)) return el;
|
|
22977
|
+
try {
|
|
22978
|
+
el.__weUrl = u;
|
|
22979
|
+
el.__weReady = false;
|
|
22980
|
+
el.src = u;
|
|
22981
|
+
} catch { return el; }
|
|
22982
|
+
try { if (typeof el.load === "function") el.load(); } catch { /* ignore */ }
|
|
22983
|
+
}
|
|
22984
|
+
try { el.__weUrl = u; } catch { /* ignore */ }
|
|
22985
|
+
// 首帧预热:已可播就直接标记;否则只为**还没排过**的元素排监听(`weSwitchArmFirstFrame`
|
|
22986
|
+
// 内部按 readyState 判,重复调用是幂等的 —— 它不会堆监听)。
|
|
22987
|
+
if (Number(el.readyState) >= 2) { try { el.__weReady = true; } catch { /* ignore */ } }
|
|
22988
|
+
else weSwitchArmFirstFrame(el);
|
|
22989
|
+
try { el.preload = "auto"; } catch { /* ignore */ }
|
|
22990
|
+
try { el.muted = true; } catch { /* ignore */ }
|
|
22991
|
+
// 隐藏态先播起来:首帧解码要发生,就必须有播放推进(rVFC 只在出帧时回调)。
|
|
22992
|
+
try {
|
|
22993
|
+
const p = el.play();
|
|
22994
|
+
if (p && typeof p.catch === "function") p.catch(() => { /* 可见后 syncLayers 会补 play */ });
|
|
22995
|
+
} catch { /* ignore */ }
|
|
22996
|
+
return el;
|
|
22997
|
+
}
|
|
22998
|
+
|
|
22999
|
+
/** 等"首帧真的解出来了":rVFC 优先;退化到 loadeddata/canplay(readyState ≥ 2)。 */
|
|
23000
|
+
function weSwitchArmFirstFrame(el) {
|
|
23001
|
+
if (!el) return;
|
|
23002
|
+
if (Number(el.readyState) >= 2) { try { el.__weReady = true; } catch { /* ignore */ } return; }
|
|
23003
|
+
// 幂等:同一个元素只排一次首帧监听。`syncLayers` 每次 emit 都会重新走建层/同步,
|
|
23004
|
+
// 不设这道闸就会越挂越多监听(每个都指向同一个回调,白白放大一次切换的开销)。
|
|
23005
|
+
if (el.__weArming) return;
|
|
23006
|
+
try { el.__weArming = true; } catch { /* ignore */ }
|
|
23007
|
+
const done = (extra) => {
|
|
23008
|
+
try { el.__weReady = true; el.__weArming = false; } catch { /* ignore */ }
|
|
23009
|
+
if (typeof extra === "function") extra();
|
|
23010
|
+
weSwitchOnFirstFrame(el);
|
|
23011
|
+
};
|
|
23012
|
+
if (typeof el.requestVideoFrameCallback === "function") {
|
|
23013
|
+
try {
|
|
23014
|
+
el.__weRaf = el.requestVideoFrameCallback(() => {
|
|
23015
|
+
try { el.__weRaf = 0; } catch { /* ignore */ }
|
|
23016
|
+
done();
|
|
23017
|
+
});
|
|
23018
|
+
return;
|
|
23019
|
+
} catch { /* 退化到事件 */ }
|
|
23020
|
+
}
|
|
23021
|
+
if (typeof el.addEventListener === "function") {
|
|
23022
|
+
const onData = () => done();
|
|
23023
|
+
try { el.addEventListener("loadeddata", onData, { once: true }); } catch { /* ignore */ }
|
|
23024
|
+
try { el.addEventListener("canplay", onData, { once: true }); } catch { /* ignore */ }
|
|
23025
|
+
return;
|
|
23026
|
+
}
|
|
23027
|
+
// 既无 rVFC 也无事件设施(精简 DOM / 挂载台):直接当"已有一帧",不拦切换。
|
|
23028
|
+
done();
|
|
23029
|
+
}
|
|
23030
|
+
|
|
23031
|
+
/**
|
|
23032
|
+
* 首帧到了:如果它就是本次切换等待的那个元素,推进状态机。
|
|
23033
|
+
* Edge 兼容那条腿(镜像画布)另有画布首笔的判据,不在这里。
|
|
23034
|
+
*/
|
|
23035
|
+
function weSwitchOnFirstFrame(el) {
|
|
23036
|
+
const ctx = weSwitchCtx;
|
|
23037
|
+
if (!ctx) return;
|
|
23038
|
+
if (ctx.pendingEl && ctx.pendingEl === el) {
|
|
23039
|
+
weSwitchSetState(ctx, "swapping");
|
|
23040
|
+
}
|
|
23041
|
+
}
|
|
23042
|
+
|
|
23043
|
+
function weSwitchSetState(ctx, next) {
|
|
23044
|
+
if (!ctx) return ctx;
|
|
23045
|
+
ctx.state = next;
|
|
23046
|
+
return ctx;
|
|
23047
|
+
}
|
|
23048
|
+
|
|
23049
|
+
/**
|
|
23050
|
+
* **用户点击驱动**的切换才池化。
|
|
23051
|
+
*
|
|
23052
|
+
* 为什么只认点击:轮换(`beginRotationPrepare` → `commitRotationSwitch`)、启动恢复、
|
|
23053
|
+
* revalidate 这三条路径各有**自己的就绪判据与 smoke 判据**
|
|
23054
|
+
*(`rotation-live-smoke` / `rotation-prepared-leak-smoke` / `rotation-smoke`),
|
|
23055
|
+
* 它们的既有契约是"视频档每层新建一个 `<video>`、且**不预热**"—— 那条契约当初是为了
|
|
23056
|
+
* 避开双解码与「GIF→静图→正片」的观感,不是疏漏。用户这次报的"点已缓存壁纸卡一下"
|
|
23057
|
+
* 走的是**点击**这条路,所以池化只接这条路:既修好报告的场景,又不改轮换的判据与观感。
|
|
23058
|
+
*
|
|
23059
|
+
* 返回 null = 这一趟不池化,调用方走它原来的建元素路径。
|
|
23060
|
+
*/
|
|
23061
|
+
function weSwitchClickPlayer(url) {
|
|
23062
|
+
const ctx = weSwitchCtx;
|
|
23063
|
+
if (!ctx || ctx.settled) return null; // 没有点击上下文 ⇒ 轮换/恢复 ⇒ 不池化
|
|
23064
|
+
return weSwitchPoolPick(url);
|
|
23065
|
+
}
|
|
23066
|
+
|
|
23067
|
+
/**
|
|
23068
|
+
* 非点击路径(轮换/恢复/revalidate)用的**一次性**播放器。
|
|
23069
|
+
*
|
|
23070
|
+
* 存在的唯一理由是"创生点只有一处":`document.createElement("video")` 住在池里,
|
|
23071
|
+
* 别处不许再造 —— 否则"谁建了解码器"又散开了,成因 ① 的构造点会悄悄长回来。
|
|
23072
|
+
* 它**不进池、不复用**,语义与建层前的旧实现逐字等价。
|
|
23073
|
+
*/
|
|
23074
|
+
function weSwitchDetachedPlayer() {
|
|
23075
|
+
const el = weSwitchNewPlayer(-1);
|
|
23076
|
+
if (el) { try { el.dataset.wePlayerId = "we-detached"; } catch { /* ignore */ } }
|
|
23077
|
+
return el;
|
|
23078
|
+
}
|
|
23079
|
+
// ── 切换度量 ──────────────────────────────────────────────────────────────────
|
|
23080
|
+
|
|
23081
|
+
function weSwitchNow() {
|
|
23082
|
+
try {
|
|
23083
|
+
if (typeof performance !== "undefined" && typeof performance.now === "function") return performance.now();
|
|
23084
|
+
} catch { /* ignore */ }
|
|
23085
|
+
return Date.now();
|
|
23086
|
+
}
|
|
23087
|
+
|
|
23088
|
+
/**
|
|
23089
|
+
* 记一条切换度量:console + 宿主环形缓冲。
|
|
23090
|
+
*
|
|
23091
|
+
* 字段口径(需求 D9 + I):
|
|
23092
|
+
* slug 这张壁纸的身份(用 URL 末段,排障要对得上)
|
|
23093
|
+
* cacheFamilyHit 是否走了缓存族命中(原画/1080p 任一已落地)—— **区分成因 ① 与 ② 的唯一字段**
|
|
23094
|
+
* is1080p 播放的是不是 1080p 变体
|
|
23095
|
+
* switchLatencyMs 点击 → 首帧可见
|
|
23096
|
+
* clickFeedbackMs 点击 → 第一处视觉变化
|
|
23097
|
+
*/
|
|
23098
|
+
function weSwitchRecord(entry) {
|
|
23099
|
+
const rec = Object.assign({ at: Date.now() }, entry || {});
|
|
23100
|
+
weSwitchStats.push(rec);
|
|
23101
|
+
while (weSwitchStats.length > WE_SWITCH_STATS_MAX) weSwitchStats.shift();
|
|
23102
|
+
try {
|
|
23103
|
+
console.log("[folia-switch] " + JSON.stringify(rec));
|
|
23104
|
+
} catch { /* 控制台不可用不影响切换 */ }
|
|
23105
|
+
try {
|
|
23106
|
+
// 宿主侧环形缓冲(`GET /folia/diag/switch-stats` 读回)。失败静默:度量是增强。
|
|
23107
|
+
const p = apiPostJson("/diag/switch-stats", rec);
|
|
23108
|
+
if (p && typeof p.catch === "function") p.catch(() => { /* ignore */ });
|
|
23109
|
+
} catch { /* ignore */ }
|
|
23110
|
+
return rec;
|
|
23111
|
+
}
|
|
23112
|
+
|
|
23113
|
+
/** 最近 20 条度量的只读快照(面板 / 守卫读它)。 */
|
|
23114
|
+
function weSwitchStatsSnapshot() {
|
|
23115
|
+
return weSwitchStats.map((r) => Object.assign({}, r));
|
|
23116
|
+
}
|
|
23117
|
+
|
|
23118
|
+
/** 均值 / 最大值(需求 I:clickFeedbackMs 均值 + 最大值)。 */
|
|
23119
|
+
function weSwitchStatSummary() {
|
|
23120
|
+
const agg = (key) => {
|
|
23121
|
+
const xs = weSwitchStats.map((r) => Number(r[key])).filter((n) => Number.isFinite(n) && n >= 0);
|
|
23122
|
+
if (!xs.length) return { n: 0, avg: 0, max: 0 };
|
|
23123
|
+
const sum = xs.reduce((a, b) => a + b, 0);
|
|
23124
|
+
return { n: xs.length, avg: Math.round(sum / xs.length), max: Math.round(Math.max.apply(null, xs)) };
|
|
23125
|
+
};
|
|
23126
|
+
return {
|
|
23127
|
+
switchLatencyMs: agg("switchLatencyMs"),
|
|
23128
|
+
clickFeedbackMs: agg("clickFeedbackMs"),
|
|
23129
|
+
total: weSwitchStats.length,
|
|
23130
|
+
};
|
|
23131
|
+
}
|
|
23132
|
+
|
|
23133
|
+
function weSwitchSlugOf(url) {
|
|
23134
|
+
const s = String(url || "");
|
|
23135
|
+
const at = Math.max(s.lastIndexOf("/"), s.lastIndexOf("\\"));
|
|
23136
|
+
return (at >= 0 ? s.slice(at + 1) : s).split("?")[0].slice(-48) || "-";
|
|
23137
|
+
}
|
|
23138
|
+
|
|
23139
|
+
/** 这条播放地址是不是 1080p 变体(站点变体 URL 通常带 `-1080p` 段)。 */
|
|
23140
|
+
function weSwitchIs1080p(url) {
|
|
23141
|
+
return /(?:^|[-_.])(?:1080p?|fhd)(?:[-_.]|$)/i.test(String(url || ""));
|
|
23142
|
+
}
|
|
23143
|
+
|
|
23144
|
+
// ── 点击反馈(需求 G1–G7:按下即响应,不等任何请求)─────────────────────────
|
|
23145
|
+
|
|
23146
|
+
/**
|
|
23147
|
+
* 点击瞬间的同步反馈。**必须在 `applySelection()` 之前**调用。
|
|
23148
|
+
*
|
|
23149
|
+
* 为什么必须同步:任何 `await` / 任何 fetch 都会把第一处视觉变化推到下一帧之后,
|
|
23150
|
+
* 用户就开始怀疑"点没点上"。这里只做三件纯 DOM 的事(无网络、无状态推断):
|
|
23151
|
+
* · 卡片加 `we-qp__item--pressed`(缩放/高亮由 CSS 给);
|
|
23152
|
+
* · 卡片置 `aria-busy="true"`(无障碍:读屏软件会播报"忙碌");
|
|
23153
|
+
* · 记 `clickFeedbackMs` = 到"第一处视觉变化"的耗时(同步 ⇒ 实测 < 1ms)。
|
|
23154
|
+
*/
|
|
23155
|
+
function weSwitchBegin(el) {
|
|
23156
|
+
const t0 = weSwitchNow();
|
|
23157
|
+
if (el && el.classList && typeof el.classList.add === "function") {
|
|
23158
|
+
try { el.classList.add("we-qp__item--pressed"); } catch { /* ignore */ }
|
|
23159
|
+
}
|
|
23160
|
+
if (el && typeof el.setAttribute === "function") {
|
|
23161
|
+
try { el.setAttribute("aria-busy", "true"); } catch { /* ignore */ }
|
|
23162
|
+
}
|
|
23163
|
+
const feedbackMs = Math.max(0, weSwitchNow() - t0);
|
|
23164
|
+
const ctx = {
|
|
23165
|
+
startedAt: t0, feedbackMs, state: "priming",
|
|
23166
|
+
cardEl: el || null, pendingEl: null, bufferTimer: 0, pressTimer: 0, hardTimer: 0,
|
|
23167
|
+
slug: "-", cacheFamilyHit: false, is1080p: false, settled: false,
|
|
23168
|
+
};
|
|
23169
|
+
weSwitchCtx = ctx;
|
|
23170
|
+
if (typeof setTimeout === "function") {
|
|
23171
|
+
// 视觉兜底:只摘 pressed / aria-busy,**不结算**(见 WE_SWITCH_PRESS_MS 的注释)。
|
|
23172
|
+
ctx.pressTimer = setTimeout(() => { weSwitchResetCard(ctx); }, WE_SWITCH_PRESS_MS);
|
|
23173
|
+
// 缓冲提示:1.5s 还没进到可播状态 ⇒ 转 buffering 并发事件(面板画「正在缓冲 x%」)。
|
|
23174
|
+
ctx.bufferTimer = setTimeout(() => {
|
|
23175
|
+
if (ctx.settled || weSwitchCtx !== ctx) return;
|
|
23176
|
+
if (ctx.state === "priming" || ctx.state === "preloading") {
|
|
23177
|
+
weSwitchSetState(ctx, "buffering");
|
|
23178
|
+
weSwitchListens(ctx);
|
|
23179
|
+
}
|
|
23180
|
+
}, WE_SWITCH_BUFFER_HINT_MS);
|
|
23181
|
+
// 硬上限:真正的"永远等不到"收口。
|
|
23182
|
+
ctx.hardTimer = setTimeout(() => {
|
|
23183
|
+
if (ctx.settled || weSwitchCtx !== ctx) return;
|
|
23184
|
+
weSwitchFail("timeout");
|
|
23185
|
+
}, WE_SWITCH_HARD_MS);
|
|
23186
|
+
}
|
|
23187
|
+
return ctx;
|
|
23188
|
+
}
|
|
23189
|
+
|
|
23190
|
+
/** 摘掉卡片的 pressed / aria-busy(视觉复位;幂等,结算与兜底都调它)。 */
|
|
23191
|
+
function weSwitchResetCard(ctx) {
|
|
23192
|
+
if (!ctx || !ctx.cardEl) return;
|
|
23193
|
+
try { if (ctx.cardEl.classList && ctx.cardEl.classList.remove) ctx.cardEl.classList.remove("we-qp__item--pressed"); } catch { /* ignore */ }
|
|
23194
|
+
try { if (ctx.cardEl.removeAttribute) ctx.cardEl.removeAttribute("aria-busy"); } catch { /* ignore */ }
|
|
23195
|
+
}
|
|
23196
|
+
|
|
23197
|
+
/**
|
|
23198
|
+
* 缓冲提示 / 成功 / 失败的对外通知口:只**发事件**,不直接改 React 树
|
|
23199
|
+
*(客户端是单向 emit 重渲染,本文件不碰组件结构)。面板订阅它来画
|
|
23200
|
+
* 「正在缓冲 x%」/「已切换」toast / 失败原因 + 重试。
|
|
23201
|
+
*/
|
|
23202
|
+
const weSwitchListeners = [];
|
|
23203
|
+
|
|
23204
|
+
function weSwitchSubscribe(fn) {
|
|
23205
|
+
if (typeof fn !== "function") return () => {};
|
|
23206
|
+
weSwitchListeners.push(fn);
|
|
23207
|
+
return () => {
|
|
23208
|
+
const i = weSwitchListeners.indexOf(fn);
|
|
23209
|
+
if (i >= 0) weSwitchListeners.splice(i, 1);
|
|
23210
|
+
};
|
|
23211
|
+
}
|
|
23212
|
+
|
|
23213
|
+
function weSwitchListens(ctx) {
|
|
23214
|
+
const ev = {
|
|
23215
|
+
state: ctx.state,
|
|
23216
|
+
slug: ctx.slug,
|
|
23217
|
+
percent: Number(ctx.percent) || 0,
|
|
23218
|
+
reason: ctx.reason || "",
|
|
23219
|
+
latencyMs: Number(ctx.latencyMs) || 0,
|
|
23220
|
+
feedbackMs: Number(ctx.feedbackMs) || 0,
|
|
23221
|
+
};
|
|
23222
|
+
for (const fn of weSwitchListeners.slice()) {
|
|
23223
|
+
try { fn(ev); } catch { /* 订阅者异常不许影响切换 */ }
|
|
23224
|
+
}
|
|
23225
|
+
}
|
|
23226
|
+
|
|
23227
|
+
/** 让调用方把"这次要播哪个元素/哪条地址"告诉状态机(`buildVideoMedia` 调)。 */
|
|
23228
|
+
function weSwitchAttachPlayer(el, url, opts) {
|
|
23229
|
+
const ctx = weSwitchCtx;
|
|
23230
|
+
const o = opts || {};
|
|
23231
|
+
if (!ctx) return null;
|
|
23232
|
+
ctx.pendingEl = el || null;
|
|
23233
|
+
ctx.slug = weSwitchSlugOf(url);
|
|
23234
|
+
ctx.is1080p = o.is1080p === true || weSwitchIs1080p(url);
|
|
23235
|
+
ctx.cacheFamilyHit = o.cacheFamilyHit === true;
|
|
23236
|
+
if (!ctx.settled) weSwitchSetState(ctx, "preloading");
|
|
23237
|
+
return ctx;
|
|
23238
|
+
}
|
|
23239
|
+
|
|
23240
|
+
/** 元素上屏(`syncLayers` 把它挂进新层之后调):推进到 swapping。 */
|
|
23241
|
+
function weSwitchPublish(el, opts) {
|
|
23242
|
+
const o = opts || {};
|
|
23243
|
+
const ctx = weSwitchCtx;
|
|
23244
|
+
if (el) {
|
|
23245
|
+
weSwitchVisibleEl = el;
|
|
23246
|
+
weSwitchStartJankProbe(el);
|
|
23247
|
+
}
|
|
23248
|
+
if (ctx && !ctx.settled) {
|
|
23249
|
+
weSwitchSetState(ctx, "swapping");
|
|
23250
|
+
if (o.fadeMs && typeof setTimeout === "function") {
|
|
23251
|
+
const at = ctx;
|
|
23252
|
+
setTimeout(() => { weSwitchFinish(at, true, ""); }, Math.max(0, Number(o.fadeMs) || WE_SWITCH_FADE_MS));
|
|
23253
|
+
return ctx;
|
|
23254
|
+
}
|
|
23255
|
+
}
|
|
23256
|
+
return ctx;
|
|
23257
|
+
}
|
|
23258
|
+
|
|
23259
|
+
/** 首帧可见 ⇒ 收尾(成功走这里;失败走 `weSwitchFail`)。 */
|
|
23260
|
+
function weSwitchPlayed(el) {
|
|
23261
|
+
const ctx = weSwitchCtx;
|
|
23262
|
+
if (!ctx || ctx.settled) return ctx;
|
|
23263
|
+
if (ctx.pendingEl && el && ctx.pendingEl !== el) return ctx;
|
|
23264
|
+
weSwitchSetState(ctx, "playing");
|
|
23265
|
+
weSwitchFinish(ctx, true, "");
|
|
23266
|
+
return ctx;
|
|
23267
|
+
}
|
|
23268
|
+
|
|
23269
|
+
function weSwitchFail(reason) {
|
|
23270
|
+
const ctx = weSwitchCtx;
|
|
23271
|
+
if (!ctx) return null;
|
|
23272
|
+
weSwitchSetState(ctx, "failed");
|
|
23273
|
+
ctx.reason = String(reason || "unknown");
|
|
23274
|
+
weSwitchFinish(ctx, false, ctx.reason);
|
|
23275
|
+
return ctx;
|
|
23276
|
+
}
|
|
23277
|
+
|
|
23278
|
+
/**
|
|
23279
|
+
* 收尾:清计时器、复位卡片、算 switchLatencyMs、记一条度量。
|
|
23280
|
+
* 幂等(连点/超时/失败都可能走到这里)。
|
|
23281
|
+
*/
|
|
23282
|
+
function weSwitchFinish(ctx, ok, reason) {
|
|
23283
|
+
if (!ctx || ctx.settled) return;
|
|
23284
|
+
ctx.settled = true;
|
|
23285
|
+
ctx.latencyMs = Math.max(0, weSwitchNow() - ctx.startedAt);
|
|
23286
|
+
if (typeof clearTimeout === "function") {
|
|
23287
|
+
if (ctx.pressTimer) { try { clearTimeout(ctx.pressTimer); } catch { /* ignore */ } }
|
|
23288
|
+
if (ctx.bufferTimer) { try { clearTimeout(ctx.bufferTimer); } catch { /* ignore */ } }
|
|
23289
|
+
if (ctx.hardTimer) { try { clearTimeout(ctx.hardTimer); } catch { /* ignore */ } }
|
|
23290
|
+
}
|
|
23291
|
+
ctx.pressTimer = 0;
|
|
23292
|
+
ctx.bufferTimer = 0;
|
|
23293
|
+
ctx.hardTimer = 0;
|
|
23294
|
+
weSwitchSetState(ctx, ok ? "playing" : "failed");
|
|
23295
|
+
// 卡片复位:pressed 摘掉、aria-busy 放下(需求 H14 / G4)。
|
|
23296
|
+
weSwitchResetCard(ctx);
|
|
23297
|
+
weSwitchRecord({
|
|
23298
|
+
slug: ctx.slug,
|
|
23299
|
+
cacheFamilyHit: ctx.cacheFamilyHit === true,
|
|
23300
|
+
is1080p: ctx.is1080p === true,
|
|
23301
|
+
switchLatencyMs: Math.round(ctx.latencyMs),
|
|
23302
|
+
clickFeedbackMs: Math.round(ctx.feedbackMs || 0),
|
|
23303
|
+
ok: ok === true,
|
|
23304
|
+
reason: ok ? "" : String(reason || ctx.reason || ""),
|
|
23305
|
+
});
|
|
23306
|
+
weSwitchListens(ctx);
|
|
23307
|
+
if (weSwitchCtx === ctx) weSwitchCtx = null;
|
|
23308
|
+
// 连点防护:上一轮结束了,补切"最后点的那个"(需求 G7)。放在清空上下文之后 ——
|
|
23309
|
+
// 补切会开启新的一轮,必须在 `weSwitchCtx` 已为空时进行,否则新上下文会被这里覆盖。
|
|
23310
|
+
weSwitchFlushPick();
|
|
23311
|
+
}
|
|
23312
|
+
|
|
23313
|
+
// ── 掉帧探测(需求 D10:< 24fps 持续 2s ⇒ 建议切 1080p)──────────────────────
|
|
23314
|
+
|
|
23315
|
+
function weSwitchStartJankProbe(el) {
|
|
23316
|
+
if (!el || typeof el.requestVideoFrameCallback !== "function") return;
|
|
23317
|
+
weSwitchJankSeen = { fps: 0, since: 0, frames: 0, at: weSwitchNow() };
|
|
23318
|
+
const tick = () => {
|
|
23319
|
+
if (!el || el !== weSwitchVisibleEl) return; // 换人了就停
|
|
23320
|
+
const now = weSwitchNow();
|
|
23321
|
+
const stat = weSwitchJankSeen;
|
|
23322
|
+
stat.frames += 1;
|
|
23323
|
+
const dt = now - stat.at;
|
|
23324
|
+
if (dt >= 1000) {
|
|
23325
|
+
const fps = Math.round((stat.frames * 1000) / dt);
|
|
23326
|
+
stat.frames = 0;
|
|
23327
|
+
stat.at = now;
|
|
23328
|
+
stat.fps = fps;
|
|
23329
|
+
if (fps > 0 && fps < WE_SWITCH_JANK_FPS) {
|
|
23330
|
+
if (!stat.since) stat.since = now;
|
|
23331
|
+
else if (now - stat.since >= WE_SWITCH_JANK_HOLD_MS) {
|
|
23332
|
+
weSwitchJank = { fps, at: Date.now() };
|
|
23333
|
+
}
|
|
23334
|
+
} else {
|
|
23335
|
+
stat.since = 0;
|
|
23336
|
+
weSwitchJank = null;
|
|
23337
|
+
}
|
|
23338
|
+
}
|
|
23339
|
+
try { el.requestVideoFrameCallback(tick); } catch { /* ignore */ }
|
|
23340
|
+
};
|
|
23341
|
+
try { el.requestVideoFrameCallback(tick); } catch { /* ignore */ }
|
|
23342
|
+
}
|
|
23343
|
+
|
|
23344
|
+
/** 掉帧结论(空 = 正常)。面板据此出「建议切换 1080p」+ 按钮。 */
|
|
23345
|
+
function weSwitchJankState() {
|
|
23346
|
+
return weSwitchJank ? Object.assign({}, weSwitchJank) : null;
|
|
23347
|
+
}
|
|
23348
|
+
|
|
23349
|
+
/** 当前状态机状态(测试与面板读它)。 */
|
|
23350
|
+
function weSwitchState() {
|
|
23351
|
+
return weSwitchCtx ? weSwitchCtx.state : "idle";
|
|
23352
|
+
}
|
|
23353
|
+
|
|
23354
|
+
/** 切换进行中吗(连点防护与缓冲提示共用这一条判据)。 */
|
|
23355
|
+
function weSwitchBusy() {
|
|
23356
|
+
return Boolean(weSwitchCtx) && !weSwitchCtx.settled;
|
|
23357
|
+
}
|
|
23358
|
+
|
|
23359
|
+
/*
|
|
23360
|
+
* 连点防护(需求 G7 / H13):切换进行中再点别的卡 **只保留最后一个**。
|
|
23361
|
+
*
|
|
23362
|
+
* 为什么是"保留最后一个"而不是"全部忽略":用户的意图很明确 —— 他最后点的就是
|
|
23363
|
+
* 他想看的。全部忽略等于让最后那一下白点(还得再点一次);而全部排队会让连点 3 下
|
|
23364
|
+
* 变成 3 次切换、连闪 3 下。**队列化最后一个**同时满足"不闪"与"最终落在用户想要的那张"。
|
|
23365
|
+
*
|
|
23366
|
+
* 规则对外可断言:连点 3 次 ⇒ 只多切 1 张(最后那张),且出现一句 toast
|
|
23367
|
+
*「正在切换,请稍候」(由调用方在 `weSwitchQueuePick` 返回 true 时发)。
|
|
23368
|
+
*/
|
|
23369
|
+
let weSwitchPending = null; // { id, fn }
|
|
23370
|
+
|
|
23371
|
+
function weSwitchQueuePick(id, fn) {
|
|
23372
|
+
if (!weSwitchBusy()) return false;
|
|
23373
|
+
weSwitchPending = { id: String(id == null ? "" : id), fn: typeof fn === "function" ? fn : null };
|
|
23374
|
+
return true;
|
|
23375
|
+
}
|
|
23376
|
+
|
|
23377
|
+
/** 上一轮收尾后补切"最后点的那个"(`weSwitchFinish` 末尾调用)。 */
|
|
23378
|
+
function weSwitchFlushPick() {
|
|
23379
|
+
const p = weSwitchPending;
|
|
23380
|
+
weSwitchPending = null;
|
|
23381
|
+
if (!p) return null;
|
|
23382
|
+
if (p.fn) { try { p.fn(); } catch { /* 调用方自己的异常不许影响下一轮 */ } }
|
|
23383
|
+
return p.id;
|
|
23384
|
+
}
|
|
23385
|
+
|
|
22544
23386
|
// ── 内联模块:src/media-prep.js —— 选中项落地:预准备(预挂载 + 探测 + 超时记账)→ buildMedia → applySelection(构建期注入;勿手改本段)──
|
|
22545
23387
|
/**
|
|
22546
23388
|
* media-prep.js — **选中的壁纸 → 屏幕上的媒体**:预准备(预挂载 + 探测 + 超时记账)、
|
|
@@ -25852,6 +26694,10 @@ window.__ModuleLoader__.load({
|
|
|
25852
26694
|
disposeOutgoingLayer(node, outgoing, switchTr, startFade);
|
|
25853
26695
|
const canvas = node.querySelector("canvas.we-media--canvas");
|
|
25854
26696
|
const video = node.querySelector("video");
|
|
26697
|
+
// 切换手感(4.23.8):把"这一层真的上屏了"告诉切换状态机 —— 它据此
|
|
26698
|
+
// ① 记下**在屏的那个池元素**(之后换源一律避开它,不变量 ①:在屏换源 = 纯色帧),
|
|
26699
|
+
// ② 排掉帧探测(<24fps 持续 2s ⇒ 提示建议切 1080p)。
|
|
26700
|
+
if (video) { try { weSwitchPublish(video, {}); } catch { /* 度量是增强,绝不影响建层 */ } }
|
|
25855
26701
|
// 画布兜底色(见本文件上方的 refreshUnderlayColor / scheduleUnderlaySample):
|
|
25856
26702
|
// 幂等,同一次挂载只排一次取样;换壁纸即作废上一张的结果。
|
|
25857
26703
|
refreshUnderlayColor();
|
|
@@ -25902,6 +26748,12 @@ window.__ModuleLoader__.load({
|
|
|
25902
26748
|
// 播放态收敛(#84):意图 → 元素真实状态,失败时回写 store 让「播放」
|
|
25903
26749
|
// 按钮回来(见 applyVideoPlayback)。
|
|
25904
26750
|
applyVideoPlayback(video);
|
|
26751
|
+
// 切换手感(4.23.8):首帧真的在手上(HAVE_CURRENT_DATA 及以上)⇒ 本次切换收口,
|
|
26752
|
+
// 记一条 switchLatencyMs(点击 → 首帧可见)。`< 2` 时不做任何事:内容闸门会等到
|
|
26753
|
+
// 有画面前不放行新层,旧壁纸继续留屏,滞后由计时器那条腿兜底。
|
|
26754
|
+
if (Number(video.readyState) >= 2) {
|
|
26755
|
+
try { weSwitchPlayed(video); } catch { /* 度量是增强 */ }
|
|
26756
|
+
}
|
|
25905
26757
|
// Keep the rate in sync on every layer sync (covers rate changes while
|
|
25906
26758
|
// the same wallpaper keeps playing — instant, no media reload).
|
|
25907
26759
|
try { if (video.playbackRate !== selection.playbackRate) video.playbackRate = selection.playbackRate; } catch { /* ignore */ }
|
|
@@ -29251,6 +30103,13 @@ window.__ModuleLoader__.load({
|
|
|
29251
30103
|
// path 原样回传问下一级,客户端**不做任何路径拼接**(分隔符/盘符大小写都是宿主的口径);
|
|
29252
30104
|
// display 是地址栏草稿(可手输,Enter 跳转),选中即把它填进 cacheDirDraft 走既有保存链。
|
|
29253
30105
|
cacheDirBrowse: null,
|
|
30106
|
+
// 「缓存管理」(4.23.7,transient):最近一次 `GET /folia/cache/usage` 的载荷(只读统计)、
|
|
30107
|
+
// 在途标记(""|"usage"|"clear")、以及一次清理的结果/错误各一句。
|
|
30108
|
+
// **不落盘**:用量是随时会变的读数,重启后重新统计即可(落盘只会让人看到过期数字)。
|
|
30109
|
+
cacheUsage: null,
|
|
30110
|
+
cacheBusy: "",
|
|
30111
|
+
cacheNote: "",
|
|
30112
|
+
cacheError: "",
|
|
29254
30113
|
// WE 官方资源路径编辑器(transient):开态 + 草稿路径 + 上次错误。
|
|
29255
30114
|
// 生效状态(目录/可用性)由 inventory 携带(host 是唯一真相)。
|
|
29256
30115
|
editingWeAssetsDir: false,
|
|
@@ -30411,6 +31270,100 @@ window.__ModuleLoader__.load({
|
|
|
30411
31270
|
emit();
|
|
30412
31271
|
}
|
|
30413
31272
|
|
|
31273
|
+
/* ── 「缓存管理」(4.23.7):五层用量 + 分目标清理 ────────────────────────────────
|
|
31274
|
+
* 宿主侧是 `lib/routes/cache.js`(GET /cache/usage / POST /cache/clear)。客户端**只**做两件事:
|
|
31275
|
+
* 把用量画出来、把用户点的**目标名**发过去。路径一个字节都不从这里走 —— 安全边界在宿主
|
|
31276
|
+
* (白名单 + 允许根 + 拒绝符号链接),这里传的是 `"library"` 这种名字。
|
|
31277
|
+
*
|
|
31278
|
+
* `skins`(已装皮肤)清了等于把皮肤中心的皮肤**全部卸载** ⇒ 两段式:先 armConfirm("cache:skins")
|
|
31279
|
+
* 上膛,面板画出「确认 / 取消」;确认那一步才真的发请求。`electron` 被占用是常态 ⇒
|
|
31280
|
+
* 部分失败也要把"释放了多少 + 有几个被占用"如实说出来,并提示重启。
|
|
31281
|
+
*/
|
|
31282
|
+
const CACHE_USAGE_URL = "/folia/cache/usage";
|
|
31283
|
+
const CACHE_CLEAR_URL = "/folia/cache/clear";
|
|
31284
|
+
|
|
31285
|
+
/** 字节 → 人类可读(面板行与 toast 共用一份口径;0 ⇒ `0 B`)。 */
|
|
31286
|
+
function fmtCacheBytes(n) {
|
|
31287
|
+
const v = Math.max(0, Number(n) || 0);
|
|
31288
|
+
if (v < 1024) return v + " B";
|
|
31289
|
+
const units = ["KB", "MB", "GB", "TB"];
|
|
31290
|
+
let x = v / 1024;
|
|
31291
|
+
let i = 0;
|
|
31292
|
+
while (x >= 1024 && i < units.length - 1) { x /= 1024; i += 1; }
|
|
31293
|
+
return (x >= 10 ? x.toFixed(1) : x.toFixed(2)) + " " + units[i];
|
|
31294
|
+
}
|
|
31295
|
+
|
|
31296
|
+
/** 清理目标 → 中文名(按钮 / toast 共用;顺序与宿主白名单一致,别在这里发明第六个目标)。 */
|
|
31297
|
+
function cacheTargetLabel(t) {
|
|
31298
|
+
if (t === "library") return weT("媒体库");
|
|
31299
|
+
if (t === "site-media") return weT("站点媒体");
|
|
31300
|
+
if (t === "skins-zip") return weT("皮肤包");
|
|
31301
|
+
if (t === "skins") return weT("已装皮肤");
|
|
31302
|
+
if (t === "electron") return weT("Electron 缓存");
|
|
31303
|
+
return String(t || "");
|
|
31304
|
+
}
|
|
31305
|
+
|
|
31306
|
+
/** 拉一次用量(只读:宿主不建目录、不改盘,所以进页签拉一次是安全的)。 */
|
|
31307
|
+
async function loadCacheUsage() {
|
|
31308
|
+
setTransient("cacheBusy", "usage");
|
|
31309
|
+
try {
|
|
31310
|
+
const res = await apiJson(CACHE_USAGE_URL);
|
|
31311
|
+
const doc = (res && res.data) || res || null;
|
|
31312
|
+
if (doc && Array.isArray(doc.items)) {
|
|
31313
|
+
setTransient("cacheUsage", doc);
|
|
31314
|
+
setTransient("cacheError", "");
|
|
31315
|
+
}
|
|
31316
|
+
} catch (err) {
|
|
31317
|
+
setTransient("cacheError", weT("读取缓存用量失败:{error}", {
|
|
31318
|
+
error: String((err && err.message) || err || ""),
|
|
31319
|
+
}));
|
|
31320
|
+
}
|
|
31321
|
+
setTransient("cacheBusy", "");
|
|
31322
|
+
emit();
|
|
31323
|
+
}
|
|
31324
|
+
|
|
31325
|
+
/**
|
|
31326
|
+
* 清理若干目标。**只有目标名**会离开客户端(见上面那段安全边界)。
|
|
31327
|
+
* 结果一律落成一句人话:释放了多少、几个文件、有没有被占用的(占用 ⇒ 提示重启)。
|
|
31328
|
+
*/
|
|
31329
|
+
async function clearCacheTargets(targets) {
|
|
31330
|
+
const list = (Array.isArray(targets) ? targets : []).filter((t) => typeof t === "string" && t);
|
|
31331
|
+
if (!list.length) return;
|
|
31332
|
+
const label = list.map(cacheTargetLabel).join(" + ");
|
|
31333
|
+
setTransient("cacheBusy", "clear");
|
|
31334
|
+
setTransient("cacheError", "");
|
|
31335
|
+
setTransient("cacheNote", "");
|
|
31336
|
+
emit();
|
|
31337
|
+
try {
|
|
31338
|
+
const res = await apiPostJson(CACHE_CLEAR_URL, { targets: list }, { parse: "always" });
|
|
31339
|
+
if (!res.ok) throw new Error(hostFailureReason(res));
|
|
31340
|
+
const d = (res && res.data) || {};
|
|
31341
|
+
const bytes = Number((d.released && d.released.bytes) || 0);
|
|
31342
|
+
const files = Number((d.released && d.released.files) || 0);
|
|
31343
|
+
const failed = Array.isArray(d.failed) ? d.failed.length : 0;
|
|
31344
|
+
const size = fmtCacheBytes(bytes);
|
|
31345
|
+
setTransient("cacheNote", failed
|
|
31346
|
+
? weT("已清理 {name}:释放 {size}({n} 个文件);{failed} 个文件被占用,重启 DSH 后彻底生效", {
|
|
31347
|
+
name: label, size, n: files, failed,
|
|
31348
|
+
})
|
|
31349
|
+
: weT("已清理 {name}:释放 {size}({n} 个文件)", { name: label, size, n: files }));
|
|
31350
|
+
await loadCacheUsage();
|
|
31351
|
+
} catch (err) {
|
|
31352
|
+
setTransient("cacheError", weT("清理失败:{error}", {
|
|
31353
|
+
error: String((err && err.message) || err || ""),
|
|
31354
|
+
}));
|
|
31355
|
+
}
|
|
31356
|
+
setTransient("cacheBusy", "");
|
|
31357
|
+
emit();
|
|
31358
|
+
}
|
|
31359
|
+
|
|
31360
|
+
/** 「清空已装皮肤」:两段式(第一下只上膛,第二下才发请求)。 */
|
|
31361
|
+
function onCacheClearSkins() {
|
|
31362
|
+
if (armedIdOf("cache") !== "skins") { armConfirm("cache:skins"); return; }
|
|
31363
|
+
disarmConfirm();
|
|
31364
|
+
clearCacheTargets(["skins"]);
|
|
31365
|
+
}
|
|
31366
|
+
|
|
30414
31367
|
const WE_ASSETS_DIR_URL = "/folia/we-assets-dir";
|
|
30415
31368
|
|
|
30416
31369
|
// Set / clear the WE official-assets directory (host-persisted). Scene live
|
|
@@ -33187,6 +34140,10 @@ window.__ModuleLoader__.load({
|
|
|
33187
34140
|
// 停在「关于」页刷新页面这条路径不走 switchTab(activeTab 直接从 localStorage 读出来),
|
|
33188
34141
|
// 用一次订阅式 effect 补上;TTL 同日历口径,重复触发是空操作。
|
|
33189
34142
|
React.useEffect(() => { if (activeTab === "about") loadStarCount(false); }, [activeTab]);
|
|
34143
|
+
// 4.23.7「缓存管理」:进「系统」页签时拉一次用量(宿主那条路由**只读**,不建目录不改盘)。
|
|
34144
|
+
// 只在切到这个页签时拉 —— 不跟着轮询走,免得为一份"几分钟都不变"的读数每分钟多发请求;
|
|
34145
|
+
// 用户在面板里按「刷新」或清完一轮时会各自再拉一次(`loadCacheUsage` / `clearCacheTargets`)。
|
|
34146
|
+
React.useEffect(() => { if (activeTab === "system") loadCacheUsage(); }, [activeTab]);
|
|
33190
34147
|
|
|
33191
34148
|
// 页签安全(ADR-0013 D3①):可见页签表变了(组件行状态随 inventory 轮询回到本地)而当前
|
|
33192
34149
|
// 页签不在表里 ⇒ 回落到第一个可见页签,自愈、不用用户自己点走。表为空(今天不可能,空表
|
|
@@ -33447,6 +34404,9 @@ window.__ModuleLoader__.load({
|
|
|
33447
34404
|
onAdapterTarget, onEdgeCompatChange, onLayoutChange, onPauseOnBattery, onPauseOnBlur, onPauseOnHidden, onToggleLiveDiag, sel,
|
|
33448
34405
|
onStartEditCacheDir, onCancelEditCacheDir, onCacheDirDraft,
|
|
33449
34406
|
onCacheDirBrowseInput, onCacheDirBrowseGo, onCacheDirBrowseEnter, onCacheDirBrowseUp, onPickCacheDir, onCloseCacheDirBrowse,
|
|
34407
|
+
// 4.23.7「缓存管理」:用量 / 刷新 / 五目标清理(`skins` 走两段式确认,令牌 "cache:skins")。
|
|
34408
|
+
onClearCache: clearCacheTargets, onClearCacheSkins: onCacheClearSkins,
|
|
34409
|
+
onRefreshCacheUsage: loadCacheUsage, armedConfirm: sel.armedConfirm, onDisarmConfirm: disarmConfirm,
|
|
33450
34410
|
}),
|
|
33451
34411
|
);
|
|
33452
34412
|
return renderWallpaperTab({
|