mirror of
https://github.com/dream-pep/koring-launcher.git
synced 2026-09-12 05:45:18 +08:00
feat(runtime-notice): 添加 Linux 非 AppImage 运行时警告提示
- 新增 onRuntimeNotice IPC 接口与预加载桥接代码 - 在主进程添加 Linux 环境检查,未使用 AppImage 运行的打包版会提示更新组件可能受影响 - 新建 RuntimeNotices 组件处理并展示去重的持久化警告弹窗 - 将该组件注册到根布局中自动挂载 - 添加项目的 Git 提交信息规范文件
This commit is contained in:
@@ -190,6 +190,13 @@ function createMainWindow(): electron.BrowserWindow {
|
||||
main.webContents.on('did-finish-load', () => {
|
||||
if (main.isDestroyed()) return;
|
||||
main.webContents.send('config:preload', { config: getConfig(), isFirstLaunch: isFirstLaunchFlag });
|
||||
// Linux 打包但并非以 AppImage 方式运行(无 APPIMAGE 环境变量)→ 提示影响更新组件
|
||||
if (app.isPackaged && process.platform === 'linux' && !process.env.APPIMAGE) {
|
||||
main.webContents.send('runtime:notice', {
|
||||
kind: 'linux-appimage-unpacked',
|
||||
message: '您并未解包安装,这可能会影响更新组件的运行',
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
main.on('maximize', () => {
|
||||
|
||||
@@ -53,6 +53,13 @@ contextBridge.exposeInMainWorld('electronAPI', {
|
||||
return () => ipcRenderer.removeListener('config:changed', handler);
|
||||
},
|
||||
|
||||
// 主进程运行时提示(如 Linux 未以 AppImage 方式运行,影响更新组件)
|
||||
onRuntimeNotice: (callback: (notice: { kind: string; message: string }) => void) => {
|
||||
const handler = (_event: Electron.IpcRendererEvent, notice: { kind: string; message: string }) => callback(notice);
|
||||
ipcRenderer.on('runtime:notice', handler);
|
||||
return () => ipcRenderer.removeListener('runtime:notice', handler);
|
||||
},
|
||||
|
||||
// 背景图 — 选择本地图片:主进程复制到 userData、按窗口尺寸优化并落盘,
|
||||
// 返回【文件路径】(配置/Store 以路径保存,不使用 BASE64)。
|
||||
pickBackgroundImage: async (): Promise<string | null> => {
|
||||
|
||||
Reference in New Issue
Block a user