feat: add download and install update functionality in IPC
Some checks failed
Build / increment-version (push) Successful in 6s
Build / build-linux (push) Failing after 51s
Build / build-windows (push) Failing after 2m11s
Build / create-release (push) Has been skipped
Build Paarrot Windows / start-vm (push) Failing after 5m34s
Build Paarrot Windows / build (push) Has been skipped

This commit is contained in:
2026-03-25 06:56:13 +11:00
parent abc5ad66be
commit 90a0dad0ec
3 changed files with 17 additions and 6 deletions

2
cinny

Submodule cinny updated: 9d744ff3cc...05e5ac71b7

View File

@@ -934,6 +934,21 @@ ipcMain.handle('install-update', () => {
return { success: true }; return { success: true };
}); });
ipcMain.handle('download-and-install-update', async () => {
if (isDev) {
return { success: false, error: 'Updates are not available in development mode' };
}
try {
const result = await downloadGiteaUpdate();
if (!result.opened) {
installGiteaUpdate();
}
return { success: true, data: result };
} catch (error) {
return { success: false, error: error.message };
}
});
// Screen capture / desktopCapturer handler // Screen capture / desktopCapturer handler
ipcMain.handle('get-desktop-sources', async (event, opts) => { ipcMain.handle('get-desktop-sources', async (event, opts) => {
try { try {

View File

@@ -127,17 +127,13 @@ contextBridge.exposeInMainWorld('electron', {
// Auto-updater // Auto-updater
updater: { updater: {
checkForUpdates: () => ipcRenderer.invoke('check-for-updates'), checkForUpdates: () => ipcRenderer.invoke('check-for-updates'),
downloadUpdate: () => ipcRenderer.invoke('download-update'), downloadAndInstallUpdate: () => ipcRenderer.invoke('download-and-install-update'),
installUpdate: () => ipcRenderer.invoke('install-update'),
onUpdateAvailable: (callback) => { onUpdateAvailable: (callback) => {
ipcRenderer.on('update-available', (_, info) => callback(info)); ipcRenderer.on('update-available', (_, info) => callback(info));
}, },
onUpdateDownloadProgress: (callback) => { onUpdateDownloadProgress: (callback) => {
ipcRenderer.on('update-download-progress', (_, progress) => callback(progress)); ipcRenderer.on('update-download-progress', (_, progress) => callback(progress));
}, },
onUpdateDownloaded: (callback) => {
ipcRenderer.on('update-downloaded', (_, info) => callback(info));
}
}, },
// Desktop capturer (for screen sharing) // Desktop capturer (for screen sharing)