mirror of
https://github.com/AltarikMC/Launcher
synced 2024-11-21 06:09:51 +01:00
dump to snapshot
This commit is contained in:
parent
c2a512883d
commit
ad8103bc64
35
package-lock.json
generated
35
package-lock.json
generated
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "altarik-launcher",
|
||||
"version": "0.1.0",
|
||||
"version": "0.1.1-SNPASHOT",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
@ -1400,9 +1400,9 @@
|
||||
}
|
||||
},
|
||||
"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="
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/electron-is-dev/-/electron-is-dev-1.2.0.tgz",
|
||||
"integrity": "sha512-R1oD5gMBPS7PVU8gJwH6CtT0e6VSoD0+SzSnYpNm+dBkcijgA+K7VAMHDfnRq/lkKPZArpzplTW6jfiMYosdzw=="
|
||||
},
|
||||
"electron-notarize": {
|
||||
"version": "1.0.0",
|
||||
@ -2298,14 +2298,6 @@
|
||||
"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": {
|
||||
"version": "7.1.6",
|
||||
"resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz",
|
||||
@ -2637,11 +2629,6 @@
|
||||
"resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz",
|
||||
"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": {
|
||||
"version": "0.2.1",
|
||||
"resolved": "https://registry.npmjs.org/is-utf8/-/is-utf8-0.2.1.tgz",
|
||||
@ -3091,7 +3078,8 @@
|
||||
"ms": {
|
||||
"version": "2.1.2",
|
||||
"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": {
|
||||
"version": "0.0.8",
|
||||
@ -4520,17 +4508,6 @@
|
||||
"integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==",
|
||||
"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": {
|
||||
"version": "4.4.0",
|
||||
"resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.0.tgz",
|
||||
|
@ -1,8 +1,9 @@
|
||||
{
|
||||
"name": "altarik-launcher",
|
||||
"version": "0.1.0",
|
||||
"version": "0.1.1-SNAPSHOT",
|
||||
"description": "Altarik Launcher",
|
||||
"main": "src/server/main.js",
|
||||
"repository": "AltarikMC/Launcher",
|
||||
"scripts": {
|
||||
"start": "electron-forge start",
|
||||
"test": "echo \"Error: no test specified\" && exit 1",
|
||||
@ -18,9 +19,9 @@
|
||||
"electron": "^11.2.3"
|
||||
},
|
||||
"dependencies": {
|
||||
"electron-is-dev": "^1.2.0",
|
||||
"electron-squirrel-startup": "^1.0.0",
|
||||
"minecraft-launcher-core": "^3.16.1",
|
||||
"update-electron-app": "^2.0.1"
|
||||
"minecraft-launcher-core": "^3.16.1"
|
||||
},
|
||||
"config": {
|
||||
"forge": "./config.forge.js"
|
||||
|
@ -4,38 +4,8 @@ if (require('electron-squirrel-startup')) {
|
||||
require("./install.js").handleSquirrelEvent(app)
|
||||
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)
|
||||
})
|
||||
// don't work
|
||||
//require('./updater.js').configUpdater(app, autoUpdater, dialog)
|
||||
|
||||
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")
|
||||
|
68
src/server/updater.js
Normal file
68
src/server/updater.js
Normal file
@ -0,0 +1,68 @@
|
||||
const isDev = require('electron-is-dev')
|
||||
const { Notification } = require('electron')
|
||||
const os = require('os')
|
||||
const pkg = require('../../package.json')
|
||||
const { format } = require('util')
|
||||
const server = 'https://update.electronjs.org'
|
||||
|
||||
function initUpdater(autoUpdater) {
|
||||
autoUpdater.checkForUpdates()
|
||||
setInterval(() => {
|
||||
autoUpdater.checkForUpdates()
|
||||
}, 10 * 60 * 1000) // 10 minutes
|
||||
}
|
||||
|
||||
function configUpdater(app, autoUpdater, dialog) {
|
||||
if(isDev)
|
||||
return
|
||||
const feed = `${server}/${pkg.repository}/${process.platform}-${process.arch}/${app.getVersion()}`
|
||||
autoUpdater.setFeedURL(feed)
|
||||
app.isReady ? initUpdater(autoUpdater) : app.on("ready", () => initUpdater(autoUpdater))
|
||||
|
||||
|
||||
autoUpdater.on('update-downloaded', (event, releaseNotes, releaseName, releaseDate, updateURL) => {
|
||||
showNotification(releaseNotes, updateURL)
|
||||
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)
|
||||
showNotification(feed)
|
||||
const dialogOpts = {
|
||||
type: 'info',
|
||||
buttons: ['Fermer'],
|
||||
title: 'Erreur lors de la tentative de mise à jour du launcher',
|
||||
message: "Une erreur est survenue lros de la tentative de mise à jour du launcher",
|
||||
detail: message
|
||||
}
|
||||
|
||||
dialog.showMessageBox(dialogOpts)
|
||||
})
|
||||
|
||||
autoUpdater.on('update-available', () => {
|
||||
showNotification("Altarik launcher", "downloading update")
|
||||
})
|
||||
}
|
||||
|
||||
function showNotification(title, body="") {
|
||||
const content = {
|
||||
title: title,
|
||||
body: body
|
||||
}
|
||||
new Notification(content).show()
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
configUpdater
|
||||
}
|
Loading…
Reference in New Issue
Block a user