mirror of
https://gitee.com/spark-store-project/spark-store
synced 2026-04-26 01:10:16 +08:00
feat: 仅保留混合模式并根据架构动态构建请求路径
- 删除 AppSidebar.vue 中的 StoreModeSwitcher 引入并删除该组件。 - 强制设置当前商店模式为 'hybrid'。 - 修复了因为 `window.apm_store.arch` 包含 `-store` 或 `-apm` 后缀导致路径替换异常的问题,现在会通过动态添加后缀来构建资源请求路径,以兼容 Spark Store 和 APM Store 服务器不同的资源组织结构。
This commit is contained in:
@@ -428,14 +428,23 @@ ipcMain.handle("check-installed", async (_event, payload: any) => {
|
||||
let isInstalled = false;
|
||||
|
||||
if (origin === "apm") {
|
||||
const { code, stdout } = await runCommandCapture("apm", ["list", "--installed"]);
|
||||
const { code, stdout } = await runCommandCapture("apm", [
|
||||
"list",
|
||||
"--installed",
|
||||
]);
|
||||
if (code === 0) {
|
||||
// eslint-disable-next-line no-control-regex
|
||||
const cleanStdout = stdout.replace(/\x1b\[[0-9;]*m/g, "");
|
||||
const lines = cleanStdout.split("\n");
|
||||
for (const line of lines) {
|
||||
const trimmed = line.trim();
|
||||
if (!trimmed || trimmed.startsWith("Listing") || trimmed.startsWith("[INFO]") || trimmed.startsWith("警告")) continue;
|
||||
if (
|
||||
!trimmed ||
|
||||
trimmed.startsWith("Listing") ||
|
||||
trimmed.startsWith("[INFO]") ||
|
||||
trimmed.startsWith("警告")
|
||||
)
|
||||
continue;
|
||||
if (trimmed.includes("/")) {
|
||||
const installedPkg = trimmed.split("/")[0].trim();
|
||||
if (installedPkg === pkgname) {
|
||||
|
||||
@@ -29,9 +29,11 @@ contextBridge.exposeInMainWorld("apm_store", {
|
||||
arch: (() => {
|
||||
const arch = process.arch;
|
||||
if (arch === "x64") {
|
||||
return "amd64" + "-store";
|
||||
return "amd64";
|
||||
} else if (arch === "arm64") {
|
||||
return "arm64";
|
||||
} else {
|
||||
return arch + "-store";
|
||||
return arch;
|
||||
}
|
||||
})(),
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user