feat: 通过 IPC 实现应用版本号获取功能

移除预加载脚本中的版本号获取逻辑,改为通过 IPC 从主进程获取
This commit is contained in:
2026-03-24 20:58:15 +08:00
parent 7b71522afb
commit 308f5b7ce6
4 changed files with 16 additions and 14 deletions

View File

@@ -105,6 +105,8 @@ ipcMain.handle("get-store-filter", (): "spark" | "apm" | "both" =>
getStoreFilterFromArgv(),
);
ipcMain.handle("get-app-version", (): string => getAppVersion());
async function createWindow() {
win = new BrowserWindow({
title: "星火应用商店",

View File

@@ -36,15 +36,6 @@ contextBridge.exposeInMainWorld("apm_store", {
return arch;
}
})(),
version: (() => {
// 从 package.json 读取版本号
try {
const pkg = require("../../package.json");
return pkg.version || "unknown";
} catch {
return "unknown";
}
})(),
});
// --------- Preload scripts loading ---------