diff --git a/debian/changelog b/debian/changelog index 28ed93fd..ef47ec80 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -spark-store (5.2.1.16-test) UNRELEASED; urgency=medium +spark-store (5.2.1.18-test) UNRELEASED; urgency=medium * Initial release. (Closes: #nnnn) diff --git a/electron/main/backend/install-manager.ts b/electron/main/backend/install-manager.ts index e43610ad..c345720b 100644 --- a/electron/main/backend/install-manager.ts +++ b/electron/main/backend/install-manager.ts @@ -1359,7 +1359,8 @@ ipcMain.handle( if ( !pkgname || typeof pkgname !== "string" || - !PKGNAME_PATTERN.test(pkgname) + !PKGNAME_PATTERN.test(pkgname) || + pkgname.length > 256 ) { logger.warn(`Invalid pkgname provided for launch-app: ${pkgname}`); return { success: false, message: "Invalid package name" }; diff --git a/electron/main/backend/update-center/types.ts b/electron/main/backend/update-center/types.ts index 7692befa..102d0a2b 100644 --- a/electron/main/backend/update-center/types.ts +++ b/electron/main/backend/update-center/types.ts @@ -24,4 +24,6 @@ export interface UpdateCenterItem { migrationSource?: UpdateSource; migrationTarget?: UpdateSource; aptssVersion?: string; + // 更新发布时间(毫秒时间戳);由上游解析填充,暂无则缺省 + updateTime?: number; } diff --git a/electron/main/index.ts b/electron/main/index.ts index 10d04579..ba353933 100644 --- a/electron/main/index.ts +++ b/electron/main/index.ts @@ -483,6 +483,8 @@ async function createWindow() { mainWindow.on("close", (event) => { if (allowAppExit) { // 真正退出前同步保存最终窗口尺寸(防抖可能尚未触发) + // 先清除尚未触发的防抖定时器,避免旧定时器随后覆盖本次同步写入 + if (saveBoundsTimer) clearTimeout(saveBoundsTimer); const { width, height, x, y } = mainWindow.getBounds(); saveWindowState({ width, diff --git a/src/App.vue b/src/App.vue index fdc33152..01fbe0e5 100644 --- a/src/App.vue +++ b/src/App.vue @@ -220,6 +220,7 @@ { - if (config.method?.toLowerCase() === "get" && typeof config.url === "string") { + if ( + config.method?.toLowerCase() === "get" && + typeof config.url === "string" + ) { // 按去除 query 的 pathname 判断,兼容 C2 自身追加的 ?_t= 及任何既有 query const reqPath = config.url.split("?")[0]; if (reqPath.endsWith(".json")) { @@ -449,8 +453,8 @@ axiosInstance.interceptors.request.use((config) => { const fetchWithRetry = async ( url: string, signal?: AbortSignal, - retries = 3, - delay = 1000, + retries = 2, + delay = 500, ): Promise => { try { const response = await axiosInstance.get(url, { signal }); diff --git a/src/components/UpdateCenterModal.vue b/src/components/UpdateCenterModal.vue index 574e66eb..ce139d01 100644 --- a/src/components/UpdateCenterModal.vue +++ b/src/components/UpdateCenterModal.vue @@ -66,6 +66,7 @@ :items="store.filteredItems.value" :tasks="store.snapshot.value.tasks" :selected-task-keys="store.selectedTaskKeys.value" + :apps="apps" @toggle-selection="emit('toggle-selection', $event)" @ignore-item="store.ignoreItem" @unignore-item="store.unignoreItem" @@ -86,6 +87,7 @@ diff --git a/src/components/update-center/UpdateCenterList.vue b/src/components/update-center/UpdateCenterList.vue index 68b10e5b..40e51db8 100644 --- a/src/components/update-center/UpdateCenterList.vue +++ b/src/components/update-center/UpdateCenterList.vue @@ -10,7 +10,7 @@
; + apps: App[]; }>(); defineEmits<{ @@ -47,6 +49,23 @@ defineEmits<{ (e: "unignore-item", packageName: string, newVersion: string): void; }>(); +// 从商店目录 apps 的 update 字段(app.json 的 Update,如 "2026-08-08") +// 推算更新发布时间,补全到更新列表项,用于显示「X天前」。匹配不到则保留原值(降级为「—」)。 +const enrichedItems = computed(() => { + const updateByPkg = new Map(); + for (const app of props.apps) { + if (app.pkgname && app.update) { + const t = Date.parse(app.update); + if (!Number.isNaN(t)) updateByPkg.set(app.pkgname, t); + } + } + return props.items.map((item) => { + if (item.updateTime && !Number.isNaN(item.updateTime)) return item; + const t = updateByPkg.get(item.packageName); + return t ? { ...item, updateTime: t } : item; + }); +}); + const taskMap = computed(() => { return new Map(props.tasks.map((task) => [task.taskKey, task])); }); diff --git a/src/global/typedefinition.ts b/src/global/typedefinition.ts index b5435bce..ae46fd0e 100644 --- a/src/global/typedefinition.ts +++ b/src/global/typedefinition.ts @@ -156,6 +156,8 @@ export interface UpdateCenterItem { migrationSource?: UpdateSource; migrationTarget?: UpdateSource; aptssVersion?: string; + // 更新发布时间(毫秒时间戳),用于列表显示「X天前」;暂无数据时前端降级为「—」 + updateTime?: number; } export interface UpdateCenterTaskState { diff --git a/src/modules/updateCenter.ts b/src/modules/updateCenter.ts index c26d7cce..172b7a1a 100644 --- a/src/modules/updateCenter.ts +++ b/src/modules/updateCenter.ts @@ -90,7 +90,14 @@ export const createUpdateCenterStore = (): UpdateCenterStore => { const filteredItems = computed(() => { const query = searchQuery.value.trim(); - return snapshot.value.items.filter((item) => matchesSearch(item, query)); + const matched = snapshot.value.items.filter((item) => + matchesSearch(item, query), + ); + // 已忽略项沉底:非忽略在前、已忽略在后,各自保持原有顺序 + return [ + ...matched.filter((item) => item.ignored !== true), + ...matched.filter((item) => item.ignored === true), + ]; }); const allSelected = computed(() => {