From a9a6b6bdc643eb0ddc1077f18af8067a14b4a09a Mon Sep 17 00:00:00 2001 From: momen Date: Sat, 28 Feb 2026 02:28:50 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E9=A6=96=E9=A1=B5=E6=8E=A8=E8=8D=90?= =?UTF-8?q?=E8=BD=AF=E4=BB=B6=E5=AE=89=E8=A3=85=E5=A4=B1=E8=B4=A5=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/App.vue | 39 ++++++++++++++++++++++++++++++++------- 1 file changed, 32 insertions(+), 7 deletions(-) diff --git a/src/App.vue b/src/App.vue index c4937498..1f7057aa 100644 --- a/src/App.vue +++ b/src/App.vue @@ -403,13 +403,38 @@ const loadHome = async () => { const r = await fetch(url); if (r.ok) { const appsJson = await r.json(); - const apps = (appsJson || []).map((a: any) => ({ - name: a.Name || a.name || a.Pkgname || a.PkgName || "", - pkgname: a.Pkgname || a.pkgname || "", - category: a.Category || a.category || "unknown", - more: a.More || a.more || "", - version: a.Version || "", - })); + const rawApps = appsJson || []; + const apps = await Promise.all( + rawApps.map(async (a: any) => { + const baseApp = { + name: a.Name || a.name || a.Pkgname || a.PkgName || "", + pkgname: a.Pkgname || a.pkgname || "", + category: a.Category || a.category || "unknown", + more: a.More || a.more || "", + version: a.Version || "", + filename: a.Filename || a.filename || "", + }; + + // 根据官网的要求,读取Category和Pkgname,拼接出 源地址/架构/Category/Pkgname/app.json来获取对应的真实json + try { + const realAppUrl = `${APM_STORE_BASE_URL}/${window.apm_store.arch}/${baseApp.category}/${baseApp.pkgname}/app.json`; + const realRes = await fetch(realAppUrl); + if (realRes.ok) { + const realApp = await realRes.json(); + // 用真实json的filename字段和More字段来增补和覆盖当前的json + if (realApp.Filename) baseApp.filename = realApp.Filename; + if (realApp.More) baseApp.more = realApp.More; + if (realApp.Name) baseApp.name = realApp.Name; + } + } catch (e) { + console.warn( + `Failed to fetch real app.json for ${baseApp.pkgname}`, + e, + ); + } + return baseApp; + }), + ); homeLists.value.push({ title: item.name || "推荐", apps }); } } catch (e) {