4
0
mirror of https://github.com/AltarikMC/Launcher synced 2024-11-21 06:09:51 +01:00

Improved installation behavior + fixed font Roboto not loading

This commit is contained in:
Quentin Legot 2020-12-19 20:56:25 +01:00 committed by Quentin Legot
parent 4b852962a6
commit 813d9223cc
9 changed files with 85 additions and 367 deletions

BIN
app.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

20
config.forge.js Normal file
View File

@ -0,0 +1,20 @@
const path = require('path');
module.exports = {
packagerConfig: {
packageName: "Launcher",
name: "Launcher",
productName: "Launcher"//,
//icon: path.resolve(__dirname, 'app.ico')
},
makers: [
{
name: "@electron-forge/maker-squirrel",
config: {
name: "Launcher",
iconUrl: path.resolve(__dirname, 'app.ico'),
//loadingGif: path.resolve(__dirname, 'src/assets/loading.gif'),
setupIcon: path.resolve(__dirname, 'app.ico')
}
}
]
}

View File

@ -2,6 +2,11 @@
box-sizing: border-box;
}
@font-face {
font-family: "Roboto";
src: url("./Roboto-Regular.ttf") format("truetype");
}
html{
height: 100%;
}
@ -10,7 +15,7 @@ body{
background: white;
margin:0;
height:100%;
font-family: 'Lucida Sans', 'Lucida Sans Regular', 'Lucida Grande', 'Lucida Sans Unicode', Geneva, Verdana, sans-serif;
font-family: "Roboto";
}
#content{

View File

@ -4,7 +4,7 @@
@font-face {
font-family: "Roboto";
src: url("./include/Roboto-Regular.ttf") format("truetype");
src: url("./Roboto-Regular.ttf") format("truetype");
}
html{

View File

@ -6,7 +6,8 @@
<meta http-equiv="Content-Security-Policy" content="script-src 'self' 'unsafe-inline';" />
<link href="include/index.css" rel="stylesheet" />
<link href="include/menubar.css" rel="stylesheet" />
<link href="include/material-icons.css" rel="stylesheet">
<link href="include/material-icons.css" rel="stylesheet" />
<link rel="shortcut icon" type="image/png" href="icon.png"/>
</head>
<body>
<div id="menubar">

View File

@ -6,7 +6,8 @@
<meta http-equiv="Content-Security-Policy" content="script-src 'self' 'unsafe-inline';" />
<link href="include/login.css" rel="stylesheet" />
<link href="include/menubar.css" rel="stylesheet" />
<link href="include/material-icons.css" rel="stylesheet">
<link href="include/material-icons.css" rel="stylesheet" />
<link rel="shortcut icon" type="image/png" href="icon.png"/>
</head>
<body>
<div id="menubar">

54
main.js
View File

@ -2,8 +2,60 @@ const { app, BrowserWindow, Menu, ipcMain, Notification } = require('electron')
const path = require('path')
const { Client, Authenticator } = require('minecraft-launcher-core')
if (handleSquirrelEvent()) {
return;
}
function handleSquirrelEvent() {
if (process.argv.length === 1) {
return false;
}
const ChildProcess = require('child_process');
const path = require('path');
const appFolder = path.resolve(process.execPath, '..');
const rootAtomFolder = path.resolve(appFolder, '..');
const updateDotExe = path.resolve(path.join(rootAtomFolder, 'Update.exe'));
const exeName = path.basename(process.execPath);
const spawn = function(command, args) {
let spawnedProcess, error;
try {
spawnedProcess = ChildProcess.spawn(command, args, {detached: true});
} catch (error) {}
return spawnedProcess;
};
const spawnUpdate = function(args) {
return spawn(updateDotExe, args);
};
const squirrelEvent = process.argv[1];
switch (squirrelEvent) {
case '--squirrel-install':
case '--squirrel-updated':
spawnUpdate(['--createShortcut', exeName]);
setTimeout(app.quit, 1000);
return true;
case '--squirrel-uninstall':
spawnUpdate(['--removeShortcut', exeName]);
setTimeout(app.quit, 1000);
return true;
case '--squirrel-obsolete':
app.quit();
return true;
}
};
const launcher = new Client();
const iconPath = path.join(__dirname, "icon.png");
const iconPath = path.join(__dirname, "icon.ico");
let win = null
let auth = null

333
package-lock.json generated
View File

@ -398,28 +398,6 @@
}
}
},
"@electron-forge/maker-deb": {
"version": "6.0.0-beta.54",
"resolved": "https://registry.npmjs.org/@electron-forge/maker-deb/-/maker-deb-6.0.0-beta.54.tgz",
"integrity": "sha512-PEAYULi7n/JkwvaEQnM554ewmLYkxGtHvuh6vUf5wsh48Xw3jcEVHejsc4FDjx5I6cKAByb9nscTtZpKt3ngXw==",
"dev": true,
"requires": {
"@electron-forge/maker-base": "6.0.0-beta.54",
"@electron-forge/shared-types": "6.0.0-beta.54",
"electron-installer-debian": "^3.0.0"
}
},
"@electron-forge/maker-rpm": {
"version": "6.0.0-beta.54",
"resolved": "https://registry.npmjs.org/@electron-forge/maker-rpm/-/maker-rpm-6.0.0-beta.54.tgz",
"integrity": "sha512-6nqBOUnojRE8+KdvE8zVXN2/H/V/QuWJQ4cwCLahJQxG1kG5RXOh6VbsM1mEFxjJwOhVnK+wkNCODf1qi56JZw==",
"dev": true,
"requires": {
"@electron-forge/maker-base": "6.0.0-beta.54",
"@electron-forge/shared-types": "6.0.0-beta.54",
"electron-installer-redhat": "^3.2.0"
}
},
"@electron-forge/maker-squirrel": {
"version": "6.0.0-beta.54",
"resolved": "https://registry.npmjs.org/@electron-forge/maker-squirrel/-/maker-squirrel-6.0.0-beta.54.tgz",
@ -470,56 +448,6 @@
}
}
},
"@electron-forge/maker-zip": {
"version": "6.0.0-beta.54",
"resolved": "https://registry.npmjs.org/@electron-forge/maker-zip/-/maker-zip-6.0.0-beta.54.tgz",
"integrity": "sha512-wbJhK1rDOCZMTtKrjvavT8R+Yi+v/6axsnTXvzbkzzMQ0xADKNslTwzO6mmbBJea4oIbYmQ44DRAjI21TNyQ/A==",
"dev": true,
"requires": {
"@electron-forge/maker-base": "6.0.0-beta.54",
"@electron-forge/shared-types": "6.0.0-beta.54",
"cross-zip": "^3.0.0",
"fs-extra": "^9.0.1"
},
"dependencies": {
"fs-extra": {
"version": "9.0.1",
"resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-9.0.1.tgz",
"integrity": "sha512-h2iAoN838FqAFJY2/qVpzFXy+EBxfVE220PalAqQLDVsFOHLJrZvut5puAbCdNv6WJk+B8ihI+k0c7JK5erwqQ==",
"dev": true,
"requires": {
"at-least-node": "^1.0.0",
"graceful-fs": "^4.2.0",
"jsonfile": "^6.0.1",
"universalify": "^1.0.0"
}
},
"jsonfile": {
"version": "6.1.0",
"resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.1.0.tgz",
"integrity": "sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==",
"dev": true,
"requires": {
"graceful-fs": "^4.1.6",
"universalify": "^2.0.0"
},
"dependencies": {
"universalify": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.0.tgz",
"integrity": "sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ==",
"dev": true
}
}
},
"universalify": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/universalify/-/universalify-1.0.0.tgz",
"integrity": "sha512-rb6X1W158d7pRQBg5gkR8uPaSfiids68LTJQYOtEUhoJUWBdaQHsuT/EUduxXYxcrt4r5PJ4fuHW1MHT6p0qug==",
"dev": true
}
}
},
"@electron-forge/plugin-base": {
"version": "6.0.0-beta.54",
"resolved": "https://registry.npmjs.org/@electron-forge/plugin-base/-/plugin-base-6.0.0-beta.54.tgz",
@ -804,16 +732,6 @@
"@types/responselike": "*"
}
},
"@types/fs-extra": {
"version": "9.0.4",
"resolved": "https://registry.npmjs.org/@types/fs-extra/-/fs-extra-9.0.4.tgz",
"integrity": "sha512-50GO5ez44lxK5MDH90DYHFFfqxH7+fTqEEnvguQRzJ/tY9qFrMSHLiYHite+F3SNmf7+LHC1eMXojuD+E3Qcyg==",
"dev": true,
"optional": true,
"requires": {
"@types/node": "*"
}
},
"@types/glob": {
"version": "7.1.3",
"resolved": "https://registry.npmjs.org/@types/glob/-/glob-7.1.3.tgz",
@ -1352,26 +1270,6 @@
"which": "^2.0.1"
}
},
"cross-zip": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/cross-zip/-/cross-zip-3.1.0.tgz",
"integrity": "sha512-aX02l0SD3KE27pMl69gkxDdDM5D3u9Ic4Je+2b1B2fP0dWnlWWY6ns2Vk5DEgCXJRhL3GasSpicNQRNbDkq0+w==",
"dev": true,
"requires": {
"rimraf": "^3.0.0"
},
"dependencies": {
"rimraf": {
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz",
"integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==",
"dev": true,
"requires": {
"glob": "^7.1.3"
}
}
}
},
"cuint": {
"version": "0.2.2",
"resolved": "https://registry.npmjs.org/cuint/-/cuint-0.2.2.tgz",
@ -1501,182 +1399,6 @@
"extract-zip": "^1.0.3"
}
},
"electron-installer-common": {
"version": "0.10.3",
"resolved": "https://registry.npmjs.org/electron-installer-common/-/electron-installer-common-0.10.3.tgz",
"integrity": "sha512-mYbP+6i+nHMIm0WZHXgGdmmXMe+KXncl6jZYQNcCF9C1WsNA9C5SZ2VP4TLQMSIoFO+X4ugkMEA5uld1bmyEvA==",
"dev": true,
"optional": true,
"requires": {
"@malept/cross-spawn-promise": "^1.0.0",
"@types/fs-extra": "^9.0.1",
"asar": "^3.0.0",
"debug": "^4.1.1",
"fs-extra": "^9.0.0",
"glob": "^7.1.4",
"lodash": "^4.17.15",
"parse-author": "^2.0.0",
"semver": "^7.1.1",
"tmp-promise": "^3.0.2"
},
"dependencies": {
"fs-extra": {
"version": "9.0.1",
"resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-9.0.1.tgz",
"integrity": "sha512-h2iAoN838FqAFJY2/qVpzFXy+EBxfVE220PalAqQLDVsFOHLJrZvut5puAbCdNv6WJk+B8ihI+k0c7JK5erwqQ==",
"dev": true,
"optional": true,
"requires": {
"at-least-node": "^1.0.0",
"graceful-fs": "^4.2.0",
"jsonfile": "^6.0.1",
"universalify": "^1.0.0"
}
},
"jsonfile": {
"version": "6.1.0",
"resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.1.0.tgz",
"integrity": "sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==",
"dev": true,
"optional": true,
"requires": {
"graceful-fs": "^4.1.6",
"universalify": "^2.0.0"
},
"dependencies": {
"universalify": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.0.tgz",
"integrity": "sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ==",
"dev": true,
"optional": true
}
}
},
"rimraf": {
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz",
"integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==",
"dev": true,
"optional": true,
"requires": {
"glob": "^7.1.3"
}
},
"tmp": {
"version": "0.2.1",
"resolved": "https://registry.npmjs.org/tmp/-/tmp-0.2.1.tgz",
"integrity": "sha512-76SUhtfqR2Ijn+xllcI5P1oyannHNHByD80W1q447gU3mp9G9PSpGdWmjUOHRDPiHYacIk66W7ubDTuPF3BEtQ==",
"dev": true,
"optional": true,
"requires": {
"rimraf": "^3.0.0"
}
},
"tmp-promise": {
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/tmp-promise/-/tmp-promise-3.0.2.tgz",
"integrity": "sha512-OyCLAKU1HzBjL6Ev3gxUeraJNlbNingmi8IrHHEsYH8LTmEuhvYfqvhn2F/je+mjf4N58UmZ96OMEy1JanSCpA==",
"dev": true,
"optional": true,
"requires": {
"tmp": "^0.2.0"
}
},
"universalify": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/universalify/-/universalify-1.0.0.tgz",
"integrity": "sha512-rb6X1W158d7pRQBg5gkR8uPaSfiids68LTJQYOtEUhoJUWBdaQHsuT/EUduxXYxcrt4r5PJ4fuHW1MHT6p0qug==",
"dev": true,
"optional": true
}
}
},
"electron-installer-debian": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/electron-installer-debian/-/electron-installer-debian-3.1.0.tgz",
"integrity": "sha512-k6KChvx0Fw8XTlCqwwbBfh19yGQaKjGdbugokmr1IpzINOm4QFyACKMTHAYFHW5LCBUZQShZD96hwxUZ+8Kx+w==",
"dev": true,
"optional": true,
"requires": {
"@malept/cross-spawn-promise": "^1.0.0",
"debug": "^4.1.1",
"electron-installer-common": "^0.10.2",
"fs-extra": "^9.0.0",
"get-folder-size": "^2.0.1",
"lodash": "^4.17.4",
"word-wrap": "^1.2.3",
"yargs": "^15.0.1"
},
"dependencies": {
"fs-extra": {
"version": "9.0.1",
"resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-9.0.1.tgz",
"integrity": "sha512-h2iAoN838FqAFJY2/qVpzFXy+EBxfVE220PalAqQLDVsFOHLJrZvut5puAbCdNv6WJk+B8ihI+k0c7JK5erwqQ==",
"dev": true,
"optional": true,
"requires": {
"at-least-node": "^1.0.0",
"graceful-fs": "^4.2.0"
}
},
"yargs": {
"version": "15.4.1",
"resolved": "https://registry.npmjs.org/yargs/-/yargs-15.4.1.tgz",
"integrity": "sha512-aePbxDmcYW++PaqBsJ+HYUFwCdv4LVvdnhBy78E57PIor8/OVvhMrADFFEDh8DHDFRv/O9i3lPhsENjO7QX0+A==",
"dev": true,
"optional": true,
"requires": {
"decamelize": "^1.2.0",
"get-caller-file": "^2.0.1",
"require-directory": "^2.1.1",
"set-blocking": "^2.0.0"
}
}
}
},
"electron-installer-redhat": {
"version": "3.2.0",
"resolved": "https://registry.npmjs.org/electron-installer-redhat/-/electron-installer-redhat-3.2.0.tgz",
"integrity": "sha512-XMA+fQj3ULNVMl4eG+hIvrYITEqP1pfpERvx6kRwuPd06vdtB4KucL9241DAHT0NR5E9gnyJHM9Y6N24kk0mcA==",
"dev": true,
"optional": true,
"requires": {
"@malept/cross-spawn-promise": "^1.0.0",
"debug": "^4.1.1",
"electron-installer-common": "^0.10.2",
"fs-extra": "^9.0.0",
"lodash": "^4.17.15",
"word-wrap": "^1.2.3",
"yargs": "^15.1.0"
},
"dependencies": {
"fs-extra": {
"version": "9.0.1",
"resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-9.0.1.tgz",
"integrity": "sha512-h2iAoN838FqAFJY2/qVpzFXy+EBxfVE220PalAqQLDVsFOHLJrZvut5puAbCdNv6WJk+B8ihI+k0c7JK5erwqQ==",
"dev": true,
"optional": true,
"requires": {
"at-least-node": "^1.0.0",
"graceful-fs": "^4.2.0"
}
},
"yargs": {
"version": "15.4.1",
"resolved": "https://registry.npmjs.org/yargs/-/yargs-15.4.1.tgz",
"integrity": "sha512-aePbxDmcYW++PaqBsJ+HYUFwCdv4LVvdnhBy78E57PIor8/OVvhMrADFFEDh8DHDFRv/O9i3lPhsENjO7QX0+A==",
"dev": true,
"optional": true,
"requires": {
"decamelize": "^1.2.0",
"get-caller-file": "^2.0.1",
"require-directory": "^2.1.1",
"set-blocking": "^2.0.0"
}
}
}
},
"electron-notarize": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/electron-notarize/-/electron-notarize-1.0.0.tgz",
@ -2013,29 +1735,6 @@
}
}
},
"electron-squirrel-startup": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/electron-squirrel-startup/-/electron-squirrel-startup-1.0.0.tgz",
"integrity": "sha1-GbTlWTP6Dvj1VnhLnGYPdyVGoLg=",
"requires": {
"debug": "^2.2.0"
},
"dependencies": {
"debug": {
"version": "2.6.9",
"resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
"integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==",
"requires": {
"ms": "2.0.0"
}
},
"ms": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
"integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g="
}
}
},
"electron-winstaller": {
"version": "4.0.1",
"resolved": "https://registry.npmjs.org/electron-winstaller/-/electron-winstaller-4.0.1.tgz",
@ -2471,13 +2170,6 @@
}
}
},
"gar": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/gar/-/gar-1.0.4.tgz",
"integrity": "sha512-w4n9cPWyP7aHxKxYHFQMegj7WIAsL/YX/C4Bs5Rr8s1H9M1rNtRWRsw+ovYMkXDQ5S4ZbYHsHAPmevPjPgw44w==",
"dev": true,
"optional": true
},
"gauge": {
"version": "2.7.4",
"resolved": "https://registry.npmjs.org/gauge/-/gauge-2.7.4.tgz",
@ -2517,17 +2209,6 @@
"integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==",
"dev": true
},
"get-folder-size": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/get-folder-size/-/get-folder-size-2.0.1.tgz",
"integrity": "sha512-+CEb+GDCM7tkOS2wdMKTn9vU7DgnKUTuDlehkNJKNSovdCOVxs14OfKCk4cvSaR3za4gj+OBdl9opPN9xrJ0zA==",
"dev": true,
"optional": true,
"requires": {
"gar": "^1.0.4",
"tiny-each-async": "2.0.3"
}
},
"get-installed-path": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/get-installed-path/-/get-installed-path-2.1.1.tgz",
@ -4675,13 +4356,6 @@
}
}
},
"tiny-each-async": {
"version": "2.0.3",
"resolved": "https://registry.npmjs.org/tiny-each-async/-/tiny-each-async-2.0.3.tgz",
"integrity": "sha1-jru/1tYpXxNwAD+7NxYq/loKUdE=",
"dev": true,
"optional": true
},
"tmp": {
"version": "0.0.33",
"resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.33.tgz",
@ -4897,13 +4571,6 @@
"string-width": "^1.0.2 || 2"
}
},
"word-wrap": {
"version": "1.2.3",
"resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.3.tgz",
"integrity": "sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ==",
"dev": true,
"optional": true
},
"wordwrap": {
"version": "0.0.3",
"resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-0.0.3.tgz",

View File

@ -14,41 +14,13 @@
"license": "ISC",
"devDependencies": {
"@electron-forge/cli": "^6.0.0-beta.54",
"@electron-forge/maker-deb": "^6.0.0-beta.54",
"@electron-forge/maker-rpm": "^6.0.0-beta.54",
"@electron-forge/maker-squirrel": "^6.0.0-beta.54",
"@electron-forge/maker-zip": "^6.0.0-beta.54",
"electron": "^11.1.0"
},
"dependencies": {
"electron-squirrel-startup": "^1.0.0",
"minecraft-launcher-core": "^3.15.6"
},
"config": {
"forge": {
"packagerConfig": {},
"makers": [
{
"name": "@electron-forge/maker-squirrel",
"config": {
"name": "launcher"
}
},
{
"name": "@electron-forge/maker-zip",
"platforms": [
"darwin"
]
},
{
"name": "@electron-forge/maker-deb",
"config": {}
},
{
"name": "@electron-forge/maker-rpm",
"config": {}
}
]
}
"forge": "./config.forge.js"
}
}