Update notifications

Removed the shit tone of check for updates, made it manual
Redone the function in utils
Logging for autoupdater implemented
This commit is contained in:
Core 2022-02-27 18:34:40 +00:00
parent a5e22d5f0d
commit 89e0d7c104
No known key found for this signature in database
GPG key ID: FE9BF1B547F8F3C6
6 changed files with 79 additions and 24 deletions

View file

@ -973,27 +973,9 @@ export class BrowserWindow {
});
ipcMain.on('check-for-update', async (_event) => {
const branch = utils.getStoreValue('general.update_branch')
let latestbranch = await fetch(`https://circleci.com/api/v1.1/project/gh/ciderapp/Cider/latest/artifacts?branch=${branch}&filter=successful`)
if (latestbranch.status != 200) {
console.log(`Error fetching latest artifact from the **${branch}** branch`)
return
}
let latestbranchjson = await latestbranch.json()
let base_url = latestbranchjson[0].url
base_url = base_url.substring(0, base_url.lastIndexOf('/'))
const options: any = {
provider: 'generic',
url: `${base_url}`,
allowDowngrade: true,
}
// Have to handle the auto updaters seperatly until we can support macOS. electron-builder limitation -q
if (process.platform === 'win32') await new NsisUpdater(options).checkForUpdatesAndNotify() //Windows
if (process.platform === 'linux') await new AppImageUpdater(options).checkForUpdatesAndNotify() //Linux
await utils.checkForUpdate();
});
ipcMain.on('disable-update', (event) => {
// Check if using app store builds so people don't get pissy wen button go bonk
if (app.isPackaged && !process.mas || !process.windowsStore) {