mirror of
https://github.com/ThaUnknown/miru.git
synced 2026-04-07 12:29:24 +00:00
fix: make account related buttons disabled when not signed in fix: improve DTS exclusions fix: softlock on navigation in androidTV
43 lines
1.1 KiB
JavaScript
43 lines
1.1 KiB
JavaScript
import { autoUpdater } from 'electron-updater'
|
|
import { ipcMain, shell } from 'electron'
|
|
|
|
ipcMain.on('update', () => {
|
|
autoUpdater.checkForUpdatesAndNotify()
|
|
})
|
|
|
|
autoUpdater.checkForUpdatesAndNotify()
|
|
export default class Updater {
|
|
hasUpdate = false
|
|
window
|
|
torrentWindow
|
|
/**
|
|
* @param {import('electron').BrowserWindow} window
|
|
* @param {import('electron').BrowserWindow} torrentWindow
|
|
*/
|
|
constructor (window, torrentWindow) {
|
|
this.window = window
|
|
this.torrentWindow = torrentWindow
|
|
autoUpdater.on('update-available', () => {
|
|
window.webContents.send('update-available', true)
|
|
})
|
|
autoUpdater.on('update-downloaded', () => {
|
|
this.hasUpdate = true
|
|
window.webContents.send('update-downloaded', true)
|
|
})
|
|
}
|
|
|
|
install (forceRunAfter = false) {
|
|
if (this.hasUpdate) {
|
|
setImmediate(() => {
|
|
try {
|
|
this.window.close()
|
|
this.torrentWindow.close()
|
|
} catch (e) {}
|
|
autoUpdater.quitAndInstall(true, forceRunAfter)
|
|
})
|
|
if (process.platform === 'darwin') shell.openExternal('https://miru.watch/download')
|
|
this.hasUpdate = false
|
|
return true
|
|
}
|
|
}
|
|
}
|