Skip to content

Commit

Permalink
Squashed commit of the following:
Browse files Browse the repository at this point in the history
commit 3a301b2
Merge: 8eed153 54e6572
Author: Jay <[email protected]>
Date:   Tue Aug 24 16:26:59 2021 +0200

    Merge branch 'master' of https://github.com/dscalzi/HeliosLauncher into dscalzi-master

commit 54e6572
Author: Peter <[email protected]>
Date:   Mon Jul 19 16:08:55 2021 +0100

    Use MCHeads instead of Crafatar (dscalzi#181)

    * Update landing.js

    This changes the Skin/Avatar server displayed on the landing page to one that displays the hat layer which then features the skin correctly.

    * Create landing.js

    This changes the Skin/Avatar server displayed on the landing page to one that displays the hat layer which then features the skin correctly.

    * Updated remaining Crafatar URLS

    Changed Crafatar URLS to matching mc-heads url.

commit 79135f3
Author: ZaptoInc <[email protected]>
Date:   Mon Jul 19 07:40:28 2021 +0200

    Fixed broken links on the login page (dscalzi#159)

commit 31a51b8
Author: Daniel Scalzi <[email protected]>
Date:   Mon Jul 19 00:52:57 2021 -0400

    MIT license.

commit 84c13e6
Author: Daniel Scalzi <[email protected]>
Date:   Thu Jun 24 18:22:29 2021 -0400

    Update PackXZExtract.

commit 1b48ad5
Author: Daniel Scalzi <[email protected]>
Date:   Wed Jun 23 20:46:00 2021 -0400

    Revert discord-rpc.

commit 2c487f7
Author: Daniel Scalzi <[email protected]>
Date:   Wed Jun 23 20:27:04 2021 -0400

    Electron 13.

    Deleting drop-in mods seems to be broken. If you're having this issue,
    please comment on this issue so electron fixes it.. electron/electron#29598

commit 61dbabd
Author: Daniel Scalzi <[email protected]>
Date:   Thu May 13 22:34:37 2021 -0400

    Dependency upgrade.

commit cd1ca7e
Author: Daniel Scalzi <[email protected]>
Date:   Thu May 13 21:49:18 2021 -0400

    Add support for building arm64 dmg (Apple Silicon processors) (dscalzi#157).

commit be4a42b
Author: Daniel Scalzi <[email protected]>
Date:   Thu May 13 21:06:59 2021 -0400

    Use GitHub Actions for building, refactor the builder configuration.

commit 48d0c9e
Author: Daniel Scalzi <[email protected]>
Date:   Tue Mar 23 18:57:16 2021 -0400

    Dependency upgrade.

commit a9fa7c4
Author: Daniel Scalzi <[email protected]>
Date:   Sun Mar 7 11:24:00 2021 -0500

    Upgrade xcode, node version on travis.

commit cb8d1bb
Author: Daniel Scalzi <[email protected]>
Date:   Sun Mar 7 11:17:23 2021 -0500

    Electron 12, Node 14, dependency upgrade.

commit 2743585
Author: Daniel Scalzi <[email protected]>
Date:   Mon Feb 1 18:04:52 2021 -0500

    Dependency upgrade, fix status (dscalzi#138).

commit a6ca2e8
Author: Daniel Scalzi <[email protected]>
Date:   Wed Jan 20 11:03:20 2021 -0500

    Update executable names on README.

commit 779a9a5
Author: Daniel Scalzi <[email protected]>
Date:   Fri Dec 11 16:00:55 2020 -0500

    Dependency upgrade.

commit 8723a19
Author: Daniel Scalzi <[email protected]>
Date:   Wed Dec 9 20:06:10 2020 -0500

    Minecraft.net status works again, dependency upgrade.

commit c93d492
Author: Daniel Scalzi <[email protected]>
Date:   Mon Nov 16 23:11:24 2020 -0500

    Electron 11, workaround for main process debugging in VS Code.

commit d48abf4
Author: Daniel Scalzi <[email protected]>
Date:   Mon Nov 9 19:25:37 2020 -0500

    Dependency upgrade.

commit 3ea41b4
Author: Daniel Scalzi <[email protected]>
Date:   Wed Sep 16 13:49:10 2020 -0400

    Point to https mojang endpoint.

commit faa5f52
Author: Daniel Scalzi <[email protected]>
Date:   Sun Sep 13 13:42:34 2020 -0400

    v1.8.0

commit c0776dc
Author: Daniel Scalzi <[email protected]>
Date:   Sun Sep 13 13:35:49 2020 -0400

    Set broken mojang services to green until their API is fixed.

commit 25e7e5a
Author: Daniel Scalzi <[email protected]>
Date:   Sun Sep 13 03:05:08 2020 -0400

    Tweaks to Java discovery.

    Add AdoptOpenJDK directory to the file scan.
    Remove TLS reject unauthorized flag.
    Use async/await for the fs scan function. Code was originally wrote
    using fs and not fs-extra.

commit 17e36fa
Author: Daniel Scalzi <[email protected]>
Date:   Sun Sep 13 02:22:24 2020 -0400

    Return after rejection.

commit 2156099
Author: Daniel Scalzi <[email protected]>
Date:   Sun Sep 13 02:10:11 2020 -0400

    Electron 10.

commit 9a2c1fd
Author: Daniel Scalzi <[email protected]>
Date:   Tue Sep 8 21:25:19 2020 -0400

    Use corretto on macOS since they use an older version of Xcode. (dscalzi#70)

    Vendor name is now displayed above the selected Java version on the settings page. This is to allow for easier differentiation between versions (ex. Amazon Corretto vs AdoptOpenJDK).

commit cc86f2a
Author: Daniel Scalzi <[email protected]>
Date:   Sat Sep 5 22:43:09 2020 -0400

    Use --fml.modLists instead of --fml.mods to avoid potential cli length limit issues.

commit e6897da
Author: Daniel Scalzi <[email protected]>
Date:   Wed Sep 2 19:10:28 2020 -0400

    Dependency upgrade.

commit bd19b16
Author: Daniel Scalzi <[email protected]>
Date:   Tue Aug 25 17:11:40 2020 -0400

    Include user's displayName in server joined regex.
  • Loading branch information
ASCIIcat committed Aug 24, 2021
1 parent 8eed153 commit c29b839
Show file tree
Hide file tree
Showing 23 changed files with 1,462 additions and 953 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Build/release

on: push

jobs:
release:
runs-on: ${{ matrix.os }}

strategy:
matrix:
os: [macos-latest, ubuntu-latest, windows-latest]

steps:
- name: Check out Git repository
uses: actions/checkout@v1

- name: Install Node.js, NPM and Yarn
uses: actions/setup-node@v1
with:
node-version: 14

- name: Build/release Electron app
uses: samuelmeuli/action-electron-builder@v1
with:
github_token: ${{ secrets.github_token }}

# If the commit is tagged with a version (e.g. "v1.0.0"),
# release the app after building
release: ${{ startsWith(github.ref, 'refs/tags/v') }}
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
12
14
45 changes: 0 additions & 45 deletions .travis.yml

This file was deleted.

21 changes: 21 additions & 0 deletions LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2017-2021 Daniel D. Scalzi

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
30 changes: 11 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,10 @@ If you download from the [Releases](https://github.com/dscalzi/HeliosLauncher/re

| Platform | File |
| -------- | ---- |
| Windows x64 | `helioslauncher-setup-VERSION.exe` |
| macOS | `helioslauncher-VERSION.dmg` |
| Linux x64 | `helioslauncher-VERSION-x86_64.AppImage` |
| Windows x64 | `Helios-Launcher-setup-VERSION.exe` |
| macOS x64 | `Helios-Launcher-setup-VERSION.dmg` |
| macOS arm64 | `Helios-Launcher-setup-VERSION-arm64.dmg` |
| Linux x64 | `Helios-Launcher-setup-VERSION.AppImage` |

## Console

Expand All @@ -76,11 +77,13 @@ If you want to export the console output, simply right click anywhere on the con

## Development

This section details the setup of a basic developmentment environment.

### Getting Started

**System Requirements**

* [Node.js][nodejs] v12
* [Node.js][nodejs] v14

---

Expand Down Expand Up @@ -137,13 +140,9 @@ Paste the following into `.vscode/launch.json`
"type": "node",
"request": "launch",
"cwd": "${workspaceFolder}",
"runtimeExecutable": "${workspaceFolder}/node_modules/.bin/electron",
"windows": {
"runtimeExecutable": "${workspaceFolder}/node_modules/.bin/electron.cmd"
},
"args": ["."],
"console": "integratedTerminal",
"protocol": "inspector"
"program": "${workspaceFolder}/node_modules/electron/cli.js",
"args" : ["."],
"outputCapture": "std"
},
{
"name": "Debug Renderer Process",
Expand Down Expand Up @@ -179,14 +178,7 @@ Note that you **cannot** open the DevTools window while using this debug configu

### Note on Third-Party Usage

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).
* 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.
* 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.
Please give credit to the original author and provide a link to the original source. This is free software, please do at least this much.

---

Expand Down
2 changes: 0 additions & 2 deletions app/assets/js/assetexec.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ if(target == null){
}
let tracker = new target(...(process.argv.splice(3)))

process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0'

//const tracker = new AssetGuard(process.argv[2], process.argv[3])
console.log('AssetExec Started')

Expand Down
123 changes: 81 additions & 42 deletions app/assets/js/assetguard.js
Original file line number Diff line number Diff line change
Expand Up @@ -266,14 +266,27 @@ class JavaGuard extends EventEmitter {
*/

/**
* Fetch the last open JDK binary. Uses https://api.adoptopenjdk.net/
* Fetch the last open JDK binary.
*
* HOTFIX: Uses Corretto 8 for macOS.
* See: https://github.com/dscalzi/HeliosLauncher/issues/70
* See: https://github.com/AdoptOpenJDK/openjdk-support/issues/101
*
* @param {string} major The major version of Java to fetch.
*
* @returns {Promise.<OpenJDKData>} Promise which resolved to an object containing the JRE download data.
*/
static _latestOpenJDK(major = '8'){

if(process.platform === 'darwin') {
return this._latestCorretto(major)
} else {
return this._latestAdoptOpenJDK(major)
}
}

static _latestAdoptOpenJDK(major) {

const sanitizedOS = process.platform === 'win32' ? 'windows' : (process.platform === 'darwin' ? 'mac' : process.platform)

const url = `https://api.adoptopenjdk.net/v2/latestAssets/nightly/openjdk${major}?os=${sanitizedOS}&arch=x64&heap_size=normal&openjdk_impl=hotspot&type=jre`
Expand All @@ -291,6 +304,48 @@ class JavaGuard extends EventEmitter {
}
})
})

}

static _latestCorretto(major) {

let sanitizedOS, ext

switch(process.platform) {
case 'win32':
sanitizedOS = 'windows'
ext = 'zip'
break
case 'darwin':
sanitizedOS = 'macos'
ext = 'tar.gz'
break
case 'linux':
sanitizedOS = 'linux'
ext = 'tar.gz'
break
default:
sanitizedOS = process.platform
ext = 'tar.gz'
break
}

const url = `https://corretto.aws/downloads/latest/amazon-corretto-${major}-x64-${sanitizedOS}-jdk.${ext}`

return new Promise((resolve, reject) => {
request.head({url, json: true}, (err, resp) => {
if(!err && resp.statusCode === 200){
resolve({
uri: url,
size: parseInt(resp.headers['content-length']),
name: url.substr(url.lastIndexOf('/')+1)
})
} else {
resolve(null)
}
})
})

}

/**
Expand Down Expand Up @@ -455,6 +510,11 @@ class JavaGuard extends EventEmitter {
} */
}
}
// Space included so we get only the vendor.
} else if(props[i].lastIndexOf('java.vendor ') > -1) {
let vendorName = props[i].split('=')[1].trim()
console.log(props[i].trim())
meta.vendor = vendorName
}
}

Expand Down Expand Up @@ -649,51 +709,26 @@ class JavaGuard extends EventEmitter {
* @returns {Promise.<Set.<string>>} A promise which resolves to a set of the discovered
* root JVM folders.
*/
static _scanFileSystem(scanDir){
return new Promise((resolve, reject) => {

fs.exists(scanDir, (e) => {
static async _scanFileSystem(scanDir){

let res = new Set()

if(e){
fs.readdir(scanDir, (err, files) => {
if(err){
resolve(res)
console.log(err)
} else {
let pathsDone = 0
let res = new Set()

for(let i=0; i<files.length; i++){
if(await fs.pathExists(scanDir)) {

const combinedPath = path.join(scanDir, files[i])
const execPath = JavaGuard.javaExecFromRoot(combinedPath)
const files = await fs.readdir(scanDir)
for(let i=0; i<files.length; i++){

fs.exists(execPath, (v) => {
const combinedPath = path.join(scanDir, files[i])
const execPath = JavaGuard.javaExecFromRoot(combinedPath)

if(v){
res.add(combinedPath)
}

++pathsDone

if(pathsDone === files.length){
resolve(res)
}

})
}
if(pathsDone === files.length){
resolve(res)
}
}
})
} else {
resolve(res)
if(await fs.pathExists(execPath)) {
res.add(combinedPath)
}
})
}
}

return res

})
}

/**
Expand Down Expand Up @@ -799,9 +834,13 @@ class JavaGuard extends EventEmitter {

// Get possible paths from the registry.
let pathSet1 = await JavaGuard._scanRegistry()
if(pathSet1.length === 0){
if(pathSet1.size === 0){
// Do a manual file system scan of program files.
pathSet1 = JavaGuard._scanFileSystem('C:\\Program Files\\Java')
pathSet1 = new Set([
...pathSet1,
...(await JavaGuard._scanFileSystem('C:\\Program Files\\Java')),
...(await JavaGuard._scanFileSystem('C:\\Program Files\\AdoptOpenJDK'))
])
}

// Get possible paths from the data directory.
Expand Down Expand Up @@ -1292,7 +1331,7 @@ class AssetGuard extends EventEmitter {
return new Promise((resolve, reject) => {

//Asset constants
const resourceURL = 'http://resources.download.minecraft.net/'
const resourceURL = 'https://resources.download.minecraft.net/'
const localPath = path.join(self.commonPath, 'assets')
const objectPath = path.join(localPath, 'objects')

Expand Down
2 changes: 1 addition & 1 deletion app/assets/js/configmanager.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const sysRoot = process.env.APPDATA || (process.platform == 'darwin' ? process.e
const dataPath = path.join(sysRoot, '.avalonConcordialauncher')

// Forked processes do not have access to electron, so we have this workaround.
const launcherDir = process.env.CONFIG_DIRECT_PATH || require('electron').remote.app.getPath('userData')
const launcherDir = process.env.CONFIG_DIRECT_PATH || require('@electron/remote').app.getPath('userData')

/**
* Retrieve the absolute path of the launcher directory.
Expand Down
6 changes: 6 additions & 0 deletions app/assets/js/distromanager.js
Original file line number Diff line number Diff line change
Expand Up @@ -551,17 +551,21 @@ exports.pullRemote = function(){
data = DistroIndex.fromJSON(JSON.parse(body))
} catch (e) {
reject(e)
return
}

fs.writeFile(distroDest, body, 'utf-8', (err) => {
if(!err){
resolve(data)
return
} else {
reject(err)
return
}
})
} else {
reject(error)
return
}
})
})
Expand All @@ -576,8 +580,10 @@ exports.pullLocal = function(){
if(!err){
data = DistroIndex.fromJSON(JSON.parse(d))
resolve(data)
return
} else {
reject(err)
return
}
})
})
Expand Down
Loading

0 comments on commit c29b839

Please sign in to comment.