feat(install): added basis install process

Now it is able to install apps from the render process and properly display logs on the app detial page.
This commit is contained in:
Elysia
2026-01-25 22:30:39 +08:00
parent 22435a5e1b
commit 50fb1a0065
15 changed files with 318 additions and 69 deletions

View File

@@ -1,2 +0,0 @@
export const APM_STORE_BASE_URL=import.meta.env.VITE_APM_STORE_BASE_URL;
export const APM_STORE_ARCHITECTURE='amd64-apm';

View File

@@ -0,0 +1,4 @@
import { ref } from "vue";
import { DownloadItem } from './typedefinition';
export const downloads = ref(<DownloadItem[]>[]);

View File

@@ -0,0 +1,5 @@
import { ref } from "vue";
export const APM_STORE_BASE_URL=import.meta.env.VITE_APM_STORE_BASE_URL;
export const APM_STORE_ARCHITECTURE='amd64-apm';
export const currentApp = ref<any>(null);

View File

@@ -0,0 +1,32 @@
export interface InstallLog {
id: number;
success: boolean;
time: number;
exitCode: number | null;
message: string;
}
export interface DownloadResult extends InstallLog {
success: boolean;
exitCode: number | null;
}
export interface DownloadItem {
id: number;
name: string;
pkgname: string;
version: string;
icon: string;
status: '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() 返回的时间戳(毫秒)
logs: Array<{
time: number; // 日志时间戳
message: string; // 日志消息
}>;
source: string; // 例如 'APM Store'
}