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()
|
app.quit()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
require('./updater.js').configUpdater(app, autoUpdater, dialog, logger, showNotification)
|
|
||||||
|
|
||||||
const minecraft = require('./minecraft.js')
|
const minecraft = require('./minecraft.js')
|
||||||
minecraft.showNotification = showNotification
|
minecraft.showNotification = showNotification
|
||||||
|
|
||||||
@ -27,7 +25,9 @@ function createWindow () {
|
|||||||
frame: false
|
frame: false
|
||||||
})
|
})
|
||||||
Menu.setApplicationMenu(null)
|
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", () => {
|
win.on("close", () => {
|
||||||
app.quit()
|
app.quit()
|
||||||
})
|
})
|
||||||
@ -35,10 +35,9 @@ function createWindow () {
|
|||||||
|
|
||||||
const { setWindow, minimizeWindow, closeWindow } = require("./menubar.js");
|
const { setWindow, minimizeWindow, closeWindow } = require("./menubar.js");
|
||||||
|
|
||||||
setWindow(win)
|
|
||||||
|
|
||||||
app.whenReady().then(() => {
|
app.whenReady().then(() => {
|
||||||
createWindow()
|
createWindow()
|
||||||
|
setWindow(win)
|
||||||
})
|
})
|
||||||
|
|
||||||
app.on('window-all-closed', () => {
|
app.on('window-all-closed', () => {
|
||||||
|
@ -2,13 +2,6 @@ const isDev = require('electron-is-dev')
|
|||||||
const pkg = require('../../package.json')
|
const pkg = require('../../package.json')
|
||||||
const server = 'https://update.electronjs.org'
|
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) {
|
function configUpdater(app, autoUpdater, dialog, logger, showNotification) {
|
||||||
logger.info(`electron version: ${process.versions['electron']}`)
|
logger.info(`electron version: ${process.versions['electron']}`)
|
||||||
logger.info(`chrome version: ${process.versions['chrome']}`)
|
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()}`
|
const feed = `${server}/${pkg.repository}/${process.platform}-${process.arch}/${app.getVersion()}`
|
||||||
autoUpdater.setFeedURL(feed)
|
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 = {
|
const dialogOpts = {
|
||||||
type: 'info',
|
type: 'info',
|
||||||
buttons: ['Rédémarrer', 'Plus tard'],
|
buttons: ['Rédémarrer', 'Plus tard'],
|
||||||
|
Loading…
Reference in New Issue
Block a user