fix: match installed by manifest_id only, add manifest_id field
This commit is contained in:
@@ -587,6 +587,7 @@ async def api_market_upload(file: UploadFile = File(...), name: str = "", catego
|
||||
"name": actual_name, "category": actual_category, "author": actual_author,
|
||||
"version": actual_version, "supported_games": supported,
|
||||
"icon": icon, "description": desc, "dashb_pending": "true",
|
||||
"manifest_id": manifest.get("id", ""),
|
||||
},
|
||||
files={"file": (file.filename, zip_data, file.content_type)},
|
||||
)
|
||||
|
||||
@@ -36,12 +36,11 @@ const PageMarket = {
|
||||
const items = data.items || [];
|
||||
|
||||
let localIds = [];
|
||||
let localNames = [];
|
||||
try { const lr = await fetch('/api/dashboards?category=all'); const ld = await lr.json(); if (Array.isArray(ld)) { localIds = ld.map(d => d.id); localNames = ld.map(d => d.name); } } catch(e) {}
|
||||
try { const lr = await fetch('/api/dashboards?category=all'); const ld = await lr.json(); if (Array.isArray(ld)) localIds = ld.map(d => d.id); } catch(e) {}
|
||||
|
||||
if (!items.length) { grid.innerHTML = this._emptyHtml(isScene ? '暂无场景' : '暂无仪表盘'); return; }
|
||||
grid.innerHTML = items.map(d => {
|
||||
const installed = localIds.includes(d.name || d.id) || localNames.includes(d.name);
|
||||
const installed = localIds.includes(d.manifest_id || d.name || d.id);
|
||||
return this._cardHtml(d, isScene, installed);
|
||||
}).join('');
|
||||
} catch (e) { grid.innerHTML = '<div style="text-align:center;padding:40px;color:var(--danger);">加载失败</div>'; }
|
||||
|
||||
Reference in New Issue
Block a user