Update Auto-Updator (#368)

* Update .gitignore

* Add Update Cider Branch selection

* Add circle-ci API call

* More testing

* Maybe fix 'Update Cider' button

* Another debug log

* remove async in ipc 'check-for-update'

* remove everything except debug log

* semicolon

* revert to async and change ipc name

* more semicolon

* Extract BaseURL from circleci API response

* Fix compile error + rename ipc back to 'check-for-update'

* Remove debug log

* Update i18n files with new 'updateCider' term location

* Update en_OWO.json

* Fixed formatting in i18n files

* Fix formatting elsewhere

* Move 'Update Cider' i18n stuff from 'experimental' to 'general'

* Do that thing @quacksire wanted me to do. 'for vue'

* Fix bad merge

* Revert Formatting. 

DO NOT OPEN IN AN AUTOFORMATTING IDE. USE VSCODE WEB/CODESPACES IF YOU NEED TO ACTUALLY CHANGE SOMETHING IN THE RENDERER

Co-authored-by: Quacksire <19170969+quacksire@users.noreply.github.com>
This commit is contained in:
GamingLiamStudios 2022-02-08 11:38:33 +11:00 committed by GitHub
parent 0c655563e7
commit c0d6481300
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
18 changed files with 865 additions and 725 deletions

View file

@ -529,18 +529,18 @@ export class BrowserWindow {
MusicKit.getInstance().play();
});
`)
})
});
//QR Code
ipcMain.handle('showQR', async (_event, _) => {
let url = `http://${BrowserWindow.getIP()}:${this.remotePort}`;
shell.openExternal(`https://cider.sh/pair-remote?url=${Buffer.from(encodeURI(url)).toString('base64')}`).catch(console.error);
})
});
ipcMain.on('get-remote-pair-url', (_event, _) => {
let url = `http://${BrowserWindow.getIP()}:${this.remotePort}`;
BrowserWindow.win.webContents.send('send-remote-pair-url', url);
})
});
if (process.platform === "darwin") {
app.setUserActivity('com.CiderCollective.remote.pair', {
ip: `${BrowserWindow.getIP()}`
@ -557,14 +557,25 @@ export class BrowserWindow {
console.log('sc', SoundCheckTag)
BrowserWindow.win.webContents.send('SoundCheckTag', SoundCheckTag)
}).catch(err => {
console.log(err)
});
console.log(err)
});
});
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.substr(0, base_url.lastIndexOf('/'))
const options: any = {
provider: 'generic',
url: 'https://43-429851205-gh.circle-artifacts.com/0/%7E/Cider/dist/artifacts' //Base URL
url: `${base_url}`
}
/*
* Have to handle the auto updaters seperatly until we can support macOS. electron-builder limitation -q
@ -573,7 +584,7 @@ export class BrowserWindow {
const linux_autoUpdater = new AppImageUpdater(options) //Linux
await win_autoUpdater.checkForUpdatesAndNotify()
await linux_autoUpdater.checkForUpdatesAndNotify()
})
});
ipcMain.on('share-menu', async (_event, url) => {
if (process.platform != 'darwin') return;