diff --git a/src/App.vue b/src/App.vue
index eceff507..87b54a35 100644
--- a/src/App.vue
+++ b/src/App.vue
@@ -42,7 +42,7 @@
-
diff --git a/src/components/AppGrid.vue b/src/components/AppGrid.vue
index 14934a7f..4c4a5f93 100644
--- a/src/components/AppGrid.vue
+++ b/src/components/AppGrid.vue
@@ -14,20 +14,16 @@
-
diff --git a/src/components/AppHeader.vue b/src/components/AppHeader.vue
index 191ce194..8d061d87 100644
--- a/src/components/AppHeader.vue
+++ b/src/components/AppHeader.vue
@@ -18,28 +18,26 @@
-
diff --git a/src/components/DownloadDetail.vue b/src/components/DownloadDetail.vue
index 700809fb..a89d3839 100644
--- a/src/components/DownloadDetail.vue
+++ b/src/components/DownloadDetail.vue
@@ -120,21 +120,23 @@
-
diff --git a/src/components/InstalledAppsModal.vue b/src/components/InstalledAppsModal.vue
index ead25526..c38ab248 100644
--- a/src/components/InstalledAppsModal.vue
+++ b/src/components/InstalledAppsModal.vue
@@ -73,28 +73,20 @@
-
diff --git a/src/components/ScreenPreview.vue b/src/components/ScreenPreview.vue
index 1c24bfd0..377aaf2b 100644
--- a/src/components/ScreenPreview.vue
+++ b/src/components/ScreenPreview.vue
@@ -35,25 +35,20 @@
-
diff --git a/src/global/downloadStatus.ts b/src/global/downloadStatus.ts
index f4c5ec9f..6f1316be 100644
--- a/src/global/downloadStatus.ts
+++ b/src/global/downloadStatus.ts
@@ -1,4 +1,4 @@
import { ref } from "vue";
-import { DownloadItem } from './typedefinition';
+import type { DownloadItem } from './typedefinition';
-export const downloads = ref([]);
+export const downloads = ref([]);
diff --git a/src/global/storeConfig.ts b/src/global/storeConfig.ts
index a606e1b5..40cde344 100644
--- a/src/global/storeConfig.ts
+++ b/src/global/storeConfig.ts
@@ -1,7 +1,8 @@
import { ref } from "vue";
+import type { App } from "./typedefinition";
-export const APM_STORE_BASE_URL=import.meta.env.VITE_APM_STORE_BASE_URL;
+export const APM_STORE_BASE_URL: string = import.meta.env.VITE_APM_STORE_BASE_URL || '';
// 下面的变量用于存储当前应用的信息,其实用在多个组件中
-export const currentApp = ref(null);
+export const currentApp = ref(null);
export const currentAppIsInstalled = ref(false);
diff --git a/src/global/typedefinition.ts b/src/global/typedefinition.ts
index 05e340e7..025401b3 100644
--- a/src/global/typedefinition.ts
+++ b/src/global/typedefinition.ts
@@ -17,13 +17,14 @@ export interface DownloadItem {
pkgname: string;
version: string;
icon: string;
- status: 'installing' | 'paused' | 'completed' | 'failed' | 'queued'; // 可根据实际状态扩展
+ status: 'downloading' | 'installing' | 'paused' | 'completed' | 'failed' | 'queued'; // 可根据实际状态扩展
progress: number; // 0 ~ 100 的百分比,或 0 ~ 1 的小数(建议统一)
downloadedSize: number; // 已下载字节数
totalSize: number; // 总字节数(可能为 0 初始时)
speed: number; // 当前下载速度,单位如 B/s
timeRemaining: number; // 剩余时间(秒),0 表示未知
startTime: number; // Date.now() 返回的时间戳(毫秒)
+ endTime?: number; // 下载完成时间戳(毫秒),可选
logs: Array<{
time: number; // 日志时间戳
message: string; // 日志消息
@@ -31,4 +32,66 @@ export interface DownloadItem {
source: string; // 例如 'APM Store'
retry: boolean; // 当前是否为重试下载
upgradeOnly?: boolean; // 是否为仅升级任务
-}
\ No newline at end of file
+ error?: string;
+}
+
+/*
+ "Name": "Visual Studio Code(vscode)",
+ "Version": "1.108.2-1769004815",
+ "Filename": "code_1.108.2-1769004815_amd64.deb",
+ "Torrent_address": "code_1.108.2-1769004815_amd64.deb.torrent",
+ "Pkgname": "code",
+ "Author": "shenmo",
+ "Contributor": "shenmo",
+ "Website": "https://code.visualstudio.com/",
+ "Update": "2026-01-26 17:34:15",
+ "Size": "110M",
+ "More": "VSCode是一款非常牛逼的编辑器",
+ "Tags": "community;ubuntu;deepin;uos;debian",
+ "img_urls": "[\"https://cdn.d.store.deepinos.org.cn/store/development/code/screen_1.png\",\"https://cdn.d.store.deepinos.org.cn/store/development/code/screen_2.png\",\"https://cdn.d.store.deepinos.org.cn/store/development/code/screen_3.png\",\"https://cdn.d.store.deepinos.org.cn/store/development/code/screen_4.png\",\"https://cdn.d.store.deepinos.org.cn/store/development/code/screen_5.png\"]",
+ "icons": "https://cdn.d.store.deepinos.org.cn/store/development/code/icon.png"
+ */
+export interface AppJson {
+ // 原始数据
+ Name: string;
+ Version: string;
+ Filename: string;
+ Torrent_address: string;
+ Pkgname: string;
+ Author: string;
+ Contributor: string;
+ Website: string;
+ Update: string;
+ Size: string;
+ More: string;
+ Tags: string;
+ img_urls: string; // 注意:部分 json 里可能是字符串形式的数组
+ icons: string;
+}
+
+export interface App {
+ name: string;
+ pkgname: string;
+ version: string;
+ filename: string;
+ torrent_address: string;
+ author: string;
+ contributor: string;
+ website: string;
+ update: string;
+ size: string;
+ more: string;
+ tags: string;
+ img_urls: string[];
+ icons: string;
+ category: string; // Frontend added
+ installed?: boolean; // Frontend state
+}
+
+export interface UpdateAppItem {
+ pkgname: string;
+ currentVersion?: string;
+ newVersion?: string;
+ selected?: boolean;
+ upgrading?: boolean;
+}
diff --git a/src/modeuls/processInstall.ts b/src/modeuls/processInstall.ts
index 574469c9..145b8e3d 100644
--- a/src/modeuls/processInstall.ts
+++ b/src/modeuls/processInstall.ts
@@ -6,21 +6,21 @@ import { currentApp, currentAppIsInstalled } from "../global/storeConfig";
import { APM_STORE_BASE_URL } from "../global/storeConfig";
import { downloads } from "../global/downloadStatus";
-import { InstallLog, DownloadItem, DownloadResult } from '../global/typedefinition';
+import { InstallLog, DownloadItem, DownloadResult, App } from '../global/typedefinition';
let downloadIdCounter = 0;
export const handleInstall = () => {
- if (!currentApp.value?.Pkgname) return;
+ if (!currentApp.value?.pkgname) return;
downloadIdCounter += 1;
// 创建下载任务
const download: DownloadItem = {
id: downloadIdCounter,
- name: currentApp.value.Name,
- pkgname: currentApp.value.Pkgname,
- version: currentApp.value.Version,
- icon: `${APM_STORE_BASE_URL}/${window.apm_store.arch}/${currentApp.value._category}/${currentApp.value.Pkgname}/icon.png`,
+ name: currentApp.value.name,
+ pkgname: currentApp.value.pkgname,
+ version: currentApp.value.version,
+ icon: `${APM_STORE_BASE_URL}/${window.apm_store.arch}/${currentApp.value.category}/${currentApp.value.pkgname}/icon.png`,
status: 'queued',
progress: 0,
downloadedSize: 0,
@@ -53,16 +53,16 @@ export const handleRetry = (download_: DownloadItem) => {
window.ipcRenderer.send('queue-install', JSON.stringify(download_));
};
-export const handleUpgrade = (pkg: any) => {
- if (!pkg.Pkgname) return;
+export const handleUpgrade = (app: App) => {
+ if (!app.pkgname) return;
downloadIdCounter += 1;
const download: DownloadItem = {
id: downloadIdCounter,
- name: pkg.Name,
- pkgname: pkg.Pkgname,
- version: pkg.Version,
- icon: `${APM_STORE_BASE_URL}/${window.apm_store.arch}/${pkg._category}/${pkg.Pkgname}/icon.png`,
+ name: app.name,
+ pkgname: app.pkgname,
+ version: app.version,
+ icon: `${APM_STORE_BASE_URL}/${window.apm_store.arch}/${app.category}/${app.pkgname}/icon.png`,
status: 'queued',
progress: 0,
downloadedSize: 0,
@@ -83,8 +83,8 @@ export const handleUpgrade = (pkg: any) => {
};
export const handleRemove = () => {
- if (!currentApp.value?.Pkgname) return;
- window.ipcRenderer.send('remove-installed', currentApp.value.Pkgname);
+ if (!currentApp.value?.pkgname) return;
+ window.ipcRenderer.send('remove-installed', currentApp.value.pkgname);
}
window.ipcRenderer.on('remove-complete', (_event, log: DownloadResult) => {
@@ -97,22 +97,24 @@ window.ipcRenderer.on('remove-complete', (_event, log: DownloadResult) => {
});
window.ipcRenderer.on('install-status', (_event, log: InstallLog) => {
- const downloadObj: any = downloads.value.find(d => d.id === log.id);
- downloadObj.status = log.message;
+ const downloadObj = downloads.value.find(d => d.id === log.id);
+ if(downloadObj) downloadObj.status = log.message as any;
});
window.ipcRenderer.on('install-log', (_event, log: InstallLog) => {
- const downloadObj: any = downloads.value.find(d => d.id === log.id);
- downloadObj.logs.push({
+ const downloadObj = downloads.value.find(d => d.id === log.id);
+ if(downloadObj) downloadObj.logs.push({
time: log.time,
message: log.message
});
});
window.ipcRenderer.on('install-complete', (_event, log: DownloadResult) => {
- const downloadObj: any = downloads.value.find(d => d.id === log.id);
- if (log.success) {
- downloadObj.status = 'completed';
- } else {
- downloadObj.status = 'failed';
+ const downloadObj = downloads.value.find(d => d.id === log.id);
+ if (downloadObj) {
+ if (log.success) {
+ downloadObj.status = 'completed';
+ } else {
+ downloadObj.status = 'failed';
+ }
}
});