dsh-folia 4.0.4 → 4.0.6
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 +28 -0
- package/lib/routes/boot.js +9 -1
- package/package.json +1 -1
package/lib/client.js
CHANGED
|
@@ -17149,6 +17149,14 @@ window.__ModuleLoader__.load({
|
|
|
17149
17149
|
actions.push(btn(weT("使用中"), () => {}, true, false));
|
|
17150
17150
|
}
|
|
17151
17151
|
return React.createElement("div", { key: c.id, style: BOOT_STYLE.card },
|
|
17152
|
+
// 封面:站点给了真正的缩略图才显示;老条目没有就留空(不显示破图)。
|
|
17153
|
+
c.cover
|
|
17154
|
+
? React.createElement("img", {
|
|
17155
|
+
src: c.cover, alt: "", loading: "lazy", decoding: "async",
|
|
17156
|
+
style: { width: "100%", aspectRatio: "16 / 9", objectFit: "cover", borderRadius: "6px", background: "rgba(0,0,0,0.3)" },
|
|
17157
|
+
onError: (e) => { e.target.style.display = "none"; },
|
|
17158
|
+
})
|
|
17159
|
+
: null,
|
|
17152
17160
|
React.createElement("div", { style: BOOT_STYLE.title }, c.title || c.id),
|
|
17153
17161
|
React.createElement("div", { style: BOOT_STYLE.meta },
|
|
17154
17162
|
[c.durationSec ? Number(c.durationSec).toFixed(1) + "s" : null,
|
|
@@ -17484,6 +17492,19 @@ window.__ModuleLoader__.load({
|
|
|
17484
17492
|
);
|
|
17485
17493
|
}
|
|
17486
17494
|
|
|
17495
|
+
/**
|
|
17496
|
+
* 这张图是不是"预览尺寸"(当壁纸会糊)。
|
|
17497
|
+
*
|
|
17498
|
+
* 判据用**短边 < 1280**:站点上实测有 192×192 / 254×254 / 1024×1024 的条目,
|
|
17499
|
+
* 它们标题里就写着「(预览)」。用户看不到分辨率,就会把它当壁纸用,然后觉得"糊"。
|
|
17500
|
+
* 视频不判(分辨率高但体积大是另一类问题,不该混在一起提示)。
|
|
17501
|
+
*/
|
|
17502
|
+
function qpIsLowRes(w) {
|
|
17503
|
+
if (!w || w.type !== 'image') return false;
|
|
17504
|
+
const shortSide = Math.min(Number(w.width) || 0, Number(w.height) || 0);
|
|
17505
|
+
return shortSide > 0 && shortSide < 1280;
|
|
17506
|
+
}
|
|
17507
|
+
|
|
17487
17508
|
function qpRenderCard(w, sel) {
|
|
17488
17509
|
// ── 卡:缩略图网格形态(视图切换的「卡片」档;点击语义与列表行一致)──
|
|
17489
17510
|
return React.createElement("div", {
|
|
@@ -17506,6 +17527,13 @@ window.__ModuleLoader__.load({
|
|
|
17506
17527
|
})
|
|
17507
17528
|
: React.createElement("span", { className: "we-qp__card-empty" }, weT("无预览")),
|
|
17508
17529
|
React.createElement("span", { className: "we-qp__card-type" }, CARD_TYPE_LABELS[w.type] || weT("壁纸")),
|
|
17530
|
+
qpIsLowRes(w)
|
|
17531
|
+
? React.createElement("span", {
|
|
17532
|
+
className: "we-qp__card-badge",
|
|
17533
|
+
style: { right: "auto", left: "6px", background: "rgba(255,196,120,0.9)", color: "#3a2600" },
|
|
17534
|
+
title: weT("这张图只有 ") + w.width + "×" + w.height + weT(",当壁纸会糊 —— 建议在站点上传原图"),
|
|
17535
|
+
}, weT("预览尺寸"))
|
|
17536
|
+
: null,
|
|
17509
17537
|
w.id === sel.id && React.createElement("span", { className: "we-qp__card-badge" }, weT("当前")),
|
|
17510
17538
|
React.createElement("span", { className: "we-qp__card-title" }, w.title),
|
|
17511
17539
|
);
|
package/lib/routes/boot.js
CHANGED
|
@@ -190,6 +190,14 @@ async function fetchCandidatesUncached() {
|
|
|
190
190
|
bytes: Number(it && it.bytes) || null,
|
|
191
191
|
sha256: it && it.sha256 ? String(it.sha256) : null,
|
|
192
192
|
durationSec: it && it.durationMs ? Number(it.durationMs) / 1000 : null,
|
|
193
|
+
// 封面只认图片扩展名:站点上有几条老条目的 thumbUrl 直接指向 mp4
|
|
194
|
+
// (那时还没有缩略图功能)。把视频当 <img> 用只会得到一张破图。
|
|
195
|
+
cover: (() => {
|
|
196
|
+
const u = String((it && it.thumbUrl) || '');
|
|
197
|
+
if (!u) return null;
|
|
198
|
+
if (!/\.(jpg|jpeg|png|webp|gif|avif)(\?|#|$)/i.test(u)) return null;
|
|
199
|
+
return /^https?:/i.test(u) ? u : site + u;
|
|
200
|
+
})(),
|
|
193
201
|
faststart: true,
|
|
194
202
|
})).filter((c) => c.id && c.url);
|
|
195
203
|
if (clips.length) return { clips, error: null };
|
|
@@ -253,7 +261,7 @@ export function registerBootRoutes(webServer, c) {
|
|
|
253
261
|
if (known.has(it.id)) continue;
|
|
254
262
|
clips.push({
|
|
255
263
|
id: it.id, title: it.title, url: null, bytes: null, sha256: null,
|
|
256
|
-
durationSec: it.durationSec, faststart: true,
|
|
264
|
+
durationSec: it.durationSec, faststart: true, cover: null,
|
|
257
265
|
installed: true, localBytes: it.bytes, orphan: true,
|
|
258
266
|
});
|
|
259
267
|
}
|