mirror of
https://github.com/AltarikMC/Launcher
synced 2024-11-22 06:19:50 +01:00
added auto updater
This commit is contained in:
parent
1c09793e35
commit
c2a512883d
32
package-lock.json
generated
32
package-lock.json
generated
@ -1399,6 +1399,11 @@
|
|||||||
"extract-zip": "^1.0.3"
|
"extract-zip": "^1.0.3"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"electron-is-dev": {
|
||||||
|
"version": "0.3.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/electron-is-dev/-/electron-is-dev-0.3.0.tgz",
|
||||||
|
"integrity": "sha1-FOb9pcaOnk7L7/nM8DfL18BcWv4="
|
||||||
|
},
|
||||||
"electron-notarize": {
|
"electron-notarize": {
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/electron-notarize/-/electron-notarize-1.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/electron-notarize/-/electron-notarize-1.0.0.tgz",
|
||||||
@ -2293,6 +2298,14 @@
|
|||||||
"assert-plus": "^1.0.0"
|
"assert-plus": "^1.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"github-url-to-object": {
|
||||||
|
"version": "4.0.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/github-url-to-object/-/github-url-to-object-4.0.4.tgz",
|
||||||
|
"integrity": "sha512-1Ri1pR8XTfzLpbtPz5MlW/amGNdNReuExPsbF9rxLsBfO1GH9RtDBamhJikd0knMWq3RTTQDbTtw0GGvvEAJEA==",
|
||||||
|
"requires": {
|
||||||
|
"is-url": "^1.1.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"glob": {
|
"glob": {
|
||||||
"version": "7.1.6",
|
"version": "7.1.6",
|
||||||
"resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz",
|
"resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz",
|
||||||
@ -2624,6 +2637,11 @@
|
|||||||
"resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz",
|
||||||
"integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo="
|
"integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo="
|
||||||
},
|
},
|
||||||
|
"is-url": {
|
||||||
|
"version": "1.2.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/is-url/-/is-url-1.2.4.tgz",
|
||||||
|
"integrity": "sha512-ITvGim8FhRiYe4IQ5uHSkj7pVaPDrCTkNd3yq3cV7iZAcJdHTUMPMEHcqSOy9xZ9qFenQCvi+2wjH9a1nXqHww=="
|
||||||
|
},
|
||||||
"is-utf8": {
|
"is-utf8": {
|
||||||
"version": "0.2.1",
|
"version": "0.2.1",
|
||||||
"resolved": "https://registry.npmjs.org/is-utf8/-/is-utf8-0.2.1.tgz",
|
"resolved": "https://registry.npmjs.org/is-utf8/-/is-utf8-0.2.1.tgz",
|
||||||
@ -3073,8 +3091,7 @@
|
|||||||
"ms": {
|
"ms": {
|
||||||
"version": "2.1.2",
|
"version": "2.1.2",
|
||||||
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
|
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
|
||||||
"integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==",
|
"integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w=="
|
||||||
"dev": true
|
|
||||||
},
|
},
|
||||||
"mute-stream": {
|
"mute-stream": {
|
||||||
"version": "0.0.8",
|
"version": "0.0.8",
|
||||||
@ -4503,6 +4520,17 @@
|
|||||||
"integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==",
|
"integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
"update-electron-app": {
|
||||||
|
"version": "2.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/update-electron-app/-/update-electron-app-2.0.1.tgz",
|
||||||
|
"integrity": "sha512-e4xEner89UZZaBGYJbYlMdL1uUrC0VjOsTAL2N4opPjzFtn+j7mdsJJsnyXZzUVeLY+8tuCX4XEsUM98oBHmZg==",
|
||||||
|
"requires": {
|
||||||
|
"electron-is-dev": "^0.3.0",
|
||||||
|
"github-url-to-object": "^4.0.4",
|
||||||
|
"is-url": "^1.2.4",
|
||||||
|
"ms": "^2.1.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
"uri-js": {
|
"uri-js": {
|
||||||
"version": "4.4.0",
|
"version": "4.4.0",
|
||||||
"resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.0.tgz",
|
"resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.0.tgz",
|
||||||
|
@ -19,7 +19,8 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"electron-squirrel-startup": "^1.0.0",
|
"electron-squirrel-startup": "^1.0.0",
|
||||||
"minecraft-launcher-core": "^3.16.1"
|
"minecraft-launcher-core": "^3.16.1",
|
||||||
|
"update-electron-app": "^2.0.1"
|
||||||
},
|
},
|
||||||
"config": {
|
"config": {
|
||||||
"forge": "./config.forge.js"
|
"forge": "./config.forge.js"
|
||||||
|
@ -1,9 +1,42 @@
|
|||||||
const { app, BrowserWindow, Menu, ipcMain, Notification } = require('electron')
|
const { app, BrowserWindow, Menu, ipcMain, Notification, autoUpdater, dialog } = require('electron')
|
||||||
const { join } = require('path')
|
const { join } = require('path')
|
||||||
if (require('electron-squirrel-startup')) {
|
if (require('electron-squirrel-startup')) {
|
||||||
require("./install.js").handleSquirrelEvent(app)
|
require("./install.js").handleSquirrelEvent(app)
|
||||||
app.quit()
|
app.quit()
|
||||||
}
|
}
|
||||||
|
const server = 'https://update.electronjs.org'
|
||||||
|
const feed = `${server}/OWNER/REPO/${process.platform}-${process.arch}/${app.getVersion()}`
|
||||||
|
autoUpdater.setFeedURL(feed)
|
||||||
|
setInterval(() => {
|
||||||
|
autoUpdater.checkForUpdates()
|
||||||
|
}, 10 * 60 * 1000) // 10 minutes
|
||||||
|
|
||||||
|
autoUpdater.on('update-downloaded', (event, releaseNotes, releaseName) => {
|
||||||
|
const dialogOpts = {
|
||||||
|
type: 'info',
|
||||||
|
buttons: ['Rédémarrer', 'Plus tard'],
|
||||||
|
title: 'Une mise à jour du launcher est disponible',
|
||||||
|
message: process.platform === 'win32' ? releaseNotes : releaseName,
|
||||||
|
detail: 'Une nouvelle version du launcher a été téléchargé. Redémarrez l\'application pour appliquer les mises à jour.'
|
||||||
|
}
|
||||||
|
|
||||||
|
dialog.showMessageBox(dialogOpts).then((returnValue) => {
|
||||||
|
if (returnValue.response === 0) autoUpdater.quitAndInstall()
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
autoUpdater.on('error', message => {
|
||||||
|
console.error('There was a problem updating the application')
|
||||||
|
console.error(message)
|
||||||
|
const dialogOpts = {
|
||||||
|
type: 'info',
|
||||||
|
buttons: ['Fermer'],
|
||||||
|
title: 'Erreur lors de la tentetive de mise à jour de l\'application',
|
||||||
|
message: "Une Erreur est survenur de lros de la mise à jour du launcher"
|
||||||
|
}
|
||||||
|
dialog.showMessageBox(dialogOpts)
|
||||||
|
})
|
||||||
|
|
||||||
const { Client, Authenticator } = require('minecraft-launcher-core')
|
const { Client, Authenticator } = require('minecraft-launcher-core')
|
||||||
const appdata = process.env.APPDATA || (process.platform == 'darwin' ? process.env.HOME + '/Library/Preferences' : process.env.HOME + "/.local/share")
|
const appdata = process.env.APPDATA || (process.platform == 'darwin' ? process.env.HOME + '/Library/Preferences' : process.env.HOME + "/.local/share")
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user