feat: check-update diff report and list refresh

This commit is contained in:
2026-08-17 20:09:15 +08:00
parent 2e0e1d5d47
commit fb177cc30f
3 changed files with 45 additions and 8 deletions
+7 -3
View File
@@ -234,9 +234,13 @@ function setupCheckUpdate(page) {
item.onclick = () => {
state.textContent = '检查中…';
bridge.call('refreshManifest').then(result => {
let n = 0;
try { n = JSON.parse(result).count || 0; } catch (e) {}
state.textContent = n > 0 ? '已更新 ' + n + ' 个 ' : '无更新 ';
let r = { added: 0, removed: 0, changed: 0 };
try { r = JSON.parse(result); } catch (e) {}
const parts = [];
if (r.added > 0) parts.push('新增 ' + r.added);
if (r.removed > 0) parts.push('移除 ' + r.removed);
if (r.changed > 0) parts.push('更新 ' + r.changed);
state.textContent = parts.length ? parts.join('') + ' ' : '无更新 ';
}).catch(() => {
state.textContent = '失败 ';
});
@@ -163,3 +163,14 @@ window.HearthEvents.webappImported = function (id, ok) {
if (!ok) return;
refreshList();
};
// 检查更新后刷新列表:清 preload 缓存并重渲染
// Refresh the list after check-update: clear the preload cache and re-render
window.HearthEvents.webappUpdated = function () {
if (window.preload) window.preload.webApps = null;
const page = document.querySelector('[data-page="webapplist"]');
if (page) {
page.dataset.loaded = '';
if (page.classList.contains('active')) window.loadWebAppList();
}
};