dsh-folia 4.21.0 → 4.21.1
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 +13 -4
- package/package.json +1 -1
package/lib/client.js
CHANGED
|
@@ -20914,13 +20914,22 @@ window.__ModuleLoader__.load({
|
|
|
20914
20914
|
try { if (LF_STATE.note) LF_STATE.note(text, ok !== false); } catch { /* 提示失败不影响下载 */ }
|
|
20915
20915
|
}
|
|
20916
20916
|
|
|
20917
|
-
/** 从 inventory
|
|
20917
|
+
/** 从 inventory 里找这条。
|
|
20918
|
+
*
|
|
20919
|
+
* ⚠️ 老实现只认 `items` / `data.items`,而 `/folia/inventory` 实际把壁纸放在 **`wallpapers`** 里
|
|
20920
|
+
* ⇒ 永远找不到 ⇒ 静默不入队 ⇒ 代理侧也拿不到可复用的 job ⇒ 壁纸退化为"远端流式 + 被播放器背压"
|
|
20921
|
+
*(实测 0.6 MB/s、且缓存永远补不满)。现在按"任何一个对象数组里找 id"兜底,不依赖具体键名。
|
|
20922
|
+
*/
|
|
20918
20923
|
async function lfFindItem(id) {
|
|
20919
20924
|
try {
|
|
20920
20925
|
const resp = await apiJson("/inventory");
|
|
20921
|
-
const
|
|
20922
|
-
|
|
20923
|
-
|
|
20926
|
+
const doc = (resp && resp.data && typeof resp.data === 'object') ? resp.data : (resp || {});
|
|
20927
|
+
const pools = [doc.items, doc.wallpapers, doc.list, doc.entries].filter(Array.isArray);
|
|
20928
|
+
for (const pool of pools) {
|
|
20929
|
+
const hit = pool.find((x) => x && x.id === id);
|
|
20930
|
+
if (hit) return hit;
|
|
20931
|
+
}
|
|
20932
|
+
return null;
|
|
20924
20933
|
} catch { return null; }
|
|
20925
20934
|
}
|
|
20926
20935
|
|