mirror of
https://github.com/dscalzi/HeliosLauncher.git
synced 2024-12-22 11:42:14 -08:00
Break up assetguard.
This commit is contained in:
parent
1fc118ee8c
commit
5c0a293390
@ -1,8 +1,14 @@
|
|||||||
const { AssetGuard } = require('./assetguard')
|
let target = require('./assetguard')[process.argv[2]]
|
||||||
|
if(target == null){
|
||||||
|
process.send({context: 'error', data: null, error: 'Invalid class name'})
|
||||||
|
console.error('Invalid class name passed to argv[2], cannot continue.')
|
||||||
|
process.exit(1)
|
||||||
|
}
|
||||||
|
let tracker = new target(...(process.argv.splice(3)))
|
||||||
|
|
||||||
process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0'
|
process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0'
|
||||||
|
|
||||||
const tracker = new AssetGuard(process.argv[2], process.argv[3])
|
//const tracker = new AssetGuard(process.argv[2], process.argv[3])
|
||||||
console.log('AssetExec Started')
|
console.log('AssetExec Started')
|
||||||
|
|
||||||
// Temporary for debug purposes.
|
// Temporary for debug purposes.
|
||||||
@ -24,8 +30,8 @@ tracker.on('error', (data, error) => {
|
|||||||
process.on('message', (msg) => {
|
process.on('message', (msg) => {
|
||||||
if(msg.task === 'execute'){
|
if(msg.task === 'execute'){
|
||||||
const func = msg.function
|
const func = msg.function
|
||||||
let nS = tracker[func]
|
let nS = tracker[func] // Nonstatic context
|
||||||
let iS = AssetGuard[func]
|
let iS = target[func] // Static context
|
||||||
if(typeof nS === 'function' || typeof iS === 'function'){
|
if(typeof nS === 'function' || typeof iS === 'function'){
|
||||||
const f = typeof nS === 'function' ? nS : iS
|
const f = typeof nS === 'function' ? nS : iS
|
||||||
const res = f.apply(f === nS ? tracker : null, msg.argsArr)
|
const res = f.apply(f === nS ? tracker : null, msg.argsArr)
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -6,7 +6,7 @@ const os = require('os')
|
|||||||
const path = require('path')
|
const path = require('path')
|
||||||
const { URL } = require('url')
|
const { URL } = require('url')
|
||||||
|
|
||||||
const { AssetGuard, Library } = require('./assetguard')
|
const { Util, Library } = require('./assetguard')
|
||||||
const ConfigManager = require('./configmanager')
|
const ConfigManager = require('./configmanager')
|
||||||
const DistroManager = require('./distromanager')
|
const DistroManager = require('./distromanager')
|
||||||
const LoggerUtil = require('./loggerutil')
|
const LoggerUtil = require('./loggerutil')
|
||||||
@ -43,7 +43,7 @@ class ProcessBuilder {
|
|||||||
const modObj = this.resolveModConfiguration(ConfigManager.getModConfiguration(this.server.getID()).mods, this.server.getModules())
|
const modObj = this.resolveModConfiguration(ConfigManager.getModConfiguration(this.server.getID()).mods, this.server.getModules())
|
||||||
|
|
||||||
// Mod list below 1.13
|
// Mod list below 1.13
|
||||||
if(!AssetGuard.mcVersionAtLeast('1.13', this.server.getMinecraftVersion())){
|
if(!Util.mcVersionAtLeast('1.13', this.server.getMinecraftVersion())){
|
||||||
this.constructModList('forge', modObj.fMods, true)
|
this.constructModList('forge', modObj.fMods, true)
|
||||||
if(this.usingLiteLoader){
|
if(this.usingLiteLoader){
|
||||||
this.constructModList('liteloader', modObj.lMods, true)
|
this.constructModList('liteloader', modObj.lMods, true)
|
||||||
@ -53,7 +53,7 @@ class ProcessBuilder {
|
|||||||
const uberModArr = modObj.fMods.concat(modObj.lMods)
|
const uberModArr = modObj.fMods.concat(modObj.lMods)
|
||||||
let args = this.constructJVMArguments(uberModArr, tempNativePath)
|
let args = this.constructJVMArguments(uberModArr, tempNativePath)
|
||||||
|
|
||||||
if(AssetGuard.mcVersionAtLeast('1.13', this.server.getMinecraftVersion())){
|
if(Util.mcVersionAtLeast('1.13', this.server.getMinecraftVersion())){
|
||||||
args = args.concat(this.constructModArguments(modObj.fMods))
|
args = args.concat(this.constructModArguments(modObj.fMods))
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -273,7 +273,7 @@ class ProcessBuilder {
|
|||||||
* @returns {Array.<string>} An array containing the full JVM arguments for this process.
|
* @returns {Array.<string>} An array containing the full JVM arguments for this process.
|
||||||
*/
|
*/
|
||||||
constructJVMArguments(mods, tempNativePath){
|
constructJVMArguments(mods, tempNativePath){
|
||||||
if(AssetGuard.mcVersionAtLeast('1.13', this.server.getMinecraftVersion())){
|
if(Util.mcVersionAtLeast('1.13', this.server.getMinecraftVersion())){
|
||||||
return this._constructJVMArguments113(mods, tempNativePath)
|
return this._constructJVMArguments113(mods, tempNativePath)
|
||||||
} else {
|
} else {
|
||||||
return this._constructJVMArguments112(mods, tempNativePath)
|
return this._constructJVMArguments112(mods, tempNativePath)
|
||||||
|
@ -96,7 +96,8 @@ document.getElementById('launch_button').addEventListener('click', function(e){
|
|||||||
toggleLaunchArea(true)
|
toggleLaunchArea(true)
|
||||||
setLaunchPercentage(0, 100)
|
setLaunchPercentage(0, 100)
|
||||||
|
|
||||||
AssetGuard._validateJavaBinary(jExe, mcVersion).then((v) => {
|
const jg = new JavaGuard(mcVersion)
|
||||||
|
jg._validateJavaBinary(jExe).then((v) => {
|
||||||
loggerLanding.log('Java version meta', v)
|
loggerLanding.log('Java version meta', v)
|
||||||
if(v.valid){
|
if(v.valid){
|
||||||
dlAsync()
|
dlAsync()
|
||||||
@ -297,8 +298,8 @@ function asyncSystemScan(mcVersion, launchAfter = true){
|
|||||||
|
|
||||||
// Fork a process to run validations.
|
// Fork a process to run validations.
|
||||||
sysAEx = cp.fork(path.join(__dirname, 'assets', 'js', 'assetexec.js'), [
|
sysAEx = cp.fork(path.join(__dirname, 'assets', 'js', 'assetexec.js'), [
|
||||||
ConfigManager.getCommonDirectory(),
|
'JavaGuard',
|
||||||
ConfigManager.getJavaExecutable()
|
mcVersion
|
||||||
], {
|
], {
|
||||||
env: forkEnv,
|
env: forkEnv,
|
||||||
stdio: 'pipe'
|
stdio: 'pipe'
|
||||||
@ -452,7 +453,7 @@ function asyncSystemScan(mcVersion, launchAfter = true){
|
|||||||
|
|
||||||
// Begin system Java scan.
|
// Begin system Java scan.
|
||||||
setLaunchDetails('Checking system info..')
|
setLaunchDetails('Checking system info..')
|
||||||
sysAEx.send({task: 'execute', function: 'validateJava', argsArr: [ConfigManager.getDataDirectory(), mcVersion]})
|
sysAEx.send({task: 'execute', function: 'validateJava', argsArr: [ConfigManager.getDataDirectory()]})
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -496,6 +497,7 @@ function dlAsync(login = true){
|
|||||||
|
|
||||||
// Start AssetExec to run validations and downloads in a forked process.
|
// Start AssetExec to run validations and downloads in a forked process.
|
||||||
aEx = cp.fork(path.join(__dirname, 'assets', 'js', 'assetexec.js'), [
|
aEx = cp.fork(path.join(__dirname, 'assets', 'js', 'assetexec.js'), [
|
||||||
|
'AssetGuard',
|
||||||
ConfigManager.getCommonDirectory(),
|
ConfigManager.getCommonDirectory(),
|
||||||
ConfigManager.getJavaExecutable()
|
ConfigManager.getJavaExecutable()
|
||||||
], {
|
], {
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
const os = require('os')
|
const os = require('os')
|
||||||
const semver = require('semver')
|
const semver = require('semver')
|
||||||
|
|
||||||
const { AssetGuard } = require('./assets/js/assetguard')
|
const { JavaGuard } = require('./assets/js/assetguard')
|
||||||
const DropinModUtil = require('./assets/js/dropinmodutil')
|
const DropinModUtil = require('./assets/js/dropinmodutil')
|
||||||
|
|
||||||
const settingsState = {
|
const settingsState = {
|
||||||
@ -1117,7 +1117,8 @@ function populateMemoryStatus(){
|
|||||||
* @param {string} execPath The executable path to populate against.
|
* @param {string} execPath The executable path to populate against.
|
||||||
*/
|
*/
|
||||||
function populateJavaExecDetails(execPath){
|
function populateJavaExecDetails(execPath){
|
||||||
AssetGuard._validateJavaBinary(execPath).then(v => {
|
const jg = new JavaGuard(DistroManager.getDistribution().getServer(ConfigManager.getSelectedServer()).getMinecraftVersion())
|
||||||
|
jg._validateJavaBinary(execPath).then(v => {
|
||||||
if(v.valid){
|
if(v.valid){
|
||||||
if(v.version.major < 9) {
|
if(v.version.major < 9) {
|
||||||
settingsJavaExecDetails.innerHTML = `Selected: Java ${v.version.major} Update ${v.version.update} (x${v.arch})`
|
settingsJavaExecDetails.innerHTML = `Selected: Java ${v.version.major} Update ${v.version.update} (x${v.arch})`
|
||||||
@ -1326,4 +1327,4 @@ function prepareSettings(first = false) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Prepare the settings UI on startup.
|
// Prepare the settings UI on startup.
|
||||||
prepareSettings(true)
|
//prepareSettings(true)
|
@ -61,6 +61,7 @@ function showMainUI(data){
|
|||||||
ipcRenderer.send('autoUpdateAction', 'initAutoUpdater', ConfigManager.getAllowPrerelease())
|
ipcRenderer.send('autoUpdateAction', 'initAutoUpdater', ConfigManager.getAllowPrerelease())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
prepareSettings(true)
|
||||||
updateSelectedServer(data.getServer(ConfigManager.getSelectedServer()))
|
updateSelectedServer(data.getServer(ConfigManager.getSelectedServer()))
|
||||||
refreshServerStatus()
|
refreshServerStatus()
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
|
Loading…
Reference in New Issue
Block a user