mirror of
https://github.com/AltarikMC/Launcher
synced 2024-11-22 06:19:50 +01:00
Improve updater
This commit is contained in:
parent
d6b48c5db7
commit
a0f67a4da3
@ -6,8 +6,6 @@ if (require('electron-squirrel-startup')) {
|
||||
app.quit()
|
||||
return
|
||||
}
|
||||
require('./updater.js').configUpdater(app, autoUpdater, dialog, logger, showNotification)
|
||||
|
||||
const minecraft = require('./minecraft.js')
|
||||
minecraft.showNotification = showNotification
|
||||
|
||||
@ -27,7 +25,9 @@ function createWindow () {
|
||||
frame: false
|
||||
})
|
||||
Menu.setApplicationMenu(null)
|
||||
win.loadFile('src/client/login.html')
|
||||
win.loadFile('src/client/login.html').then(() => {
|
||||
require('./updater.js').configUpdater(app, autoUpdater, dialog, logger, showNotification)
|
||||
})
|
||||
win.on("close", () => {
|
||||
app.quit()
|
||||
})
|
||||
@ -35,10 +35,9 @@ function createWindow () {
|
||||
|
||||
const { setWindow, minimizeWindow, closeWindow } = require("./menubar.js");
|
||||
|
||||
setWindow(win)
|
||||
|
||||
app.whenReady().then(() => {
|
||||
createWindow()
|
||||
setWindow(win)
|
||||
})
|
||||
|
||||
app.on('window-all-closed', () => {
|
||||
|
@ -2,13 +2,6 @@ const isDev = require('electron-is-dev')
|
||||
const pkg = require('../../package.json')
|
||||
const server = 'https://update.electronjs.org'
|
||||
|
||||
function initUpdater(autoUpdater) {
|
||||
autoUpdater.checkForUpdates()
|
||||
setInterval(() => {
|
||||
autoUpdater.checkForUpdates()
|
||||
}, 10 * 60 * 1000) // 10 minutes
|
||||
}
|
||||
|
||||
function configUpdater(app, autoUpdater, dialog, logger, showNotification) {
|
||||
logger.info(`electron version: ${process.versions['electron']}`)
|
||||
logger.info(`chrome version: ${process.versions['chrome']}`)
|
||||
@ -23,10 +16,10 @@ function configUpdater(app, autoUpdater, dialog, logger, showNotification) {
|
||||
|
||||
const feed = `${server}/${pkg.repository}/${process.platform}-${process.arch}/${app.getVersion()}`
|
||||
autoUpdater.setFeedURL(feed)
|
||||
app.isReady ? initUpdater(autoUpdater) : app.on("ready", () => initUpdater(autoUpdater))
|
||||
|
||||
logger.info("Checking for update...")
|
||||
autoUpdater.checkForUpdates()
|
||||
|
||||
autoUpdater.on('update-downloaded', (event, releaseNotes, releaseName) => {
|
||||
autoUpdater.on('update-downloaded', (_event, releaseNotes, releaseName) => {
|
||||
const dialogOpts = {
|
||||
type: 'info',
|
||||
buttons: ['Rédémarrer', 'Plus tard'],
|
||||
|
Loading…
Reference in New Issue
Block a user