mirror of
https://github.com/hellodigua/ChatLab.git
synced 2026-05-16 19:39:11 +08:00
feat: 支持客户端更新
This commit is contained in:
@@ -6,6 +6,7 @@ import { ipcMain, app, dialog, clipboard, shell } from 'electron'
|
||||
import { autoUpdater } from 'electron-updater'
|
||||
import * as fs from 'fs/promises'
|
||||
import type { IpcContext } from './types'
|
||||
import { simulateUpdateDialog } from '../update'
|
||||
|
||||
/**
|
||||
* 注册窗口和文件系统操作 IPC 处理器
|
||||
@@ -53,11 +54,23 @@ export function registerWindowHandlers(ctx: IpcContext): void {
|
||||
win.webContents.openDevTools()
|
||||
})
|
||||
|
||||
// ==================== 应用信息 ====================
|
||||
ipcMain.handle('app:getVersion', () => {
|
||||
return app.getVersion()
|
||||
})
|
||||
|
||||
// ==================== 更新检查 ====================
|
||||
ipcMain.on('check-update', () => {
|
||||
autoUpdater.checkForUpdates()
|
||||
})
|
||||
|
||||
// 模拟更新弹窗(仅开发模式使用)
|
||||
ipcMain.on('simulate-update', () => {
|
||||
if (!app.isPackaged) {
|
||||
simulateUpdateDialog(win)
|
||||
}
|
||||
})
|
||||
|
||||
// ==================== 通用工具 ====================
|
||||
ipcMain.handle('show-message', (event, args) => {
|
||||
event.sender.send('show-message', args)
|
||||
|
||||
Reference in New Issue
Block a user