Add files via upload

This commit is contained in:
MastermDEV 2020-06-18 18:16:45 -07:00 committed by GitHub
parent f5d9c25c71
commit b1edcf3cd6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 4111 additions and 4111 deletions

View File

@ -1,66 +1,66 @@
{ {
"env": { "env": {
"es2017": true, "es2017": true,
"node": true "node": true
}, },
"extends": "eslint:recommended", "extends": "eslint:recommended",
"parserOptions": { "parserOptions": {
"ecmaVersion": 2019, "ecmaVersion": 2019,
"sourceType": "module" "sourceType": "module"
}, },
"rules": { "rules": {
"indent": [ "indent": [
"error", "error",
4, 4,
{ {
"SwitchCase": 1 "SwitchCase": 1
} }
], ],
"linebreak-style": [ "linebreak-style": [
"error", "error",
"windows" "windows"
], ],
"quotes": [ "quotes": [
"error", "error",
"single" "single"
], ],
"semi": [ "semi": [
"error", "error",
"never" "never"
], ],
"no-var": [ "no-var": [
"error" "error"
], ],
"no-console": [ "no-console": [
0 0
], ],
"no-control-regex": [ "no-control-regex": [
0 0
], ],
"no-unused-vars": [ "no-unused-vars": [
"error", "error",
{ {
"vars": "all", "vars": "all",
"args": "none", "args": "none",
"ignoreRestSiblings": false, "ignoreRestSiblings": false,
"argsIgnorePattern": "reject" "argsIgnorePattern": "reject"
} }
], ],
"no-async-promise-executor": [ "no-async-promise-executor": [
0 0
] ]
}, },
"overrides": [ "overrides": [
{ {
"files": [ "app/assets/js/scripts/*.js" ], "files": [ "app/assets/js/scripts/*.js" ],
"rules": { "rules": {
"no-unused-vars": [ "no-unused-vars": [
0 0
], ],
"no-undef": [ "no-undef": [
0 0
] ]
} }
} }
] ]
} }

View File

@ -1,45 +1,45 @@
matrix: matrix:
include: include:
- os: osx - os: osx
osx_image: xcode11.3 osx_image: xcode11.3
language: node_js language: node_js
node_js: "12" node_js: "12"
env: env:
- ELECTRON_CACHE=$HOME/.cache/electron - ELECTRON_CACHE=$HOME/.cache/electron
- ELECTRON_BUILDER_CACHE=$HOME/.cache/electron-builder - ELECTRON_BUILDER_CACHE=$HOME/.cache/electron-builder
- ELECTRON_BUILDER_ALLOW_UNRESOLVED_DEPENDENCIES=true - ELECTRON_BUILDER_ALLOW_UNRESOLVED_DEPENDENCIES=true
- CSC_IDENTITY_AUTO_DISCOVERY=false - CSC_IDENTITY_AUTO_DISCOVERY=false
- os: linux - os: linux
services: docker services: docker
language: generic language: generic
node_js: "12" node_js: "12"
env: env:
- ELECTRON_BUILDER_ALLOW_UNRESOLVED_DEPENDENCIES=true - ELECTRON_BUILDER_ALLOW_UNRESOLVED_DEPENDENCIES=true
cache: cache:
directories: directories:
- node_modules - node_modules
- $HOME/.cache/electron - $HOME/.cache/electron
- $HOME/.cache/electron-builder - $HOME/.cache/electron-builder
script: script:
- | - |
if [ "$TRAVIS_OS_NAME" == "linux" ]; then if [ "$TRAVIS_OS_NAME" == "linux" ]; then
ENVS=`env | grep -iE '(DEBUG|NODE_|ELECTRON_|YARN_|NPM_|CI|CIRCLE|TRAVIS|APPVEYOR_|CSC_|_TOKEN|_KEY|AWS_|STRIP|BUILD_)' | sed -n '/^[^\t]/s/=.*//p' | sed '/^$/d' | sed 's/^/-e /g' | tr '\n' ' '` ENVS=`env | grep -iE '(DEBUG|NODE_|ELECTRON_|YARN_|NPM_|CI|CIRCLE|TRAVIS|APPVEYOR_|CSC_|_TOKEN|_KEY|AWS_|STRIP|BUILD_)' | sed -n '/^[^\t]/s/=.*//p' | sed '/^$/d' | sed 's/^/-e /g' | tr '\n' ' '`
docker run $ENVS --rm \ docker run $ENVS --rm \
-v ${PWD}:/project \ -v ${PWD}:/project \
-v ~/.cache/electron:/root/.cache/electron \ -v ~/.cache/electron:/root/.cache/electron \
-v ~/.cache/electron-builder:/root/.cache/electron-builder \ -v ~/.cache/electron-builder:/root/.cache/electron-builder \
electronuserland/builder:wine \ electronuserland/builder:wine \
/bin/bash -c "node -v && npm ci && npm run cilinux" /bin/bash -c "node -v && npm ci && npm run cilinux"
else else
npm run cidarwin npm run cidarwin
fi fi
before_cache: before_cache:
- rm -rf $HOME/.cache/electron-builder/wine - rm -rf $HOME/.cache/electron-builder/wine
branches: branches:
except: except:
- "/^v\\d+\\.\\d+\\.\\d+$/" - "/^v\\d+\\.\\d+\\.\\d+$/"

424
README.md
View File

@ -1,212 +1,212 @@
<p align="center"><img src="./app/assets/images/SealCircle.png" width="150px" height="150px" alt="aventium softworks"></p> <p align="center"><img src="./app/assets/images/SealCircle.png" width="150px" height="150px" alt="aventium softworks"></p>
<h1 align="center">Helios Launcher</h1> <h1 align="center">Helios Launcher</h1>
<em><h5 align="center">(formerly Electron Launcher)</h5></em> <em><h5 align="center">(formerly Electron Launcher)</h5></em>
[<p align="center"><img src="https://img.shields.io/travis/dscalzi/HeliosLauncher.svg?style=for-the-badge" alt="travis">](https://travis-ci.org/dscalzi/HeliosLauncher) [<img src="https://img.shields.io/github/downloads/dscalzi/HeliosLauncher/total.svg?style=for-the-badge" alt="downloads">](https://github.com/dscalzi/HeliosLauncher/releases) <img src="https://forthebadge.com/images/badges/winter-is-coming.svg" height="28px" alt="stark"></p> [<p align="center"><img src="https://img.shields.io/travis/dscalzi/HeliosLauncher.svg?style=for-the-badge" alt="travis">](https://travis-ci.org/dscalzi/HeliosLauncher) [<img src="https://img.shields.io/github/downloads/dscalzi/HeliosLauncher/total.svg?style=for-the-badge" alt="downloads">](https://github.com/dscalzi/HeliosLauncher/releases) <img src="https://forthebadge.com/images/badges/winter-is-coming.svg" height="28px" alt="stark"></p>
<p align="center">Join modded servers without worrying about installing Java, Forge, or other mods. We'll handle that for you.</p> <p align="center">Join modded servers without worrying about installing Java, Forge, or other mods. We'll handle that for you.</p>
![Screenshot 1](https://i.imgur.com/6o7SmH6.png) ![Screenshot 1](https://i.imgur.com/6o7SmH6.png)
![Screenshot 2](https://i.imgur.com/x3B34n1.png) ![Screenshot 2](https://i.imgur.com/x3B34n1.png)
## Features ## Features
* 🔒 Full account management. * 🔒 Full account management.
* Add multiple accounts and easily switch between them. * Add multiple accounts and easily switch between them.
* Credentials are never stored and transmitted directly to Mojang. * Credentials are never stored and transmitted directly to Mojang.
* 📂 Efficient asset management. * 📂 Efficient asset management.
* Receive client updates as soon as we release them. * Receive client updates as soon as we release them.
* Files are validated before launch. Corrupt or incorrect files will be redownloaded. * Files are validated before launch. Corrupt or incorrect files will be redownloaded.
* ☕ **Automatic Java validation.** * ☕ **Automatic Java validation.**
* If you have an incompatible version of Java installed, we'll install the right one *for you*. * If you have an incompatible version of Java installed, we'll install the right one *for you*.
* You do not need to have Java installed to run the launcher. * You do not need to have Java installed to run the launcher.
* 📰 News feed natively built into the launcher. * 📰 News feed natively built into the launcher.
* ⚙️ Intuitive settings management, including a Java control panel. * ⚙️ Intuitive settings management, including a Java control panel.
* Supports all of our servers. * Supports all of our servers.
* Switch between server configurations with ease. * Switch between server configurations with ease.
* View the player count of the selected server. * View the player count of the selected server.
* Automatic updates. That's right, the launcher updates itself. * Automatic updates. That's right, the launcher updates itself.
* View the status of Mojang's services. * View the status of Mojang's services.
This is not an exhaustive list. Download and install the launcher to gauge all it can do! This is not an exhaustive list. Download and install the launcher to gauge all it can do!
#### Need Help? [Check the wiki.][wiki] #### Need Help? [Check the wiki.][wiki]
#### Like the project? Leave a ⭐ star on the repository! #### Like the project? Leave a ⭐ star on the repository!
## Downloads ## Downloads
You can download from [GitHub Releases](https://github.com/dscalzi/HeliosLauncher/releases) You can download from [GitHub Releases](https://github.com/dscalzi/HeliosLauncher/releases)
#### Latest Release #### Latest Release
[![](https://img.shields.io/github/release/dscalzi/HeliosLauncher.svg?style=flat-square)](https://github.com/dscalzi/HeliosLauncher/releases/latest) [![](https://img.shields.io/github/release/dscalzi/HeliosLauncher.svg?style=flat-square)](https://github.com/dscalzi/HeliosLauncher/releases/latest)
#### Latest Pre-Release #### Latest Pre-Release
[![](https://img.shields.io/github/release/dscalzi/HeliosLauncher/all.svg?style=flat-square)](https://github.com/dscalzi/HeliosLauncher/releases) [![](https://img.shields.io/github/release/dscalzi/HeliosLauncher/all.svg?style=flat-square)](https://github.com/dscalzi/HeliosLauncher/releases)
**Supported Platforms** **Supported Platforms**
If you download from the [Releases](https://github.com/dscalzi/HeliosLauncher/releases) tab, select the installer for your system. If you download from the [Releases](https://github.com/dscalzi/HeliosLauncher/releases) tab, select the installer for your system.
| Platform | File | | Platform | File |
| -------- | ---- | | -------- | ---- |
| Windows x64 | `helioslauncher-setup-VERSION.exe` | | Windows x64 | `helioslauncher-setup-VERSION.exe` |
| macOS | `helioslauncher-VERSION.dmg` | | macOS | `helioslauncher-VERSION.dmg` |
| Linux x64 | `helioslauncher-VERSION-x86_64.AppImage` | | Linux x64 | `helioslauncher-VERSION-x86_64.AppImage` |
## Console ## Console
To open the console, use the following keybind. To open the console, use the following keybind.
```console ```console
ctrl + shift + i ctrl + shift + i
``` ```
Ensure that you have the console tab selected. Do not paste anything into the console unless you are 100% sure of what it will do. Pasting the wrong thing can expose sensitive information. Ensure that you have the console tab selected. Do not paste anything into the console unless you are 100% sure of what it will do. Pasting the wrong thing can expose sensitive information.
#### Export Output to a File #### Export Output to a File
If you want to export the console output, simply right click anywhere on the console and click **Save as..** If you want to export the console output, simply right click anywhere on the console and click **Save as..**
![console example](https://i.imgur.com/T5e73jP.png) ![console example](https://i.imgur.com/T5e73jP.png)
## Development ## Development
### Getting Started ### Getting Started
**System Requirements** **System Requirements**
* [Node.js][nodejs] v12 * [Node.js][nodejs] v12
--- ---
**Clone and Install Dependencies** **Clone and Install Dependencies**
```console ```console
> git clone https://github.com/dscalzi/HeliosLauncher.git > git clone https://github.com/dscalzi/HeliosLauncher.git
> cd HeliosLauncher > cd HeliosLauncher
> npm install > npm install
``` ```
--- ---
**Launch Application** **Launch Application**
```console ```console
> npm start > npm start
``` ```
--- ---
**Build Installers** **Build Installers**
To build for your current platform. To build for your current platform.
```console ```console
> npm run dist > npm run dist
``` ```
Build for a specific platform. Build for a specific platform.
| Platform | Command | | Platform | Command |
| ----------- | -------------------- | | ----------- | -------------------- |
| Windows x64 | `npm run dist:win` | | Windows x64 | `npm run dist:win` |
| macOS | `npm run dist:mac` | | macOS | `npm run dist:mac` |
| Linux x64 | `npm run dist:linux` | | Linux x64 | `npm run dist:linux` |
Builds for macOS may not work on Windows/Linux and vice-versa. Builds for macOS may not work on Windows/Linux and vice-versa.
--- ---
### Visual Studio Code ### Visual Studio Code
All development of the launcher should be done using [Visual Studio Code][vscode]. All development of the launcher should be done using [Visual Studio Code][vscode].
Paste the following into `.vscode/launch.json` Paste the following into `.vscode/launch.json`
```JSON ```JSON
{ {
"version": "0.2.0", "version": "0.2.0",
"configurations": [ "configurations": [
{ {
"name": "Debug Main Process", "name": "Debug Main Process",
"type": "node", "type": "node",
"request": "launch", "request": "launch",
"cwd": "${workspaceRoot}", "cwd": "${workspaceRoot}",
"runtimeExecutable": "${workspaceRoot}/node_modules/.bin/electron", "runtimeExecutable": "${workspaceRoot}/node_modules/.bin/electron",
"windows": { "windows": {
"runtimeExecutable": "${workspaceRoot}/node_modules/.bin/electron.cmd" "runtimeExecutable": "${workspaceRoot}/node_modules/.bin/electron.cmd"
}, },
"args": ["."], "args": ["."],
"console": "integratedTerminal", "console": "integratedTerminal",
"protocol": "inspector" "protocol": "inspector"
}, },
{ {
"name": "Debug Renderer Process", "name": "Debug Renderer Process",
"type": "chrome", "type": "chrome",
"request": "launch", "request": "launch",
"runtimeExecutable": "${workspaceRoot}/node_modules/.bin/electron", "runtimeExecutable": "${workspaceRoot}/node_modules/.bin/electron",
"windows": { "windows": {
"runtimeExecutable": "${workspaceRoot}/node_modules/.bin/electron.cmd" "runtimeExecutable": "${workspaceRoot}/node_modules/.bin/electron.cmd"
}, },
"runtimeArgs": [ "runtimeArgs": [
"${workspaceRoot}/.", "${workspaceRoot}/.",
"--remote-debugging-port=9222" "--remote-debugging-port=9222"
], ],
"webRoot": "${workspaceRoot}" "webRoot": "${workspaceRoot}"
} }
] ]
} }
``` ```
This adds two debug configurations. This adds two debug configurations.
#### Debug Main Process #### Debug Main Process
This allows you to debug Electron's [main process][mainprocess]. You can debug scripts in the [renderer process][rendererprocess] by opening the DevTools Window. This allows you to debug Electron's [main process][mainprocess]. You can debug scripts in the [renderer process][rendererprocess] by opening the DevTools Window.
#### Debug Renderer Process #### Debug Renderer Process
This allows you to debug Electron's [renderer process][rendererprocess]. This requires you to install the [Debugger for Chrome][chromedebugger] extension. This allows you to debug Electron's [renderer process][rendererprocess]. This requires you to install the [Debugger for Chrome][chromedebugger] extension.
Note that you **cannot** open the DevTools window while using this debug configuration. Chromium only allows one debugger, opening another will crash the program. Note that you **cannot** open the DevTools window while using this debug configuration. Chromium only allows one debugger, opening another will crash the program.
--- ---
### Note on Third-Party Usage ### Note on Third-Party Usage
You may use this software in your own project so long as the following conditions are met. You may use this software in your own project so long as the following conditions are met.
* Credit is expressly given to the original authors (Daniel Scalzi). * Credit is expressly given to the original authors (Daniel Scalzi).
* Include a link to the original source on the launcher's About page. * Include a link to the original source on the launcher's About page.
* Credit the authors and provide a link to the original source in any publications or download pages. * Credit the authors and provide a link to the original source in any publications or download pages.
* The source code remain **public** as a fork of this repository. * The source code remain **public** as a fork of this repository.
We reserve the right to update these conditions at any time, please check back periodically. We reserve the right to update these conditions at any time, please check back periodically.
--- ---
## Resources ## Resources
* [Wiki][wiki] * [Wiki][wiki]
The best way to contact the developers is on Discord. The best way to contact the developers is on Discord.
[![discord](https://discordapp.com/api/guilds/211524927831015424/embed.png?style=banner3)][discord] [![discord](https://discordapp.com/api/guilds/211524927831015424/embed.png?style=banner3)][discord]
--- ---
### See you ingame. ### See you ingame.
[nodejs]: https://nodejs.org/en/ 'Node.js' [nodejs]: https://nodejs.org/en/ 'Node.js'
[vscode]: https://code.visualstudio.com/ 'Visual Studio Code' [vscode]: https://code.visualstudio.com/ 'Visual Studio Code'
[mainprocess]: https://electronjs.org/docs/tutorial/application-architecture#main-and-renderer-processes 'Main Process' [mainprocess]: https://electronjs.org/docs/tutorial/application-architecture#main-and-renderer-processes 'Main Process'
[rendererprocess]: https://electronjs.org/docs/tutorial/application-architecture#main-and-renderer-processes 'Renderer Process' [rendererprocess]: https://electronjs.org/docs/tutorial/application-architecture#main-and-renderer-processes 'Renderer Process'
[chromedebugger]: https://marketplace.visualstudio.com/items?itemName=msjsdiag.debugger-for-chrome 'Debugger for Chrome' [chromedebugger]: https://marketplace.visualstudio.com/items?itemName=msjsdiag.debugger-for-chrome 'Debugger for Chrome'
[discord]: https://discord.gg/zNWUXdt 'Discord' [discord]: https://discord.gg/zNWUXdt 'Discord'
[wiki]: https://github.com/dscalzi/HeliosLauncher/wiki 'wiki' [wiki]: https://github.com/dscalzi/HeliosLauncher/wiki 'wiki'

134
build.js
View File

@ -1,68 +1,68 @@
const builder = require('electron-builder') const builder = require('electron-builder')
const Platform = builder.Platform const Platform = builder.Platform
function getCurrentPlatform(){ function getCurrentPlatform(){
switch(process.platform){ switch(process.platform){
case 'win32': case 'win32':
return Platform.WINDOWS return Platform.WINDOWS
case 'darwin': case 'darwin':
return Platform.MAC return Platform.MAC
case 'linux': case 'linux':
return Platform.linux return Platform.linux
default: default:
console.error('Cannot resolve current platform!') console.error('Cannot resolve current platform!')
return undefined return undefined
} }
} }
builder.build({ builder.build({
targets: (process.argv[2] != null && Platform[process.argv[2]] != null ? Platform[process.argv[2]] : getCurrentPlatform()).createTarget(), targets: (process.argv[2] != null && Platform[process.argv[2]] != null ? Platform[process.argv[2]] : getCurrentPlatform()).createTarget(),
config: { config: {
appId: 'helioslauncher', appId: 'nemesismclauncher',
productName: 'Helios Launcher', productName: 'NemesisMC Launcher',
artifactName: '${productName}-setup-${version}.${ext}', artifactName: '${productName}-setup-${version}.${ext}',
copyright: 'Copyright © 2018-2020 Daniel Scalzi', copyright: 'Copyright © 2020 NemesisMC',
directories: { directories: {
buildResources: 'build', buildResources: 'build',
output: 'dist' output: 'dist'
}, },
win: { win: {
target: [ target: [
{ {
target: 'nsis', target: 'nsis',
arch: 'x64' arch: 'x64'
} }
] ]
}, },
nsis: { nsis: {
oneClick: false, oneClick: false,
perMachine: false, perMachine: false,
allowElevation: true, allowElevation: true,
allowToChangeInstallationDirectory: true allowToChangeInstallationDirectory: true
}, },
mac: { mac: {
target: 'dmg', target: 'dmg',
category: 'public.app-category.games' category: 'public.app-category.games'
}, },
linux: { linux: {
target: 'AppImage', target: 'AppImage',
maintainer: 'Daniel Scalzi', maintainer: 'MastermDEV, Daniel Scalzi',
vendor: 'Daniel Scalzi', vendor: 'NemesisMC',
synopsis: 'Modded Minecraft Launcher', synopsis: 'Offical NemesisMC Launcher',
description: 'Custom launcher which allows users to join modded servers. All mods, configurations, and updates are handled automatically.', description: 'Custom launcher which allows users to join NemesisMC.',
category: 'Game' category: 'Game'
}, },
compression: 'maximum', compression: 'maximum',
files: [ files: [
'!{dist,.gitignore,.vscode,docs,dev-app-update.yml,.travis.yml,.nvmrc,.eslintrc.json,build.js}' '!{dist,.gitignore,.vscode,docs,dev-app-update.yml,.travis.yml,.nvmrc,.eslintrc.json,build.js}'
], ],
extraResources: [ extraResources: [
'libraries' 'libraries'
], ],
asar: true asar: true
} }
}).then(() => { }).then(() => {
console.log('Build complete!') console.log('Build complete!')
}).catch(err => { }).catch(err => {
console.error('Error during build!', err) console.error('Error during build!', err)
}) })

View File

@ -1,3 +1,3 @@
owner: dscalzi owner: MastermDEV
repo: HeliosLauncher repo: NemesisMCLauncher
provider: github provider: github

454
index.js
View File

@ -1,228 +1,228 @@
// Requirements // Requirements
const { app, BrowserWindow, ipcMain, Menu } = require('electron') const { app, BrowserWindow, ipcMain, Menu } = require('electron')
const autoUpdater = require('electron-updater').autoUpdater const autoUpdater = require('electron-updater').autoUpdater
const ejse = require('ejs-electron') const ejse = require('ejs-electron')
const fs = require('fs') const fs = require('fs')
const isDev = require('./app/assets/js/isdev') const isDev = require('./app/assets/js/isdev')
const path = require('path') const path = require('path')
const semver = require('semver') const semver = require('semver')
const url = require('url') const url = require('url')
// Setup auto updater. // Setup auto updater.
function initAutoUpdater(event, data) { function initAutoUpdater(event, data) {
if(data){ if(data){
autoUpdater.allowPrerelease = true autoUpdater.allowPrerelease = true
} else { } else {
// Defaults to true if application version contains prerelease components (e.g. 0.12.1-alpha.1) // Defaults to true if application version contains prerelease components (e.g. 0.12.1-alpha.1)
// autoUpdater.allowPrerelease = true // autoUpdater.allowPrerelease = true
} }
if(isDev){ if(isDev){
autoUpdater.autoInstallOnAppQuit = false autoUpdater.autoInstallOnAppQuit = false
autoUpdater.updateConfigPath = path.join(__dirname, 'dev-app-update.yml') autoUpdater.updateConfigPath = path.join(__dirname, 'dev-app-update.yml')
} }
if(process.platform === 'darwin'){ if(process.platform === 'darwin'){
autoUpdater.autoDownload = false autoUpdater.autoDownload = false
} }
autoUpdater.on('update-available', (info) => { autoUpdater.on('update-available', (info) => {
event.sender.send('autoUpdateNotification', 'update-available', info) event.sender.send('autoUpdateNotification', 'update-available', info)
}) })
autoUpdater.on('update-downloaded', (info) => { autoUpdater.on('update-downloaded', (info) => {
event.sender.send('autoUpdateNotification', 'update-downloaded', info) event.sender.send('autoUpdateNotification', 'update-downloaded', info)
}) })
autoUpdater.on('update-not-available', (info) => { autoUpdater.on('update-not-available', (info) => {
event.sender.send('autoUpdateNotification', 'update-not-available', info) event.sender.send('autoUpdateNotification', 'update-not-available', info)
}) })
autoUpdater.on('checking-for-update', () => { autoUpdater.on('checking-for-update', () => {
event.sender.send('autoUpdateNotification', 'checking-for-update') event.sender.send('autoUpdateNotification', 'checking-for-update')
}) })
autoUpdater.on('error', (err) => { autoUpdater.on('error', (err) => {
event.sender.send('autoUpdateNotification', 'realerror', err) event.sender.send('autoUpdateNotification', 'realerror', err)
}) })
} }
// Open channel to listen for update actions. // Open channel to listen for update actions.
ipcMain.on('autoUpdateAction', (event, arg, data) => { ipcMain.on('autoUpdateAction', (event, arg, data) => {
switch(arg){ switch(arg){
case 'initAutoUpdater': case 'initAutoUpdater':
console.log('Initializing auto updater.') console.log('Initializing auto updater.')
initAutoUpdater(event, data) initAutoUpdater(event, data)
event.sender.send('autoUpdateNotification', 'ready') event.sender.send('autoUpdateNotification', 'ready')
break break
case 'checkForUpdate': case 'checkForUpdate':
autoUpdater.checkForUpdates() autoUpdater.checkForUpdates()
.catch(err => { .catch(err => {
event.sender.send('autoUpdateNotification', 'realerror', err) event.sender.send('autoUpdateNotification', 'realerror', err)
}) })
break break
case 'allowPrereleaseChange': case 'allowPrereleaseChange':
if(!data){ if(!data){
const preRelComp = semver.prerelease(app.getVersion()) const preRelComp = semver.prerelease(app.getVersion())
if(preRelComp != null && preRelComp.length > 0){ if(preRelComp != null && preRelComp.length > 0){
autoUpdater.allowPrerelease = true autoUpdater.allowPrerelease = true
} else { } else {
autoUpdater.allowPrerelease = data autoUpdater.allowPrerelease = data
} }
} else { } else {
autoUpdater.allowPrerelease = data autoUpdater.allowPrerelease = data
} }
break break
case 'installUpdateNow': case 'installUpdateNow':
autoUpdater.quitAndInstall() autoUpdater.quitAndInstall()
break break
default: default:
console.log('Unknown argument', arg) console.log('Unknown argument', arg)
break break
} }
}) })
// Redirect distribution index event from preloader to renderer. // Redirect distribution index event from preloader to renderer.
ipcMain.on('distributionIndexDone', (event, res) => { ipcMain.on('distributionIndexDone', (event, res) => {
event.sender.send('distributionIndexDone', res) event.sender.send('distributionIndexDone', res)
}) })
// Disable hardware acceleration. // Disable hardware acceleration.
// https://electronjs.org/docs/tutorial/offscreen-rendering // https://electronjs.org/docs/tutorial/offscreen-rendering
app.disableHardwareAcceleration() app.disableHardwareAcceleration()
// https://github.com/electron/electron/issues/18397 // https://github.com/electron/electron/issues/18397
app.allowRendererProcessReuse = true app.allowRendererProcessReuse = true
// Keep a global reference of the window object, if you don't, the window will // Keep a global reference of the window object, if you don't, the window will
// be closed automatically when the JavaScript object is garbage collected. // be closed automatically when the JavaScript object is garbage collected.
let win let win
function createWindow() { function createWindow() {
win = new BrowserWindow({ win = new BrowserWindow({
width: 980, width: 980,
height: 552, height: 552,
icon: getPlatformIcon('SealCircle'), icon: getPlatformIcon('SealCircle'),
frame: false, frame: false,
webPreferences: { webPreferences: {
preload: path.join(__dirname, 'app', 'assets', 'js', 'preloader.js'), preload: path.join(__dirname, 'app', 'assets', 'js', 'preloader.js'),
nodeIntegration: true, nodeIntegration: true,
contextIsolation: false contextIsolation: false
}, },
backgroundColor: '#171614' backgroundColor: '#171614'
}) })
ejse.data('bkid', Math.floor((Math.random() * fs.readdirSync(path.join(__dirname, 'app', 'assets', 'images', 'backgrounds')).length))) ejse.data('bkid', Math.floor((Math.random() * fs.readdirSync(path.join(__dirname, 'app', 'assets', 'images', 'backgrounds')).length)))
win.loadURL(url.format({ win.loadURL(url.format({
pathname: path.join(__dirname, 'app', 'app.ejs'), pathname: path.join(__dirname, 'app', 'app.ejs'),
protocol: 'file:', protocol: 'file:',
slashes: true slashes: true
})) }))
/*win.once('ready-to-show', () => { /*win.once('ready-to-show', () => {
win.show() win.show()
})*/ })*/
win.removeMenu() win.removeMenu()
win.resizable = true win.resizable = true
win.on('closed', () => { win.on('closed', () => {
win = null win = null
}) })
} }
function createMenu() { function createMenu() {
if(process.platform === 'darwin') { if(process.platform === 'darwin') {
// Extend default included application menu to continue support for quit keyboard shortcut // Extend default included application menu to continue support for quit keyboard shortcut
let applicationSubMenu = { let applicationSubMenu = {
label: 'Application', label: 'Application',
submenu: [{ submenu: [{
label: 'About Application', label: 'About Application',
selector: 'orderFrontStandardAboutPanel:' selector: 'orderFrontStandardAboutPanel:'
}, { }, {
type: 'separator' type: 'separator'
}, { }, {
label: 'Quit', label: 'Quit',
accelerator: 'Command+Q', accelerator: 'Command+Q',
click: () => { click: () => {
app.quit() app.quit()
} }
}] }]
} }
// New edit menu adds support for text-editing keyboard shortcuts // New edit menu adds support for text-editing keyboard shortcuts
let editSubMenu = { let editSubMenu = {
label: 'Edit', label: 'Edit',
submenu: [{ submenu: [{
label: 'Undo', label: 'Undo',
accelerator: 'CmdOrCtrl+Z', accelerator: 'CmdOrCtrl+Z',
selector: 'undo:' selector: 'undo:'
}, { }, {
label: 'Redo', label: 'Redo',
accelerator: 'Shift+CmdOrCtrl+Z', accelerator: 'Shift+CmdOrCtrl+Z',
selector: 'redo:' selector: 'redo:'
}, { }, {
type: 'separator' type: 'separator'
}, { }, {
label: 'Cut', label: 'Cut',
accelerator: 'CmdOrCtrl+X', accelerator: 'CmdOrCtrl+X',
selector: 'cut:' selector: 'cut:'
}, { }, {
label: 'Copy', label: 'Copy',
accelerator: 'CmdOrCtrl+C', accelerator: 'CmdOrCtrl+C',
selector: 'copy:' selector: 'copy:'
}, { }, {
label: 'Paste', label: 'Paste',
accelerator: 'CmdOrCtrl+V', accelerator: 'CmdOrCtrl+V',
selector: 'paste:' selector: 'paste:'
}, { }, {
label: 'Select All', label: 'Select All',
accelerator: 'CmdOrCtrl+A', accelerator: 'CmdOrCtrl+A',
selector: 'selectAll:' selector: 'selectAll:'
}] }]
} }
// Bundle submenus into a single template and build a menu object with it // Bundle submenus into a single template and build a menu object with it
let menuTemplate = [applicationSubMenu, editSubMenu] let menuTemplate = [applicationSubMenu, editSubMenu]
let menuObject = Menu.buildFromTemplate(menuTemplate) let menuObject = Menu.buildFromTemplate(menuTemplate)
// Assign it to the application // Assign it to the application
Menu.setApplicationMenu(menuObject) Menu.setApplicationMenu(menuObject)
} }
} }
function getPlatformIcon(filename){ function getPlatformIcon(filename){
let ext let ext
switch(process.platform) { switch(process.platform) {
case 'win32': case 'win32':
ext = 'ico' ext = 'ico'
break break
case 'darwin': case 'darwin':
case 'linux': case 'linux':
default: default:
ext = 'png' ext = 'png'
break break
} }
return path.join(__dirname, 'app', 'assets', 'images', `${filename}.${ext}`) return path.join(__dirname, 'app', 'assets', 'images', `${filename}.${ext}`)
} }
app.on('ready', createWindow) app.on('ready', createWindow)
app.on('ready', createMenu) app.on('ready', createMenu)
app.on('window-all-closed', () => { app.on('window-all-closed', () => {
// On macOS it is common for applications and their menu bar // On macOS it is common for applications and their menu bar
// to stay active until the user quits explicitly with Cmd + Q // to stay active until the user quits explicitly with Cmd + Q
if (process.platform !== 'darwin') { if (process.platform !== 'darwin') {
app.quit() app.quit()
} }
}) })
app.on('activate', () => { app.on('activate', () => {
// On macOS it's common to re-create a window in the app when the // On macOS it's common to re-create a window in the app when the
// dock icon is clicked and there are no other windows open. // dock icon is clicked and there are no other windows open.
if (win === null) { if (win === null) {
createWindow() createWindow()
} }
}) })

6970
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,13 +1,13 @@
{ {
"name": "helioslauncher", "name": "nemesismclauncher",
"version": "1.7.0", "version": "0.0.1",
"productName": "Helios Launcher", "productName": "NemesisMC Launcher",
"description": "Modded Minecraft Launcher", "description": "NemesisMC Launcher",
"author": "Daniel Scalzi (https://github.com/dscalzi/)", "author": "MastermDEV (https://github.com/MastermDEV/), Daniel Scalzi (https://github.com/dscalzi/)",
"license": "UNLICENSED", "license": "UNLICENSED",
"homepage": "https://github.com/dscalzi/HeliosLauncher", "homepage": "https://nemesismc.net",
"bugs": { "bugs": {
"url": "https://github.com/dscalzi/HeliosLauncher/issues" "url": "https://github.com/MastermDEV/NemesisMC-Launcher/issues"
}, },
"private": true, "private": true,
"main": "index.js", "main": "index.js",
@ -47,6 +47,6 @@
}, },
"repository": { "repository": {
"type": "git", "type": "git",
"url": "git+https://github.com/dscalzi/HeliosLauncher.git" "url": "git+https://github.com/MastermDEV/NemesisMC-Launcher.git"
} }
} }