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
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:
2
cinny
2
cinny
Submodule cinny updated: 9d744ff3cc...05e5ac71b7
@@ -934,6 +934,21 @@ ipcMain.handle('install-update', () => {
|
||||
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
|
||||
ipcMain.handle('get-desktop-sources', async (event, opts) => {
|
||||
try {
|
||||
|
||||
@@ -127,17 +127,13 @@ contextBridge.exposeInMainWorld('electron', {
|
||||
// Auto-updater
|
||||
updater: {
|
||||
checkForUpdates: () => ipcRenderer.invoke('check-for-updates'),
|
||||
downloadUpdate: () => ipcRenderer.invoke('download-update'),
|
||||
installUpdate: () => ipcRenderer.invoke('install-update'),
|
||||
downloadAndInstallUpdate: () => ipcRenderer.invoke('download-and-install-update'),
|
||||
onUpdateAvailable: (callback) => {
|
||||
ipcRenderer.on('update-available', (_, info) => callback(info));
|
||||
},
|
||||
onUpdateDownloadProgress: (callback) => {
|
||||
ipcRenderer.on('update-download-progress', (_, progress) => callback(progress));
|
||||
},
|
||||
onUpdateDownloaded: (callback) => {
|
||||
ipcRenderer.on('update-downloaded', (_, info) => callback(info));
|
||||
}
|
||||
},
|
||||
|
||||
// Desktop capturer (for screen sharing)
|
||||
|
||||
Reference in New Issue
Block a user