dsh-folia 4.23.15 → 4.23.17
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 +486 -18
- package/lib/download-queue.js +127 -7
- package/lib/media/transcode.js +30 -17
- package/lib/media-selfheal.js +94 -13
- package/lib/media-verify.js +55 -1
- package/lib/routes/boot.js +9 -2
- package/lib/routes/downloads.js +49 -6
- package/lib/routes/inventory.js +5 -0
- package/lib/routes/pets.js +9 -2
- package/lib/routes/skins.js +13 -2
- package/lib/variant-pick.js +185 -3
- package/package.json +1 -1
package/lib/client.js
CHANGED
|
@@ -855,6 +855,13 @@ window.__ModuleLoader__.load({
|
|
|
855
855
|
"下载中… {p}% · 多连接({n})": "Downloading… {p}% · {n} connections",
|
|
856
856
|
"正在下载(皮肤包){p}%({a}/{b} MB)": "Downloading skin pack: {p}% ({a}/{b} MB)",
|
|
857
857
|
|
|
858
|
+
// ── 壁纸缓存进度(4.23.17)────────────────────────────────────────────────
|
|
859
|
+
// 卡片:`缓存中 62%`(短,塞得进 92px 卡片底部);标题栏:`缓存中 62%(12.3/20.0 MB · 约剩 8 秒)`
|
|
860
|
+
// ——`{detail}` 由既有的 `dlProgressDetail` 给(同一张表,不在这里再造一种"已下/总量"写法)。
|
|
861
|
+
"缓存中 {p}%": "Caching {p}%",
|
|
862
|
+
"缓存中 {p}%({detail})": "Caching {p}% ({detail})",
|
|
863
|
+
|
|
864
|
+
|
|
858
865
|
// ── 四模块统一的卡片状态机(4.23.4)────────────────────────────────────
|
|
859
866
|
// 由 src/local-first.js 的 `dlCardState()`(纯函数,四个页签共用)产出;
|
|
860
867
|
// `idle` / `done` 两个词仍由各页签自己给(安装 / 下载 / 使用中 / 已安装)。
|
|
@@ -868,6 +875,11 @@ window.__ModuleLoader__.load({
|
|
|
868
875
|
// ① 超时之后**结果**(失败原因,卡片上的红字 +「重试」);
|
|
869
876
|
// ② 挂载自愈**过程**(自动补装/自动收尾 + 它们的结果)。
|
|
870
877
|
"下载已完成但安装未落地,点「重试」": "The download finished but the install never landed — press Retry",
|
|
878
|
+
// 4.23.17:本地文件被外部清理(连续两次 ENOENT)——不是站点/链路问题,重试会重新下。
|
|
879
|
+
"下载途中本地文件被清理掉了(连续两次),点「重试」会重新下载": "Local files were cleaned up during the download (twice in a row) — press Retry to download again",
|
|
880
|
+
// 4.23.17(P0-6):哈希来源错配(变体 URL 拿了原画哈希)——与"传输内容不一致"分开说。
|
|
881
|
+
"下载地址与校验哈希不是同一个文件(原画/变体的哈希搞混了),点「重试」会按正确的那一档重新下载":
|
|
882
|
+
"The download URL and its checksum point to different files (original vs 1080p variant got mixed up) — Retry downloads the correct one",
|
|
871
883
|
"下载已完成但没落地,正在自动补装:{name}": "The download finished but never landed — installing it now: {name}",
|
|
872
884
|
"下载已完成,已自动补装:{name} —— 点「应用」就能切换": "The download finished and was installed automatically: {name} — press Apply to switch to it",
|
|
873
885
|
"下载已完成,已自动补装:{name}": "The download finished and was installed automatically: {name}",
|
|
@@ -951,9 +963,9 @@ window.__ModuleLoader__.load({
|
|
|
951
963
|
// ── 4.23.15「本地副本自愈」(播放失败 → 验内容 → 重下 / 换档 / 转码)───────────────
|
|
952
964
|
// 这三句是**给用户看的结论**,不是日志:它们回答"我刚点的那张为什么没出来、现在在干什么"。
|
|
953
965
|
"文件已损坏,已重新下载": "The local file was corrupted — re-downloading it now",
|
|
954
|
-
"
|
|
955
|
-
"
|
|
956
|
-
"
|
|
966
|
+
"已切换到 1080p(原画超出本机解码上限)": "Switched to 1080p (the original exceeds this machine's decode limit)",
|
|
967
|
+
"已切换到 30fps 副本(原画 60fps 超出本机解码能力,分辨率不变)": "Switched to a 30fps copy (the 60fps original exceeds this machine's decode capability; resolution unchanged)",
|
|
968
|
+
"正在生成可播放副本…": "Preparing a playable copy…",
|
|
957
969
|
"本机不支持该编码(可换一张跳过此壁纸)": "This machine cannot decode that codec (pick another wallpaper to skip it)",
|
|
958
970
|
"该壁纸分辨率/编码超出本机解码能力(可换一张跳过此壁纸)": "This wallpaper's resolution/codec exceeds this machine's decoding capability (pick another one to skip it)",
|
|
959
971
|
"重新获取失败(可稍后再点一次这张)": "Re-fetch failed (click this wallpaper again in a moment)",
|
|
@@ -977,8 +989,8 @@ window.__ModuleLoader__.load({
|
|
|
977
989
|
// ── 4.23.15「转码进度 / 静态帧兜底」(用户最终目标:最终必须能上屏)───────────────
|
|
978
990
|
"正在生成本机可播放副本 {percent}%": "Preparing a playable copy on this machine… {percent}%",
|
|
979
991
|
"正在生成本机可播放副本 {percent}%(约剩 {eta} 秒)": "Preparing a playable copy on this machine… {percent}% (about {eta}s left)",
|
|
980
|
-
"
|
|
981
|
-
"
|
|
992
|
+
"已降级为静态壁纸(本机无法解码该视频)": "Fell back to a static wallpaper (this machine cannot decode the video)",
|
|
993
|
+
"无法显示这张壁纸(本机无法解码该视频,且没有可用的静态帧)": "Cannot display this wallpaper (this machine cannot decode the video and no static frame is available)",
|
|
982
994
|
};
|
|
983
995
|
|
|
984
996
|
// ── 内联模块:src/i18n-copy-picker.js —— 英文词表域:壁纸选择器与快捷面板(picker-* · quick-panel · sidebar-right · theme-follow)(构建期注入;勿手改本段)──
|
|
@@ -4877,6 +4889,55 @@ window.__ModuleLoader__.load({
|
|
|
4877
4889
|
.we-picker__card--hidden .we-picker__card-title {
|
|
4878
4890
|
background: linear-gradient(transparent, rgba(0, 0, 0, 0.78));
|
|
4879
4891
|
}
|
|
4892
|
+
/* ── 壁纸缓存进度(4.23.17)─────────────────────────────────────────────────
|
|
4893
|
+
卡片固定 92px(CD 架档是 aspect-ratio),标题条永久占底部 ~18px ⇒ 进度条压在
|
|
4894
|
+
标题条**上方**(bottom:20px),不给卡片加高(加高会改网格几何 / 虚拟滚动算式)。
|
|
4895
|
+
无内容时这些节点根本不渲染(组件返回 null),所以标记序列 golden 不受影响。 */
|
|
4896
|
+
.we-wp-progress {
|
|
4897
|
+
position: absolute; left: 6px; right: 6px; bottom: 20px; z-index: 2;
|
|
4898
|
+
pointer-events: none;
|
|
4899
|
+
}
|
|
4900
|
+
.we-wp-progress__label {
|
|
4901
|
+
display: block; margin-bottom: 2px;
|
|
4902
|
+
font-size: 0.62em; line-height: 1.4; color: #fff;
|
|
4903
|
+
text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
|
|
4904
|
+
}
|
|
4905
|
+
.we-wp-progress__rail {
|
|
4906
|
+
display: block; height: 3px; border-radius: 2px;
|
|
4907
|
+
background: rgba(255, 255, 255, 0.28); overflow: hidden;
|
|
4908
|
+
}
|
|
4909
|
+
.we-wp-progress__fill {
|
|
4910
|
+
display: block; height: 100%; border-radius: 2px;
|
|
4911
|
+
background: var(--we-accent, #4f8cff);
|
|
4912
|
+
transition: width 300ms var(--we-ease, ease);
|
|
4913
|
+
}
|
|
4914
|
+
.we-wp-queued, .we-wp-cached {
|
|
4915
|
+
position: absolute; left: 6px; bottom: 20px; z-index: 2;
|
|
4916
|
+
padding: 1px 6px; border-radius: 4px;
|
|
4917
|
+
font-size: 0.62em; line-height: 1.6; color: #fff;
|
|
4918
|
+
pointer-events: none;
|
|
4919
|
+
}
|
|
4920
|
+
.we-wp-cached { background: rgba(20, 120, 80, 0.85); }
|
|
4921
|
+
.we-wp-queued { background: rgba(0, 0, 0, 0.6); }
|
|
4922
|
+
.we-wp-failed {
|
|
4923
|
+
position: absolute; left: 4px; right: 4px; bottom: 20px; z-index: 2;
|
|
4924
|
+
display: flex; align-items: center; gap: 4px;
|
|
4925
|
+
}
|
|
4926
|
+
.we-wp-failed__why {
|
|
4927
|
+
flex: 1; min-width: 0;
|
|
4928
|
+
font-size: 0.6em; line-height: 1.3; color: #ffd7d7;
|
|
4929
|
+
text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
|
|
4930
|
+
overflow: hidden; display: -webkit-box;
|
|
4931
|
+
-webkit-line-clamp: 2; -webkit-box-orient: vertical;
|
|
4932
|
+
}
|
|
4933
|
+
.we-wp-failed__retry {
|
|
4934
|
+
flex: none; padding: 1px 6px; border: 0; border-radius: 4px; cursor: pointer;
|
|
4935
|
+
font-size: 0.62em; line-height: 1.6; color: #fff;
|
|
4936
|
+
background: rgba(190, 50, 50, 0.9);
|
|
4937
|
+
}
|
|
4938
|
+
/* 标题栏那一行(当前壁纸下方):进度/排队/失败共用;已缓存或无 job 时不渲染。 */
|
|
4939
|
+
.we-wp-title { display: flex; align-items: center; gap: 6px; }
|
|
4940
|
+
.we-wp-title__why { flex: 1; min-width: 0; }
|
|
4880
4941
|
/* Batch-action bar. */
|
|
4881
4942
|
.we-picker__batch-bar {
|
|
4882
4943
|
padding: 4px 6px; border-radius: 6px;
|
|
@@ -16952,6 +17013,10 @@ window.__ModuleLoader__.load({
|
|
|
16952
17013
|
"data-we-cards": sel.pickerLayout,
|
|
16953
17014
|
"aria-label": weT("选择壁纸"),
|
|
16954
17015
|
},
|
|
17016
|
+
// 4.23.17:队列 → 进度存储的桥。**只在这里挂一次**:库视图开着才有卡片要进度,
|
|
17017
|
+
// 关掉即卸载(`useDownloadJobs` 卸载即清定时器;没有活跃 job 时它自己也会停表)。
|
|
17018
|
+
// 返回 null ⇒ 不产生任何 DOM,模态框「标记等价」golden 逐字不变。
|
|
17019
|
+
React.createElement(WpJobsBridge, { key: "we-wp-jobs" }),
|
|
16955
17020
|
renderPickerModalHead(ctx),
|
|
16956
17021
|
!draft && renderPickerModalTabs(ctx, draft),
|
|
16957
17022
|
sel.modalView === "hidden" && !draft
|
|
@@ -17039,6 +17104,11 @@ window.__ModuleLoader__.load({
|
|
|
17039
17104
|
title: weT("隐藏此壁纸(可在「已隐藏」中恢复)"),
|
|
17040
17105
|
onClick: (e) => { e.stopPropagation(); hideWallpapers([w.id]); },
|
|
17041
17106
|
}, weT("隐藏")),
|
|
17107
|
+
// 4.23.17:**这一张的缓存进度**(未缓存且在下 ⇒ 底部小进度条 +「缓存中 62%」;
|
|
17108
|
+
// 已缓存 ⇒ 小角标「已缓存」,不显示百分比;失败 ⇒ 原因 +「重试」;都没有 ⇒ null)。
|
|
17109
|
+
// 单独一个组件:进度轮询只重渲染这一张卡,不带走整张列表(见 src/wallpaper-progress.js)。
|
|
17110
|
+
// 无内容时返回 null ⇒ 卡片标记序列不变(verify-client 的「标记等价」golden 逐字不变)。
|
|
17111
|
+
React.createElement(WpCardProgress, { key: "we-wp", item: w }),
|
|
17042
17112
|
);
|
|
17043
17113
|
}
|
|
17044
17114
|
|
|
@@ -20465,8 +20535,11 @@ window.__ModuleLoader__.load({
|
|
|
20465
20535
|
* 读宿主 `/folia/site-media-stats`(4.15.3 起存在):命中/未命中/平均吞吐/缓存是否可写。
|
|
20466
20536
|
* 三条纪律:拿不到就**什么都不显示**;每 15 秒最多取一次;任何异常都吞掉(不许影响面板)。
|
|
20467
20537
|
*/
|
|
20468
|
-
function QpCacheHint() {
|
|
20538
|
+
function QpCacheHint(props) {
|
|
20469
20539
|
const [info, setInfo] = React.useState(null);
|
|
20540
|
+
// 4.23.17:**当前这张壁纸的缓存进度**(`/downloads/list` 真源,经 src/wallpaper-progress.js)。
|
|
20541
|
+
// 钩子必须无条件调用(Rules of Hooks):下面只有"画不画"是分支。
|
|
20542
|
+
const wp = useWallpaperProgress(props && props.item);
|
|
20470
20543
|
React.useEffect(() => {
|
|
20471
20544
|
let alive = true;
|
|
20472
20545
|
let timer = null;
|
|
@@ -20486,6 +20559,10 @@ window.__ModuleLoader__.load({
|
|
|
20486
20559
|
if (timer !== null) { try { window.clearInterval(timer); } catch { /* ignore */ } }
|
|
20487
20560
|
};
|
|
20488
20561
|
}, []);
|
|
20562
|
+
// 正在缓存 / 排队 / 失败 ⇒ 这一行就是**进度**(「缓存中 62%(12.3/20 MB · 约剩 8 秒)」)。
|
|
20563
|
+
// 下完(cached)或没有 job ⇒ 返回 null,回落到原来那行"缓存命中 / 首次下载 / 平均速度"。
|
|
20564
|
+
const titleLine = wpTitleRender(wp, props && props.item);
|
|
20565
|
+
if (titleLine) return titleLine;
|
|
20489
20566
|
if (!info) return null;
|
|
20490
20567
|
const hits = Number(info.hits) || 0;
|
|
20491
20568
|
const misses = Number(info.misses) || 0;
|
|
@@ -20589,7 +20666,8 @@ window.__ModuleLoader__.load({
|
|
|
20589
20666
|
sel.videoError && React.createElement("div", { className: "we-picker__current-error" }, sel.videoError),
|
|
20590
20667
|
// 缓存与速度的**自述**(④):用户不用开 F12 也能知道"这次是首次下载还是命中缓存"。
|
|
20591
20668
|
// 数据来自宿主 `/folia/site-media-stats`;拿不到就**什么都不显示**(绝不因此报错)。
|
|
20592
|
-
|
|
20669
|
+
// 4.23.17:正在缓存时这一行换成「缓存中 62%(12.3/20 MB · 约剩 8 秒)」,下完回落原文案。
|
|
20670
|
+
React.createElement(QpCacheHint, { item: current }),
|
|
20593
20671
|
),
|
|
20594
20672
|
React.createElement("div", { className: "we-qp__current-actions" },
|
|
20595
20673
|
// ⚠️ **不变量:这一行只放日常操作**(暂停 / 播放 · 刷新 · 清除;场景与网页壁纸再加
|
|
@@ -21081,6 +21159,9 @@ window.__ModuleLoader__.load({
|
|
|
21081
21159
|
};
|
|
21082
21160
|
|
|
21083
21161
|
return React.createElement("div", { className: "we-qp we-qp--" + dock },
|
|
21162
|
+
// 4.23.17:队列 → 进度存储的桥(返回 null,不产生 DOM)。轮询复用 `useDownloadJobs()`,
|
|
21163
|
+
// 不新建第二套;没有活跃 job 时它自己停表。
|
|
21164
|
+
React.createElement(WpJobsBridge, { key: "we-wp-jobs" }),
|
|
21084
21165
|
qpRenderCurrent(sel, current, playbackLive),
|
|
21085
21166
|
qpRenderRotation(sel, groups, playable),
|
|
21086
21167
|
qpRenderTabs(qpTab, switchQpTab),
|
|
@@ -22148,10 +22229,17 @@ window.__ModuleLoader__.load({
|
|
|
22148
22229
|
screenHeight: lfScreenHeight(),
|
|
22149
22230
|
};
|
|
22150
22231
|
if (Array.isArray(it.variants) && it.variants.length) entry.variants = it.variants;
|
|
22151
|
-
// 4.23.
|
|
22152
|
-
//
|
|
22232
|
+
// 4.23.15:原画的宽/高/帧率也带上 —— 宿主选档要按**解码上限**判(4K@60 与 5916×2530
|
|
22233
|
+
// 都是"链路再快也解不出来"的那一类)。缺就不发,宿主按兜底口径判。
|
|
22234
|
+
if (Number(it.width) > 0) entry.width = Number(it.width);
|
|
22235
|
+
if (Number(it.height) > 0) entry.height = Number(it.height);
|
|
22236
|
+
if (Number(it.fps) > 0) entry.fps = Number(it.fps);
|
|
22237
|
+
// 4.23.17(P0-6):清单给的哈希**不是**"这一条要用的哈希",只是**清单事实**。
|
|
22238
|
+
// 真正决定校验用哪个哈希的是宿主那一处 `resolveMediaExpectation(item, chosen)`(选原画用原画
|
|
22239
|
+
// 的、选 1080p 用变体的)。所以字段名故意不叫 `sha256`:客户端不参与校验来源的决策,
|
|
22240
|
+
// 只把清单原样带过去(`variants[]` 里的 sha256 也一起带)。旧宿主也认 `sha256`,升级期不崩。
|
|
22153
22241
|
const sha = String(it.sha256 || "").trim().toLowerCase();
|
|
22154
|
-
if (/^[0-9a-f]{64}$/.test(sha)) entry.
|
|
22242
|
+
if (/^[0-9a-f]{64}$/.test(sha)) entry.manifestSha256 = sha;
|
|
22155
22243
|
if (lfPreferOriginal(it.id)) entry.quality = "original";
|
|
22156
22244
|
return entry;
|
|
22157
22245
|
}
|
|
@@ -22615,6 +22703,12 @@ window.__ModuleLoader__.load({
|
|
|
22615
22703
|
'job-lost': weT("下载任务已丢失,点「重试」"),
|
|
22616
22704
|
'download-failed': weT("下载失败(站点未返回文件),请稍后重试"),
|
|
22617
22705
|
'download-timeout': weT("下载超时(已下部分会保留,再点「安装」可续传)"),
|
|
22706
|
+
// 4.23.17:本地临时/成品文件被外部清理(缓存管理器 / 手工删)——连续两次都这样才报这个。
|
|
22707
|
+
// 文案必须说清"不是站点的问题、重试会重新下":否则用户会以为站点挂了。
|
|
22708
|
+
'file-vanished': weT("下载途中本地文件被清理掉了(连续两次),点「重试」会重新下载"),
|
|
22709
|
+
// 4.23.17(P0-6):期望值与 URL 不自洽(变体 URL 却拿了原画哈希)。这是**我们自己的**
|
|
22710
|
+
// 哈希来源错配,不是"传输传坏了"——必须与 hash-mismatch 分开说,否则排障方向就是错的。
|
|
22711
|
+
'hash-source-mismatch': weT("下载地址与校验哈希不是同一个文件(原画/变体的哈希搞混了),点「重试」会按正确的那一档重新下载"),
|
|
22618
22712
|
'http-404': weT("站点上没有这个文件(404,可能正在补传/已被删除)"),
|
|
22619
22713
|
'http-403': weT("站点拒绝访问这个文件(403,权限或签名问题)"),
|
|
22620
22714
|
'http-500': weT("站点服务器错误(HTTP 500),不是本地问题,请稍后重试"),
|
|
@@ -23122,9 +23216,9 @@ window.__ModuleLoader__.load({
|
|
|
23122
23216
|
function dlHealNote(verdict) {
|
|
23123
23217
|
const v = String(verdict || "");
|
|
23124
23218
|
if (v === "corrupt") return weT("文件已损坏,已重新下载");
|
|
23125
|
-
if (v === "variant") return weT("
|
|
23126
|
-
if (v === "transcoded") return weT("
|
|
23127
|
-
if (v === "transcoding") return weT("
|
|
23219
|
+
if (v === "variant") return weT("已切换到 1080p(原画超出本机解码上限)");
|
|
23220
|
+
if (v === "transcoded") return weT("已切换到 1080p(原画超出本机解码上限)");
|
|
23221
|
+
if (v === "transcoding") return weT("正在生成可播放副本…");
|
|
23128
23222
|
if (v === "undecodable") return weT("本机不支持该编码(可换一张跳过此壁纸)");
|
|
23129
23223
|
if (v === "undecodable-no-variant") return weT("该壁纸分辨率/编码超出本机解码能力(可换一张跳过此壁纸)");
|
|
23130
23224
|
return "";
|
|
@@ -23255,12 +23349,16 @@ window.__ModuleLoader__.load({
|
|
|
23255
23349
|
const url = res.url || (res.jobId ? "/folia/local-media/" + encodeURIComponent(String(res.jobId)) : "");
|
|
23256
23350
|
const done = Boolean(url && mount && mount(url));
|
|
23257
23351
|
lfHealSay(withLabel(message), true);
|
|
23258
|
-
return { verdict, message, mounted: done };
|
|
23352
|
+
return { verdict, message: (res && res.mode === "fps") ? weT("已切换到 30fps 副本(原画 60fps 超出本机解码能力,分辨率不变)") : message, mounted: done };
|
|
23259
23353
|
}
|
|
23260
23354
|
if (verdict === "transcoded") {
|
|
23355
|
+
// 降帧档与缩分辨率档的文案不同(用户要能看懂"为什么降")。
|
|
23356
|
+
const msg = (res && res.mode === "fps")
|
|
23357
|
+
? weT("已切换到 30fps 副本(原画 60fps 超出本机解码能力,分辨率不变)")
|
|
23358
|
+
: message;
|
|
23261
23359
|
const done = Boolean(res.url && mount && mount(res.url));
|
|
23262
|
-
lfHealSay(withLabel(
|
|
23263
|
-
return { verdict, message, mounted: done };
|
|
23360
|
+
lfHealSay(withLabel(msg), true);
|
|
23361
|
+
return { verdict, message: (res && res.mode === "fps") ? weT("已切换到 30fps 副本(原画 60fps 超出本机解码能力,分辨率不变)") : message, mounted: done };
|
|
23264
23362
|
}
|
|
23265
23363
|
lfHealSay(withLabel(message), false);
|
|
23266
23364
|
return { verdict: verdict || "error", message, mounted: false };
|
|
@@ -23536,6 +23634,376 @@ window.__ModuleLoader__.load({
|
|
|
23536
23634
|
return api;
|
|
23537
23635
|
}
|
|
23538
23636
|
|
|
23637
|
+
// ── 内联模块:src/wallpaper-progress.js —— 壁纸缓存进度:/downloads/list 真源 → 卡片/标题栏视图(进度 / 已缓存 / 排队 / 失败重试),按卡订阅、不整列表重渲染(构建期注入;勿手改本段)──
|
|
23638
|
+
/**
|
|
23639
|
+
* wallpaper-progress.js — **壁纸缓存进度**(4.23.17):首次点击后「缓存中 62%」,下完变
|
|
23640
|
+
* 「已缓存」,切走再切回**接着显示真实进度**。
|
|
23641
|
+
*
|
|
23642
|
+
* ══ 为什么要有这一层(用户口径,原样)══════════════════════════════════════════════
|
|
23643
|
+
* ① 点了一张没缓存的壁纸,卡片/标题栏要立刻看得见"在缓存"(有百分比,不是静默);
|
|
23644
|
+
* ② 下完 ⇒ 百分比消失;卡片只说「已缓存」(再点它不必等网络);
|
|
23645
|
+
* ③ 点 A 再点 B:B 显示自己的进度,**A 的仍留在卡片上**(宿主队列还在下 A);
|
|
23646
|
+
* ④ 切走(关掉库视图 / 换页签)再切回 A:已下好 ⇒ 只说「已缓存」;没下好 ⇒
|
|
23647
|
+
* **接着显示当前进度**(从 `/folia/downloads/list` 读真实值,绝不是从 0 重来);
|
|
23648
|
+
* ⑤ 原画与 1080p 变体是**同一族**:任一下好即算已缓存(判据复用 inventory 的
|
|
23649
|
+
* `localReady`,它由宿主 `lib/switch-cache-family.js` 的族键算出)。
|
|
23650
|
+
*
|
|
23651
|
+
* ══ 真源与分工(不许出现第二套轮询)════════════════════════════════════════════════
|
|
23652
|
+
* · 唯一的进度真源是 `/folia/downloads/list`(job.status / percent / received / total /
|
|
23653
|
+
* queuePos / error)。本文件**不自己发这个请求**:`WpJobsBridge` 调既有的
|
|
23654
|
+
* `useDownloadJobs()`(src/local-first.js,1.5s、无活跃 job 自动停表),把快照推进来。
|
|
23655
|
+
* · 存储 `WP_STORE` 只做两件事:留一份最新快照 + 按**订阅的卡**逐个通知。于是
|
|
23656
|
+
* "进度更新 = 只重渲染那一张卡",列表(上百条)不因为一次轮询整片重渲染。
|
|
23657
|
+
* · 视图是**纯函数**(`wpViewOf`):给 item + jobs 就答"该显示什么",没有组件状态、
|
|
23658
|
+
* 没有本地计时器 ⇒ 切回来第一次渲染就是 `/downloads/list` 里的真实值。
|
|
23659
|
+
*
|
|
23660
|
+
* ══ 契约 ═══════════════════════════════════════════════════════════════════════════
|
|
23661
|
+
* · 浏览器安全(无 import / require / Node API),由 scripts/build-client.mjs 内联进
|
|
23662
|
+
* 客户端 bundle 的工厂作用域;名字一律 `wp` / `Wp` 前缀,避免与既有 prelude 撞名。
|
|
23663
|
+
* · 文案全部走 `weT(...)`(中文原文为键,英文词表在 src/i18n-copy-panel.js)。
|
|
23664
|
+
* · 不改既有断言:本文件只**新增**节点(无内容时返回 null),模态框标记等价 golden 不变。
|
|
23665
|
+
*/
|
|
23666
|
+
|
|
23667
|
+
/** 队列快照 + 每张卡的最新视图通知。 */
|
|
23668
|
+
const WP_STORE = {
|
|
23669
|
+
/** 最近一次 `/downloads/list` 的 jobs(真源快照,组件卸载/切走都不清)。 */
|
|
23670
|
+
jobs: [],
|
|
23671
|
+
/** itemKey → { item, fns:Set<(view:object|null)=>void>, sig:string }(只留当前挂着的卡)。 */
|
|
23672
|
+
subs: new Map(),
|
|
23673
|
+
/** `useDownloadJobs().refresh`(点「重试」后立刻重拉一次,不必等下一拍)。 */
|
|
23674
|
+
refresh: null,
|
|
23675
|
+
};
|
|
23676
|
+
|
|
23677
|
+
/** jobId → ETA 秒数(0 = 不显示;由最近 4 秒的字节增量估,与 useDlCards ③ 同一条口径)。 */
|
|
23678
|
+
const WP_ETA = new Map();
|
|
23679
|
+
/** jobId → [{ at, got }],只留最近 4 秒的样本。 */
|
|
23680
|
+
const WP_SAMPLES = new Map();
|
|
23681
|
+
/** ETA 的观测窗口(与 src/local-first.js 的 useDlCards ③ 一致)。 */
|
|
23682
|
+
const WP_ETA_WINDOW_MS = 4000;
|
|
23683
|
+
/** ETA 的最小样本跨度:短于它不估(1.5s 轮询下两次样本就够,60ms 内的抖动不算证据)。 */
|
|
23684
|
+
const WP_ETA_MIN_SPAN_MS = 600;
|
|
23685
|
+
/** ETA 的最低"有速度"门槛:低于 1 KB/s 视为没往前走(别报一个几百秒的假数字)。 */
|
|
23686
|
+
const WP_ETA_MIN_SPEED_BPS = 1024;
|
|
23687
|
+
|
|
23688
|
+
/** 卡片键(item.id;没有 id 的条目不该出现在库里,这里只做防御)。 */
|
|
23689
|
+
function wpItemKey(item) {
|
|
23690
|
+
return String((item && item.id) == null ? "" : item.id);
|
|
23691
|
+
}
|
|
23692
|
+
|
|
23693
|
+
/**
|
|
23694
|
+
* 这张卡的**全部 URL**(原画 + 站点 1080p 变体 + 本地副本地址)。
|
|
23695
|
+
*
|
|
23696
|
+
* 为什么不是"只比 media":宿主选档之后下的是**变体** URL(`/downloads/add` 的 finalUrl),
|
|
23697
|
+
* 而卡片代表的是这个条目(原画 URL)。两个 URL 属于同一条卡 ⇒ 用集合比,天然把"族"
|
|
23698
|
+
* 覆盖进来;`localReady` 那一半(已缓存)由 inventory 用同一个族键给出,两处不各算一套。
|
|
23699
|
+
*/
|
|
23700
|
+
function wpItemUrls(item) {
|
|
23701
|
+
const w = item || {};
|
|
23702
|
+
const out = Object.create(null);
|
|
23703
|
+
const add = (u) => {
|
|
23704
|
+
const s = String(u == null ? "" : u).trim();
|
|
23705
|
+
if (s) out[s] = true;
|
|
23706
|
+
};
|
|
23707
|
+
add(w.media);
|
|
23708
|
+
add(w.variantUrl);
|
|
23709
|
+
add(w.mediaProxy);
|
|
23710
|
+
const local = w.localDownload;
|
|
23711
|
+
if (local && typeof local === "object") add(local.url);
|
|
23712
|
+
const variants = Array.isArray(w.variants) ? w.variants : [];
|
|
23713
|
+
for (const v of variants) if (v && typeof v === "object") add(v.url);
|
|
23714
|
+
return out;
|
|
23715
|
+
}
|
|
23716
|
+
|
|
23717
|
+
/**
|
|
23718
|
+
* 这条卡对应的 job(`/downloads/list` 里 kind=wallpaper 的那条)。
|
|
23719
|
+
* 同一 URL 可能有多条历史(失败重下)⇒ 优先未结束的,否则取最后一条(snapshot 已按 at 倒序)。
|
|
23720
|
+
*/
|
|
23721
|
+
function wpJobForItem(jobs, item) {
|
|
23722
|
+
const urls = wpItemUrls(item);
|
|
23723
|
+
const list = Array.isArray(jobs) ? jobs : [];
|
|
23724
|
+
let best = null;
|
|
23725
|
+
for (const j of list) {
|
|
23726
|
+
if (!j) continue;
|
|
23727
|
+
// kind 缺省(旧数据 / 测试夹具)按 wallpaper 认:URL 本身就是身份。
|
|
23728
|
+
if (j.kind && String(j.kind) !== "wallpaper") continue;
|
|
23729
|
+
const u = String(j.url == null ? "" : j.url).trim();
|
|
23730
|
+
if (!u || !urls[u]) continue;
|
|
23731
|
+
if (!best || (dlJobActive(j) && !dlJobActive(best))) best = j;
|
|
23732
|
+
}
|
|
23733
|
+
return best;
|
|
23734
|
+
}
|
|
23735
|
+
|
|
23736
|
+
/** job.percent(0..100 整数)。**只读列表里的数**,绝不按时间自己涨。 */
|
|
23737
|
+
function wpPercentOf(job) {
|
|
23738
|
+
const n = Number(job && job.percent);
|
|
23739
|
+
if (!Number.isFinite(n)) return 0;
|
|
23740
|
+
return Math.max(0, Math.min(100, Math.round(n)));
|
|
23741
|
+
}
|
|
23742
|
+
|
|
23743
|
+
/**
|
|
23744
|
+
* 卡片状态机(纯函数):
|
|
23745
|
+
* running / queued(队列里还有活) ⇒ 进度
|
|
23746
|
+
* cached(`localReady` 族命中,或这条 job 已经 done) ⇒ 「已缓存」
|
|
23747
|
+
* failed(job 明确失败且这张卡还没缓存) ⇒ 原因 +「重试」
|
|
23748
|
+
* none(没有 job 且没缓存) ⇒ 什么都不画(避免噪音)
|
|
23749
|
+
*/
|
|
23750
|
+
function wpStateOf(item, jobs) {
|
|
23751
|
+
const w = item || {};
|
|
23752
|
+
// `localReady` = 族级已缓存(宿主 familyKeyOf:原画 / 1080p 任一下好)。
|
|
23753
|
+
const cached = w.localReady === true || w.local === true;
|
|
23754
|
+
const job = wpJobForItem(jobs, w);
|
|
23755
|
+
const status = String((job && job.status) || "");
|
|
23756
|
+
if (status === "running") return { phase: "running", job, percent: wpPercentOf(job), cached };
|
|
23757
|
+
if (status === "queued") return { phase: "queued", job, percent: 0, cached };
|
|
23758
|
+
// 已缓存优先于 done/failed:族里另一档已经落地 ⇒ 不再报"这条失败"的噪音。
|
|
23759
|
+
if (cached) return { phase: "cached", job: null, percent: 100 };
|
|
23760
|
+
if (status === "done") return { phase: "cached", job, percent: 100 };
|
|
23761
|
+
if (status === "failed") return { phase: "failed", job, percent: 0, code: String(job.error || "failed") };
|
|
23762
|
+
return { phase: "none", job: null, percent: 0 };
|
|
23763
|
+
}
|
|
23764
|
+
|
|
23765
|
+
/** 一次 job 快照的字节样本 → ETA 秒(样本不足 / 没往前走 ⇒ 0,绝不编数字)。 */
|
|
23766
|
+
function wpSampleEta(jobs, nowMs) {
|
|
23767
|
+
const now = Number(nowMs) || 0;
|
|
23768
|
+
const alive = new Set();
|
|
23769
|
+
for (const j of (Array.isArray(jobs) ? jobs : [])) {
|
|
23770
|
+
if (!j || !j.id || j.status !== "running") continue;
|
|
23771
|
+
alive.add(String(j.id));
|
|
23772
|
+
const arr = WP_SAMPLES.get(String(j.id)) || [];
|
|
23773
|
+
arr.push({ at: now, got: Math.max(0, Number(j.received) || 0) });
|
|
23774
|
+
while (arr.length > 2 && now - arr[0].at > WP_ETA_WINDOW_MS) arr.shift();
|
|
23775
|
+
WP_SAMPLES.set(String(j.id), arr);
|
|
23776
|
+
const first = arr[0];
|
|
23777
|
+
const span = now - first.at;
|
|
23778
|
+
const got = Math.max(0, Number(j.received) || 0);
|
|
23779
|
+
const total = Math.max(0, Number(j.total) || 0);
|
|
23780
|
+
const speed = span > WP_ETA_MIN_SPAN_MS ? (got - first.got) / (span / 1000) : 0;
|
|
23781
|
+
if (speed > WP_ETA_MIN_SPEED_BPS && total > got) WP_ETA.set(String(j.id), Math.max(1, Math.round((total - got) / speed)));
|
|
23782
|
+
else WP_ETA.delete(String(j.id));
|
|
23783
|
+
}
|
|
23784
|
+
for (const k of [...WP_SAMPLES.keys()]) if (!alive.has(k)) { WP_SAMPLES.delete(k); WP_ETA.delete(k); }
|
|
23785
|
+
}
|
|
23786
|
+
|
|
23787
|
+
/** 这条卡的 ETA(秒;0 = 不说"约剩")。 */
|
|
23788
|
+
function wpEtaOfItem(item, jobs) {
|
|
23789
|
+
const job = wpJobForItem(jobs, item);
|
|
23790
|
+
if (!job || job.status !== "running" || !job.id) return 0;
|
|
23791
|
+
return Number(WP_ETA.get(String(job.id)) || 0) || 0;
|
|
23792
|
+
}
|
|
23793
|
+
|
|
23794
|
+
/**
|
|
23795
|
+
* **唯一的视图函数**(纯函数):item + 队列快照 ⇒ 卡片/标题栏该显示的文案与形态。
|
|
23796
|
+
*
|
|
23797
|
+
* 返回 null = 这一格什么都不该画(没有 job 且没缓存)。
|
|
23798
|
+
* `card`(卡片:短)/ `title`(标题栏:带已下/总量与约剩)/ `phase` / `percent` / `reason`。
|
|
23799
|
+
* 文案全部来自既有的 `dlQueueDetail` / `dlProgressDetail` / `dlFailReason`(四模块共用一张表),
|
|
23800
|
+
* 本文件不另造数字、不另写失败原因。
|
|
23801
|
+
*/
|
|
23802
|
+
function wpViewOf(item, jobs, etaSec) {
|
|
23803
|
+
const s = wpStateOf(item, jobs);
|
|
23804
|
+
if (s.phase === "running") {
|
|
23805
|
+
const p = s.percent;
|
|
23806
|
+
const detail = dlProgressDetail(s.job, Number(etaSec) || 0);
|
|
23807
|
+
return {
|
|
23808
|
+
phase: "running",
|
|
23809
|
+
percent: p,
|
|
23810
|
+
card: weT("缓存中 {p}%", { p }),
|
|
23811
|
+
title: weT("缓存中 {p}%({detail})", { p, detail }),
|
|
23812
|
+
};
|
|
23813
|
+
}
|
|
23814
|
+
if (s.phase === "queued") {
|
|
23815
|
+
const text = dlQueueDetail(s.job);
|
|
23816
|
+
return { phase: "queued", percent: 0, card: text, title: text };
|
|
23817
|
+
}
|
|
23818
|
+
if (s.phase === "cached") {
|
|
23819
|
+
return { phase: "cached", percent: 100, card: weT("已缓存"), title: null };
|
|
23820
|
+
}
|
|
23821
|
+
if (s.phase === "failed") {
|
|
23822
|
+
const why = dlFailReason(s.code);
|
|
23823
|
+
return { phase: "failed", percent: 0, card: weT("重试"), title: why, reason: why };
|
|
23824
|
+
}
|
|
23825
|
+
return null;
|
|
23826
|
+
}
|
|
23827
|
+
|
|
23828
|
+
/** 当前快照下的视图(订阅回调用它:切回来第一帧就是 `/downloads/list` 的真实值)。 */
|
|
23829
|
+
function wpSnapshotOf(item) {
|
|
23830
|
+
const jobs = WP_STORE.jobs;
|
|
23831
|
+
return wpViewOf(item, jobs, wpEtaOfItem(item, jobs));
|
|
23832
|
+
}
|
|
23833
|
+
|
|
23834
|
+
/** 视图签名:只有**显示内容**变了才通知订阅者(同一百分比重复推送不触发渲染)。 */
|
|
23835
|
+
function wpSigOf(view) {
|
|
23836
|
+
return view ? [view.phase, view.percent, view.card, view.title, view.reason || ""].join("\u0001") : "";
|
|
23837
|
+
}
|
|
23838
|
+
|
|
23839
|
+
/**
|
|
23840
|
+
* 队列快照变了(`WpJobsBridge` 每次轮询后调)⇒ 只通知**显示内容真的变了**的卡。
|
|
23841
|
+
* `nowMs` 可注入(测试用固定时钟;生产调用不传 = Date.now())。
|
|
23842
|
+
*/
|
|
23843
|
+
function wpPushJobs(jobs, nowMs) {
|
|
23844
|
+
const list = Array.isArray(jobs) ? jobs : [];
|
|
23845
|
+
WP_STORE.jobs = list;
|
|
23846
|
+
wpSampleEta(list, Number(nowMs) || Date.now());
|
|
23847
|
+
for (const rec of [...WP_STORE.subs.values()]) {
|
|
23848
|
+
const view = wpViewOf(rec.item, list, wpEtaOfItem(rec.item, list));
|
|
23849
|
+
const sig = wpSigOf(view);
|
|
23850
|
+
if (sig === rec.sig) continue;
|
|
23851
|
+
rec.sig = sig;
|
|
23852
|
+
for (const fn of [...rec.fns]) {
|
|
23853
|
+
try { fn(view); } catch { /* 单张卡出错不影响其它卡 */ }
|
|
23854
|
+
}
|
|
23855
|
+
}
|
|
23856
|
+
}
|
|
23857
|
+
|
|
23858
|
+
/** 订阅这张卡(立刻回一次当前视图;返回退订函数)。 */
|
|
23859
|
+
function wpSubscribe(item, fn) {
|
|
23860
|
+
const key = wpItemKey(item);
|
|
23861
|
+
if (!key || typeof fn !== "function") return () => {};
|
|
23862
|
+
let rec = WP_STORE.subs.get(key);
|
|
23863
|
+
if (!rec) {
|
|
23864
|
+
rec = { item, fns: new Set(), sig: "" };
|
|
23865
|
+
WP_STORE.subs.set(key, rec);
|
|
23866
|
+
}
|
|
23867
|
+
rec.item = item;
|
|
23868
|
+
rec.fns.add(fn);
|
|
23869
|
+
// 立刻给一次:切回库视图时不必等下一拍轮询才看见进度。
|
|
23870
|
+
try { fn(wpSnapshotOf(item)); } catch { /* 组件已卸载:忽略 */ }
|
|
23871
|
+
return () => { wpUnsubscribe(key, fn); };
|
|
23872
|
+
}
|
|
23873
|
+
|
|
23874
|
+
/** 退订(**只摘监听**:不清队列快照 —— 切走再回来必须还能算出真实进度)。 */
|
|
23875
|
+
function wpUnsubscribe(key, fn) {
|
|
23876
|
+
const rec = WP_STORE.subs.get(key);
|
|
23877
|
+
if (!rec) return;
|
|
23878
|
+
rec.fns.delete(fn);
|
|
23879
|
+
if (!rec.fns.size) WP_STORE.subs.delete(key);
|
|
23880
|
+
}
|
|
23881
|
+
|
|
23882
|
+
/**
|
|
23883
|
+
* React:订阅一条壁纸的缓存进度(卡片 / 标题栏各一枚)。
|
|
23884
|
+
*
|
|
23885
|
+
* 依赖 `item` 身份:清单刷新会换对象 ⇒ 重新订阅(拿到新的 `localReady` 与 URL 集合)。
|
|
23886
|
+
* 注意这里**没有** "切走就归零" 的本地状态:视图每次都由 `wpSnapshotOf` 现算。
|
|
23887
|
+
*/
|
|
23888
|
+
function useWallpaperProgress(item) {
|
|
23889
|
+
const [view, setView] = React.useState(() => wpSnapshotOf(item));
|
|
23890
|
+
React.useEffect(() => {
|
|
23891
|
+
let alive = true;
|
|
23892
|
+
setView(wpSnapshotOf(item));
|
|
23893
|
+
const off = wpSubscribe(item, (v) => { if (alive) setView(v); });
|
|
23894
|
+
return () => { alive = false; off(); };
|
|
23895
|
+
}, [item]);
|
|
23896
|
+
return view;
|
|
23897
|
+
}
|
|
23898
|
+
|
|
23899
|
+
/**
|
|
23900
|
+
* 队列 → 进度存储的**桥**(无 DOM、返回 null)。
|
|
23901
|
+
*
|
|
23902
|
+
* 轮询**复用** `useDownloadJobs()`(src/local-first.js:1.5s 间隔、列表里没有 queued|running
|
|
23903
|
+
* 就停表、卸载即清定时器都在那里)—— 这里只是把快照分发出去,**不新建第二套轮询**。
|
|
23904
|
+
*/
|
|
23905
|
+
function WpJobsBridge() {
|
|
23906
|
+
const dl = useDownloadJobs();
|
|
23907
|
+
React.useEffect(() => {
|
|
23908
|
+
WP_STORE.refresh = (dl && typeof dl.refresh === "function") ? dl.refresh : null;
|
|
23909
|
+
wpPushJobs(dl && dl.jobs);
|
|
23910
|
+
}, [dl && dl.jobs]);
|
|
23911
|
+
return null;
|
|
23912
|
+
}
|
|
23913
|
+
|
|
23914
|
+
/**
|
|
23915
|
+
* 「重试」:按用户点击(high 优先级)重新入队同一条壁纸,然后立刻重拉一次队列。
|
|
23916
|
+
* 失败不抛(重试按钮不该把面板弄坏);下一拍轮询仍会给出真实状态。
|
|
23917
|
+
*/
|
|
23918
|
+
async function wpRetryDownload(item) {
|
|
23919
|
+
const w = item || {};
|
|
23920
|
+
if (!w.media) return false;
|
|
23921
|
+
try {
|
|
23922
|
+
await apiPostJson("/downloads/add", {
|
|
23923
|
+
items: [lfAddItem(w, w.media, "high")],
|
|
23924
|
+
}, { parse: "always" });
|
|
23925
|
+
} catch (e) {
|
|
23926
|
+
// 不静默:重试失败要能在控制台看到原因(界面下一次轮询仍会回到 failed +「重试」)。
|
|
23927
|
+
try { console.warn("[folia] 壁纸重新入队失败:", (e && e.message) || e); } catch { /* 控制台不可用 */ }
|
|
23928
|
+
return false;
|
|
23929
|
+
}
|
|
23930
|
+
try { if (typeof WP_STORE.refresh === "function") WP_STORE.refresh(); } catch { /* 下一拍轮询会补上 */ }
|
|
23931
|
+
return true;
|
|
23932
|
+
}
|
|
23933
|
+
|
|
23934
|
+
/** 卡片上的缓存进度/角标(返回 null = 这个格子什么都不画)。 */
|
|
23935
|
+
function wpCardRender(view, item) {
|
|
23936
|
+
if (!view) return null;
|
|
23937
|
+
const stop = (e) => { if (e && typeof e.stopPropagation === "function") e.stopPropagation(); };
|
|
23938
|
+
if (view.phase === "running") {
|
|
23939
|
+
return React.createElement("div", {
|
|
23940
|
+
className: "we-wp-progress",
|
|
23941
|
+
"data-we-wp": "running",
|
|
23942
|
+
title: view.title || view.card,
|
|
23943
|
+
},
|
|
23944
|
+
React.createElement("span", { className: "we-wp-progress__label" }, view.card),
|
|
23945
|
+
React.createElement("span", { className: "we-wp-progress__rail" },
|
|
23946
|
+
React.createElement("span", {
|
|
23947
|
+
className: "we-wp-progress__fill",
|
|
23948
|
+
style: { width: view.percent + "%" },
|
|
23949
|
+
})));
|
|
23950
|
+
}
|
|
23951
|
+
if (view.phase === "queued") {
|
|
23952
|
+
return React.createElement("span", {
|
|
23953
|
+
className: "we-wp-queued", "data-we-wp": "queued", title: view.card,
|
|
23954
|
+
}, view.card);
|
|
23955
|
+
}
|
|
23956
|
+
if (view.phase === "cached") {
|
|
23957
|
+
return React.createElement("span", {
|
|
23958
|
+
className: "we-wp-cached", "data-we-wp": "cached",
|
|
23959
|
+
title: weT("已在本地缓存(原画或 1080p 任一档已落地),点它不必等网络"),
|
|
23960
|
+
}, view.card);
|
|
23961
|
+
}
|
|
23962
|
+
if (view.phase === "failed") {
|
|
23963
|
+
return React.createElement("div", {
|
|
23964
|
+
className: "we-wp-failed", "data-we-wp": "failed", title: view.reason,
|
|
23965
|
+
},
|
|
23966
|
+
React.createElement("span", { className: "we-wp-failed__why" }, view.reason),
|
|
23967
|
+
React.createElement("button", {
|
|
23968
|
+
className: "we-wp-failed__retry", type: "button", title: weT("重试"),
|
|
23969
|
+
onClick: (e) => { stop(e); wpRetryDownload(item); },
|
|
23970
|
+
}, view.card));
|
|
23971
|
+
}
|
|
23972
|
+
return null;
|
|
23973
|
+
}
|
|
23974
|
+
|
|
23975
|
+
/** 卡片组件:只重渲染自己(进度更新不碰整张列表)。 */
|
|
23976
|
+
function WpCardProgress(props) {
|
|
23977
|
+
const item = props && props.item;
|
|
23978
|
+
const view = useWallpaperProgress(item);
|
|
23979
|
+
return wpCardRender(view, item);
|
|
23980
|
+
}
|
|
23981
|
+
|
|
23982
|
+
/** 标题栏(当前壁纸那一行):只画"进度/排队/失败",已缓存/无 job 时返回 null。 */
|
|
23983
|
+
function wpTitleRender(view, item) {
|
|
23984
|
+
if (!view) return null;
|
|
23985
|
+
if (view.phase === "running" || view.phase === "queued") {
|
|
23986
|
+
return React.createElement("div", {
|
|
23987
|
+
className: "we-picker__hint we-wp-title",
|
|
23988
|
+
"data-we-wp": view.phase,
|
|
23989
|
+
title: view.title || view.card,
|
|
23990
|
+
}, view.title || view.card);
|
|
23991
|
+
}
|
|
23992
|
+
if (view.phase === "failed") {
|
|
23993
|
+
return React.createElement("div", {
|
|
23994
|
+
className: "we-picker__hint we-wp-title we-wp-title--failed",
|
|
23995
|
+
"data-we-wp": "failed",
|
|
23996
|
+
title: view.reason,
|
|
23997
|
+
},
|
|
23998
|
+
React.createElement("span", { className: "we-wp-title__why" }, view.reason),
|
|
23999
|
+
React.createElement("button", {
|
|
24000
|
+
className: "we-wp-failed__retry", type: "button", title: weT("重试"),
|
|
24001
|
+
onClick: (e) => { if (e && typeof e.stopPropagation === "function") e.stopPropagation(); wpRetryDownload(item); },
|
|
24002
|
+
}, view.card));
|
|
24003
|
+
}
|
|
24004
|
+
return null;
|
|
24005
|
+
}
|
|
24006
|
+
|
|
23539
24007
|
// ── 内联模块:src/tag-facets.js —— 标签筛选纯函数族:facets → 分组选项 / OR 查询串 / 选中持久化(构建期注入;勿手改本段)──
|
|
23540
24008
|
/**
|
|
23541
24009
|
* tag-facets.js — **站点 facets → 标签筛选**的纯函数族(4.23.9)。
|
|
@@ -33097,14 +33565,14 @@ window.__ModuleLoader__.load({
|
|
|
33097
33565
|
liveLog("media-selfheal", "静态帧兜底:" + still);
|
|
33098
33566
|
try {
|
|
33099
33567
|
setTransient("videoError", "");
|
|
33100
|
-
setTransient("mediaNote", weT("
|
|
33568
|
+
setTransient("mediaNote", weT("已降级为静态壁纸(本机无法解码该视频)"));
|
|
33101
33569
|
emit();
|
|
33102
33570
|
} catch { /* ignore */ }
|
|
33103
33571
|
return;
|
|
33104
33572
|
}
|
|
33105
33573
|
if (plan === "cannot-display" || (plan === "static-frame" && !still)) {
|
|
33106
33574
|
try {
|
|
33107
|
-
setTransient("videoError", weT("
|
|
33575
|
+
setTransient("videoError", weT("无法显示这张壁纸(本机无法解码该视频,且没有可用的静态帧)"));
|
|
33108
33576
|
emit();
|
|
33109
33577
|
} catch { /* ignore */ }
|
|
33110
33578
|
return;
|