|
@@ -21,6 +21,8 @@ const launch_details_text = document.getElementById('launch_details_text')
|
|
|
const server_selection_button = document.getElementById('server_selection_button')
|
|
const server_selection_button = document.getElementById('server_selection_button')
|
|
|
const user_text = document.getElementById('user_text')
|
|
const user_text = document.getElementById('user_text')
|
|
|
|
|
|
|
|
|
|
+const loggerLanding = LoggerUtil('%c[Landing]', 'color: #000668; font-weight: bold')
|
|
|
|
|
+
|
|
|
/* Launch Progress Wrapper Functions */
|
|
/* Launch Progress Wrapper Functions */
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -83,7 +85,7 @@ function setLaunchEnabled(val){
|
|
|
|
|
|
|
|
// Bind launch button
|
|
// Bind launch button
|
|
|
document.getElementById('launch_button').addEventListener('click', function(e){
|
|
document.getElementById('launch_button').addEventListener('click', function(e){
|
|
|
- console.log('Launching game..')
|
|
|
|
|
|
|
+ loggerLanding.log('Launching game..')
|
|
|
const jExe = ConfigManager.getJavaExecutable()
|
|
const jExe = ConfigManager.getJavaExecutable()
|
|
|
if(jExe == null){
|
|
if(jExe == null){
|
|
|
asyncSystemScan()
|
|
asyncSystemScan()
|
|
@@ -94,7 +96,7 @@ document.getElementById('launch_button').addEventListener('click', function(e){
|
|
|
setLaunchPercentage(0, 100)
|
|
setLaunchPercentage(0, 100)
|
|
|
|
|
|
|
|
AssetGuard._validateJavaBinary(jExe).then((v) => {
|
|
AssetGuard._validateJavaBinary(jExe).then((v) => {
|
|
|
- console.log(v)
|
|
|
|
|
|
|
+ loggerLanding.log('Java version meta', v)
|
|
|
if(v.valid){
|
|
if(v.valid){
|
|
|
dlAsync()
|
|
dlAsync()
|
|
|
} else {
|
|
} else {
|
|
@@ -152,7 +154,7 @@ server_selection_button.onclick = (e) => {
|
|
|
|
|
|
|
|
// Update Mojang Status Color
|
|
// Update Mojang Status Color
|
|
|
const refreshMojangStatuses = async function(){
|
|
const refreshMojangStatuses = async function(){
|
|
|
- console.log('Refreshing Mojang Statuses..')
|
|
|
|
|
|
|
+ loggerLanding.log('Refreshing Mojang Statuses..')
|
|
|
|
|
|
|
|
let status = 'grey'
|
|
let status = 'grey'
|
|
|
let tooltipEssentialHTML = ''
|
|
let tooltipEssentialHTML = ''
|
|
@@ -200,8 +202,8 @@ const refreshMojangStatuses = async function(){
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
} catch (err) {
|
|
} catch (err) {
|
|
|
- console.warn('Unable to refresh Mojang service status.')
|
|
|
|
|
- console.debug(err)
|
|
|
|
|
|
|
+ loggerLanding.warn('Unable to refresh Mojang service status.')
|
|
|
|
|
+ loggerLanding.debug(err)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
document.getElementById('mojangStatusEssentialContainer').innerHTML = tooltipEssentialHTML
|
|
document.getElementById('mojangStatusEssentialContainer').innerHTML = tooltipEssentialHTML
|
|
@@ -210,7 +212,7 @@ const refreshMojangStatuses = async function(){
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
const refreshServerStatus = async function(fade = false){
|
|
const refreshServerStatus = async function(fade = false){
|
|
|
- console.log('Refreshing Server Status')
|
|
|
|
|
|
|
+ loggerLanding.log('Refreshing Server Status')
|
|
|
const serv = DistroManager.getDistribution().getServer(ConfigManager.getSelectedServer())
|
|
const serv = DistroManager.getDistribution().getServer(ConfigManager.getSelectedServer())
|
|
|
|
|
|
|
|
let pLabel = 'SERVER'
|
|
let pLabel = 'SERVER'
|
|
@@ -225,8 +227,8 @@ const refreshServerStatus = async function(fade = false){
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
} catch (err) {
|
|
} catch (err) {
|
|
|
- console.warn('Unable to refresh server status, assuming offline.')
|
|
|
|
|
- console.debug(err)
|
|
|
|
|
|
|
+ loggerLanding.warn('Unable to refresh server status, assuming offline.')
|
|
|
|
|
+ loggerLanding.debug(err)
|
|
|
}
|
|
}
|
|
|
if(fade){
|
|
if(fade){
|
|
|
$('#server_status_wrapper').fadeOut(250, () => {
|
|
$('#server_status_wrapper').fadeOut(250, () => {
|
|
@@ -261,6 +263,8 @@ function asyncSystemScan(launchAfter = true){
|
|
|
toggleLaunchArea(true)
|
|
toggleLaunchArea(true)
|
|
|
setLaunchPercentage(0, 100)
|
|
setLaunchPercentage(0, 100)
|
|
|
|
|
|
|
|
|
|
+ const loggerSysAEx = LoggerUtil('%c[SysAEx]', 'color: #353232; font-weight: bold')
|
|
|
|
|
+
|
|
|
// 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(),
|
|
ConfigManager.getCommonDirectory(),
|
|
@@ -269,12 +273,14 @@ function asyncSystemScan(launchAfter = true){
|
|
|
stdio: 'pipe'
|
|
stdio: 'pipe'
|
|
|
})
|
|
})
|
|
|
// Stdout
|
|
// Stdout
|
|
|
|
|
+ sysAEx.stdio[1].setEncoding('utf8')
|
|
|
sysAEx.stdio[1].on('data', (data) => {
|
|
sysAEx.stdio[1].on('data', (data) => {
|
|
|
- console.log('%c[SysAEx]', 'color: #353232; font-weight: bold', data.toString('utf-8'))
|
|
|
|
|
|
|
+ loggerSysAEx.log(data)
|
|
|
})
|
|
})
|
|
|
// Stderr
|
|
// Stderr
|
|
|
|
|
+ sysAEx.stdio[2].setEncoding('utf8')
|
|
|
sysAEx.stdio[2].on('data', (data) => {
|
|
sysAEx.stdio[2].on('data', (data) => {
|
|
|
- console.log('%c[SysAEx]', 'color: #353232; font-weight: bold', data.toString('utf-8'))
|
|
|
|
|
|
|
+ loggerSysAEx.log(data)
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
sysAEx.on('message', (m) => {
|
|
sysAEx.on('message', (m) => {
|
|
@@ -442,8 +448,7 @@ function dlAsync(login = true){
|
|
|
|
|
|
|
|
if(login) {
|
|
if(login) {
|
|
|
if(ConfigManager.getSelectedAccount() == null){
|
|
if(ConfigManager.getSelectedAccount() == null){
|
|
|
- console.error('login first.')
|
|
|
|
|
- //in devtools AuthManager.addAccount(username, pass)
|
|
|
|
|
|
|
+ loggerLanding.error('You must be logged into an account.')
|
|
|
return
|
|
return
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -452,6 +457,9 @@ function dlAsync(login = true){
|
|
|
toggleLaunchArea(true)
|
|
toggleLaunchArea(true)
|
|
|
setLaunchPercentage(0, 100)
|
|
setLaunchPercentage(0, 100)
|
|
|
|
|
|
|
|
|
|
+ const loggerAEx = LoggerUtil('%c[AEx]', 'color: #353232; font-weight: bold')
|
|
|
|
|
+ const loggerLaunchSuite = LoggerUtil('%c[LaunchSuite]', 'color: #000668; font-weight: bold')
|
|
|
|
|
+
|
|
|
// 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'), [
|
|
|
ConfigManager.getCommonDirectory(),
|
|
ConfigManager.getCommonDirectory(),
|
|
@@ -460,12 +468,14 @@ function dlAsync(login = true){
|
|
|
stdio: 'pipe'
|
|
stdio: 'pipe'
|
|
|
})
|
|
})
|
|
|
// Stdout
|
|
// Stdout
|
|
|
|
|
+ aEx.stdio[1].setEncoding('utf8')
|
|
|
aEx.stdio[1].on('data', (data) => {
|
|
aEx.stdio[1].on('data', (data) => {
|
|
|
- console.log('%c[AEx]', 'color: #353232; font-weight: bold', data.toString('utf-8'))
|
|
|
|
|
|
|
+ loggerAEx.log(data)
|
|
|
})
|
|
})
|
|
|
// Stderr
|
|
// Stderr
|
|
|
|
|
+ aEx.stdio[2].setEncoding('utf8')
|
|
|
aEx.stdio[2].on('data', (data) => {
|
|
aEx.stdio[2].on('data', (data) => {
|
|
|
- console.log('%c[AEx]', 'color: #353232; font-weight: bold', data.toString('utf-8'))
|
|
|
|
|
|
|
+ loggerAEx.log(data)
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
// Establish communications between the AssetExec and current process.
|
|
// Establish communications between the AssetExec and current process.
|
|
@@ -475,27 +485,27 @@ function dlAsync(login = true){
|
|
|
switch(m.data){
|
|
switch(m.data){
|
|
|
case 'distribution':
|
|
case 'distribution':
|
|
|
setLaunchPercentage(20, 100)
|
|
setLaunchPercentage(20, 100)
|
|
|
- console.log('Validated distibution index.')
|
|
|
|
|
|
|
+ loggerLaunchSuite.log('Validated distibution index.')
|
|
|
setLaunchDetails('Loading version information..')
|
|
setLaunchDetails('Loading version information..')
|
|
|
break
|
|
break
|
|
|
case 'version':
|
|
case 'version':
|
|
|
setLaunchPercentage(40, 100)
|
|
setLaunchPercentage(40, 100)
|
|
|
- console.log('Version data loaded.')
|
|
|
|
|
|
|
+ loggerLaunchSuite.log('Version data loaded.')
|
|
|
setLaunchDetails('Validating asset integrity..')
|
|
setLaunchDetails('Validating asset integrity..')
|
|
|
break
|
|
break
|
|
|
case 'assets':
|
|
case 'assets':
|
|
|
setLaunchPercentage(60, 100)
|
|
setLaunchPercentage(60, 100)
|
|
|
- console.log('Asset Validation Complete')
|
|
|
|
|
|
|
+ loggerLaunchSuite.log('Asset Validation Complete')
|
|
|
setLaunchDetails('Validating library integrity..')
|
|
setLaunchDetails('Validating library integrity..')
|
|
|
break
|
|
break
|
|
|
case 'libraries':
|
|
case 'libraries':
|
|
|
setLaunchPercentage(80, 100)
|
|
setLaunchPercentage(80, 100)
|
|
|
- console.log('Library validation complete.')
|
|
|
|
|
|
|
+ loggerLaunchSuite.log('Library validation complete.')
|
|
|
setLaunchDetails('Validating miscellaneous file integrity..')
|
|
setLaunchDetails('Validating miscellaneous file integrity..')
|
|
|
break
|
|
break
|
|
|
case 'files':
|
|
case 'files':
|
|
|
setLaunchPercentage(100, 100)
|
|
setLaunchPercentage(100, 100)
|
|
|
- console.log('File validation complete.')
|
|
|
|
|
|
|
+ loggerLaunchSuite.log('File validation complete.')
|
|
|
setLaunchDetails('Downloading files..')
|
|
setLaunchDetails('Downloading files..')
|
|
|
break
|
|
break
|
|
|
}
|
|
}
|
|
@@ -544,7 +554,7 @@ function dlAsync(login = true){
|
|
|
} else if(m.context === 'error'){
|
|
} else if(m.context === 'error'){
|
|
|
switch(m.data){
|
|
switch(m.data){
|
|
|
case 'download':
|
|
case 'download':
|
|
|
- console.error(m.error)
|
|
|
|
|
|
|
+ loggerLaunchSuite.error('Error while downloading:', m.error)
|
|
|
|
|
|
|
|
if(m.error.code === 'ENOENT'){
|
|
if(m.error.code === 'ENOENT'){
|
|
|
setOverlayContent(
|
|
setOverlayContent(
|
|
@@ -574,7 +584,7 @@ function dlAsync(login = true){
|
|
|
|
|
|
|
|
// If these properties are not defined it's likely an error.
|
|
// If these properties are not defined it's likely an error.
|
|
|
if(m.result.forgeData == null || m.result.versionData == null){
|
|
if(m.result.forgeData == null || m.result.versionData == null){
|
|
|
- console.error(m.result)
|
|
|
|
|
|
|
+ loggerLaunchSuite.error('Error during validation:', m.result)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
forgeData = m.result.forgeData
|
|
forgeData = m.result.forgeData
|
|
@@ -582,7 +592,7 @@ function dlAsync(login = true){
|
|
|
|
|
|
|
|
if(login) {
|
|
if(login) {
|
|
|
const authUser = ConfigManager.getSelectedAccount()
|
|
const authUser = ConfigManager.getSelectedAccount()
|
|
|
- console.log('authu', authUser)
|
|
|
|
|
|
|
+ loggerLaunchSuite.log(`Sending selected account (${authUser.displayName}) to ProcessBuilder.`)
|
|
|
let pb = new ProcessBuilder(serv, versionData, forgeData, authUser)
|
|
let pb = new ProcessBuilder(serv, versionData, forgeData, authUser)
|
|
|
setLaunchDetails('Launching game..')
|
|
setLaunchDetails('Launching game..')
|
|
|
|
|
|
|
@@ -615,7 +625,7 @@ function dlAsync(login = true){
|
|
|
const gameErrorListener = function(data){
|
|
const gameErrorListener = function(data){
|
|
|
data = data.trim()
|
|
data = data.trim()
|
|
|
if(data.indexOf('Could not find or load main class net.minecraft.launchwrapper.Launch') > -1){
|
|
if(data.indexOf('Could not find or load main class net.minecraft.launchwrapper.Launch') > -1){
|
|
|
- console.error('Game launch failed, LaunchWrapper was not downloaded properly.')
|
|
|
|
|
|
|
+ loggerLaunchSuite.error('Game launch failed, LaunchWrapper was not downloaded properly.')
|
|
|
setOverlayContent(
|
|
setOverlayContent(
|
|
|
'Error During Launch',
|
|
'Error During Launch',
|
|
|
'The main file, LaunchWrapper, failed to download properly. As a result, the game cannot launch.<br><br>To fix this issue, temporarily turn off your antivirus software and launch the game again.<br><br>If you have time, please <a href="https://github.com/WesterosCraftCode/ElectronLauncher/issues">submit an issue</a> and let us know what antivirus software you use. We\'ll contact them and try to straighten things out.',
|
|
'The main file, LaunchWrapper, failed to download properly. As a result, the game cannot launch.<br><br>To fix this issue, temporarily turn off your antivirus software and launch the game again.<br><br>If you have time, please <a href="https://github.com/WesterosCraftCode/ElectronLauncher/issues">submit an issue</a> and let us know what antivirus software you use. We\'ll contact them and try to straighten things out.',
|
|
@@ -643,7 +653,7 @@ function dlAsync(login = true){
|
|
|
DiscordWrapper.initRPC(distro.discord, serv.discord)
|
|
DiscordWrapper.initRPC(distro.discord, serv.discord)
|
|
|
hasRPC = true
|
|
hasRPC = true
|
|
|
proc.on('close', (code, signal) => {
|
|
proc.on('close', (code, signal) => {
|
|
|
- console.log('Shutting down Discord Rich Presence..')
|
|
|
|
|
|
|
+ loggerLaunchSuite.log('Shutting down Discord Rich Presence..')
|
|
|
DiscordWrapper.shutdownRPC()
|
|
DiscordWrapper.shutdownRPC()
|
|
|
hasRPC = false
|
|
hasRPC = false
|
|
|
proc = null
|
|
proc = null
|
|
@@ -652,7 +662,7 @@ function dlAsync(login = true){
|
|
|
|
|
|
|
|
} catch(err) {
|
|
} catch(err) {
|
|
|
|
|
|
|
|
- console.error('Error during launch', err)
|
|
|
|
|
|
|
+ loggerLaunchSuite.error('Error during launch', err)
|
|
|
setOverlayContent(
|
|
setOverlayContent(
|
|
|
'Error During Launch',
|
|
'Error During Launch',
|
|
|
'Please check the console for more details.',
|
|
'Please check the console for more details.',
|
|
@@ -681,13 +691,13 @@ function dlAsync(login = true){
|
|
|
serv = data.getServer(ConfigManager.getSelectedServer())
|
|
serv = data.getServer(ConfigManager.getSelectedServer())
|
|
|
aEx.send({task: 'execute', function: 'validateEverything', argsArr: [ConfigManager.getSelectedServer(), DistroManager.isDevMode()]})
|
|
aEx.send({task: 'execute', function: 'validateEverything', argsArr: [ConfigManager.getSelectedServer(), DistroManager.isDevMode()]})
|
|
|
}, (err) => {
|
|
}, (err) => {
|
|
|
- console.log(err)
|
|
|
|
|
|
|
+ loggerLaunchSuite.log('Error while fetching a fresh copy of the distribution index.', err)
|
|
|
refreshDistributionIndex(false, (data) => {
|
|
refreshDistributionIndex(false, (data) => {
|
|
|
onDistroRefresh(data)
|
|
onDistroRefresh(data)
|
|
|
serv = data.getServer(ConfigManager.getSelectedServer())
|
|
serv = data.getServer(ConfigManager.getSelectedServer())
|
|
|
aEx.send({task: 'execute', function: 'validateEverything', argsArr: [ConfigManager.getSelectedServer(), DistroManager.isDevMode()]})
|
|
aEx.send({task: 'execute', function: 'validateEverything', argsArr: [ConfigManager.getSelectedServer(), DistroManager.isDevMode()]})
|
|
|
}, (err) => {
|
|
}, (err) => {
|
|
|
- console.error('Unable to refresh distribution index.', err)
|
|
|
|
|
|
|
+ loggerLaunchSuite.error('Unable to refresh distribution index.', err)
|
|
|
if(DistroManager.getDistribution() == null){
|
|
if(DistroManager.getDistribution() == null){
|
|
|
setOverlayContent(
|
|
setOverlayContent(
|
|
|
'Fatal Error',
|
|
'Fatal Error',
|