mirror of
https://gitee.com/spark-store-project/spark-store
synced 2026-04-26 01:10:16 +08:00
feat(preload): expose architecture detection to renderer process
add multiarch support
This commit is contained in:
@@ -56,7 +56,7 @@ import DownloadDetail from './components/DownloadDetail.vue';
|
||||
import InstalledAppsModal from './components/InstalledAppsModal.vue';
|
||||
import UpdateAppsModal from './components/UpdateAppsModal.vue';
|
||||
import UninstallConfirmModal from './components/UninstallConfirmModal.vue';
|
||||
import { APM_STORE_ARCHITECTURE, APM_STORE_BASE_URL, currentApp, currentAppIsInstalled } from './global/storeConfig';
|
||||
import { APM_STORE_BASE_URL, currentApp, currentAppIsInstalled } from './global/storeConfig';
|
||||
import { downloads } from './global/downloadStatus';
|
||||
import { handleInstall, handleRetry, handleUpgrade } from './modeuls/processInstall';
|
||||
|
||||
@@ -173,7 +173,7 @@ const checkAppInstalled = (app) => {
|
||||
const loadScreenshots = (app) => {
|
||||
screenshots.value = [];
|
||||
for (let i = 1; i <= 5; i++) {
|
||||
const screenshotUrl = `${APM_STORE_BASE_URL}/${APM_STORE_ARCHITECTURE}/${app._category}/${app.Pkgname}/screen_${i}.png`;
|
||||
const screenshotUrl = `${APM_STORE_BASE_URL}/${window.apm_store.arch}/${app._category}/${app.Pkgname}/screen_${i}.png`;
|
||||
const img = new Image();
|
||||
img.src = screenshotUrl;
|
||||
img.onload = () => {
|
||||
@@ -480,7 +480,7 @@ const openDownloadedApp = (download) => {
|
||||
|
||||
const loadCategories = async () => {
|
||||
try {
|
||||
const response = await axiosInstance.get(`/${APM_STORE_ARCHITECTURE}/categories.json`);
|
||||
const response = await axiosInstance.get(`/${window.apm_store.arch}/categories.json`);
|
||||
categories.value = response.data;
|
||||
} catch (error) {
|
||||
logger.error('读取 categories.json 失败', error);
|
||||
@@ -493,7 +493,7 @@ const loadApps = async () => {
|
||||
logger.info('开始加载应用数据...');
|
||||
const promises = Object.keys(categories.value).map(async category => {
|
||||
try {
|
||||
const response = await axiosInstance.get(`/${APM_STORE_ARCHITECTURE}/${category}/applist.json`);
|
||||
const response = await axiosInstance.get(`/${window.apm_store.arch}/${category}/applist.json`);
|
||||
return response.status === 200 ? response.data : [];
|
||||
} catch {
|
||||
return [];
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
<script setup>
|
||||
import { computed, defineProps, defineEmits, onMounted, onBeforeUnmount, ref, watch } from 'vue';
|
||||
import { APM_STORE_ARCHITECTURE, APM_STORE_BASE_URL } from '../global/storeConfig';
|
||||
import { APM_STORE_BASE_URL } from '../global/storeConfig';
|
||||
|
||||
const props = defineProps({
|
||||
app: {
|
||||
@@ -32,7 +32,7 @@ const isLoaded = ref(false);
|
||||
const loadedIcon = ref('data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"%3E%3Crect fill="%23f0f0f0" width="100" height="100"/%3E%3C/svg%3E');
|
||||
|
||||
const iconPath = computed(() => {
|
||||
return `${APM_STORE_BASE_URL}/${APM_STORE_ARCHITECTURE}/${props.app._category}/${props.app.Pkgname}/icon.png`;
|
||||
return `${APM_STORE_BASE_URL}/${window.apm_store.arch}/${props.app._category}/${props.app.Pkgname}/icon.png`;
|
||||
});
|
||||
|
||||
const description = computed(() => {
|
||||
|
||||
@@ -102,7 +102,7 @@
|
||||
|
||||
<script setup>
|
||||
import { computed, defineProps, defineEmits, useAttrs, ref } from 'vue';
|
||||
import { APM_STORE_ARCHITECTURE, APM_STORE_BASE_URL } from '../global/storeConfig';
|
||||
import { APM_STORE_BASE_URL } from '../global/storeConfig';
|
||||
|
||||
defineOptions({ inheritAttrs: false });
|
||||
|
||||
@@ -130,7 +130,7 @@ const props = defineProps({
|
||||
const emit = defineEmits(['close', 'install', 'remove', 'open-preview']);
|
||||
|
||||
const iconPath = computed(() => {
|
||||
return props.app ? `${APM_STORE_BASE_URL}/${APM_STORE_ARCHITECTURE}/${props.app._category}/${props.app.Pkgname}/icon.png` : '';
|
||||
return props.app ? `${APM_STORE_BASE_URL}/${window.apm_store.arch}/${props.app._category}/${props.app.Pkgname}/icon.png` : '';
|
||||
});
|
||||
|
||||
const closeModal = () => {
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<img :src="amberLogo" alt="Amber PM" class="h-11 w-11 rounded-2xl bg-white/70 p-2 shadow-sm ring-1 ring-slate-900/5 dark:bg-slate-800" />
|
||||
<div class="flex flex-col">
|
||||
<span class="text-xs uppercase tracking-[0.3em] text-slate-500 dark:text-slate-400">APM Store</span>
|
||||
<span class="text-lg font-semibold text-slate-900 dark:text-white">APM x86 客户端商店</span>
|
||||
<span class="text-lg font-semibold text-slate-900 dark:text-white">APM 客户端商店</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
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);
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
// })
|
||||
|
||||
import { currentApp, currentAppIsInstalled } from "../global/storeConfig";
|
||||
import { APM_STORE_BASE_URL, APM_STORE_ARCHITECTURE } from "../global/storeConfig";
|
||||
import { APM_STORE_BASE_URL } from "../global/storeConfig";
|
||||
import { downloads } from "../global/downloadStatus";
|
||||
|
||||
import { InstallLog, DownloadItem, DownloadResult } from '../global/typedefinition';
|
||||
@@ -20,7 +20,7 @@ export const handleInstall = () => {
|
||||
name: currentApp.value.Name,
|
||||
pkgname: currentApp.value.Pkgname,
|
||||
version: currentApp.value.Version,
|
||||
icon: `${APM_STORE_BASE_URL}/${APM_STORE_ARCHITECTURE}/${currentApp.value._category}/${currentApp.value.Pkgname}/icon.png`,
|
||||
icon: `${APM_STORE_BASE_URL}/${APM_STORE_ARCHITECTURE()}/${currentApp.value._category}/${currentApp.value.Pkgname}/icon.png`,
|
||||
status: 'queued',
|
||||
progress: 0,
|
||||
downloadedSize: 0,
|
||||
@@ -62,7 +62,7 @@ export const handleUpgrade = (pkg: any) => {
|
||||
name: pkg.Name,
|
||||
pkgname: pkg.Pkgname,
|
||||
version: pkg.Version,
|
||||
icon: `${APM_STORE_BASE_URL}/${APM_STORE_ARCHITECTURE}/${pkg._category}/${pkg.Pkgname}/icon.png`,
|
||||
icon: `${APM_STORE_BASE_URL}/${window.apm_store.arch}/${pkg._category}/${pkg.Pkgname}/icon.png`,
|
||||
status: 'queued',
|
||||
progress: 0,
|
||||
downloadedSize: 0,
|
||||
|
||||
Reference in New Issue
Block a user