mirror of
https://github.com/dscalzi/HeliosLauncher.git
synced 2024-12-21 19:22:13 -08:00
Improve logging.
This commit is contained in:
parent
5d44cc3408
commit
248937c22d
@ -1,11 +1,11 @@
|
|||||||
{
|
{
|
||||||
"env": {
|
"env": {
|
||||||
"es2017": true,
|
"es2022": true,
|
||||||
"node": true
|
"node": true
|
||||||
},
|
},
|
||||||
"extends": "eslint:recommended",
|
"extends": "eslint:recommended",
|
||||||
"parserOptions": {
|
"parserOptions": {
|
||||||
"ecmaVersion": 2021,
|
"ecmaVersion": 2022,
|
||||||
"sourceType": "module"
|
"sourceType": "module"
|
||||||
},
|
},
|
||||||
"rules": {
|
"rules": {
|
||||||
|
@ -6,8 +6,11 @@ if(target == null){
|
|||||||
}
|
}
|
||||||
let tracker = new target(...(process.argv.splice(3)))
|
let tracker = new target(...(process.argv.splice(3)))
|
||||||
|
|
||||||
|
const { LoggerUtil } = require('helios-core')
|
||||||
|
const logger = LoggerUtil.getLogger('AssetExec')
|
||||||
|
|
||||||
//const tracker = new AssetGuard(process.argv[2], process.argv[3])
|
//const tracker = new AssetGuard(process.argv[2], process.argv[3])
|
||||||
console.log('AssetExec Started')
|
logger.info('AssetExec Started')
|
||||||
|
|
||||||
// Temporary for debug purposes.
|
// Temporary for debug purposes.
|
||||||
process.on('unhandledRejection', r => console.log(r))
|
process.on('unhandledRejection', r => console.log(r))
|
||||||
@ -66,6 +69,6 @@ process.on('message', (msg) => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
process.on('disconnect', () => {
|
process.on('disconnect', () => {
|
||||||
console.log('AssetExec Disconnected')
|
logger.info('AssetExec Disconnected')
|
||||||
process.exit(0)
|
process.exit(0)
|
||||||
})
|
})
|
@ -5,6 +5,7 @@ const child_process = require('child_process')
|
|||||||
const crypto = require('crypto')
|
const crypto = require('crypto')
|
||||||
const EventEmitter = require('events')
|
const EventEmitter = require('events')
|
||||||
const fs = require('fs-extra')
|
const fs = require('fs-extra')
|
||||||
|
const { LoggerUtil } = require('helios-core')
|
||||||
const nodeDiskInfo = require('node-disk-info')
|
const nodeDiskInfo = require('node-disk-info')
|
||||||
const StreamZip = require('node-stream-zip')
|
const StreamZip = require('node-stream-zip')
|
||||||
const path = require('path')
|
const path = require('path')
|
||||||
@ -215,6 +216,7 @@ class JavaGuard extends EventEmitter {
|
|||||||
constructor(mcVersion){
|
constructor(mcVersion){
|
||||||
super()
|
super()
|
||||||
this.mcVersion = mcVersion
|
this.mcVersion = mcVersion
|
||||||
|
this.logger = LoggerUtil.getLogger('JavaGuard')
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -451,7 +453,7 @@ class JavaGuard extends EventEmitter {
|
|||||||
if(props[i].indexOf('sun.arch.data.model') > -1){
|
if(props[i].indexOf('sun.arch.data.model') > -1){
|
||||||
let arch = props[i].split('=')[1].trim()
|
let arch = props[i].split('=')[1].trim()
|
||||||
arch = parseInt(arch)
|
arch = parseInt(arch)
|
||||||
console.log(props[i].trim())
|
this.logger.debug(props[i].trim())
|
||||||
if(arch === 64){
|
if(arch === 64){
|
||||||
meta.arch = arch
|
meta.arch = arch
|
||||||
++checksum
|
++checksum
|
||||||
@ -461,7 +463,7 @@ class JavaGuard extends EventEmitter {
|
|||||||
}
|
}
|
||||||
} else if(props[i].indexOf('java.runtime.version') > -1){
|
} else if(props[i].indexOf('java.runtime.version') > -1){
|
||||||
let verString = props[i].split('=')[1].trim()
|
let verString = props[i].split('=')[1].trim()
|
||||||
console.log(props[i].trim())
|
this.logger.debug(props[i].trim())
|
||||||
const verOb = JavaGuard.parseJavaRuntimeVersion(verString)
|
const verOb = JavaGuard.parseJavaRuntimeVersion(verString)
|
||||||
// TODO implement a support matrix eventually. Right now this is good enough
|
// TODO implement a support matrix eventually. Right now this is good enough
|
||||||
// 1.7-1.16 = Java 8
|
// 1.7-1.16 = Java 8
|
||||||
@ -491,7 +493,7 @@ class JavaGuard extends EventEmitter {
|
|||||||
// Space included so we get only the vendor.
|
// Space included so we get only the vendor.
|
||||||
} else if(props[i].lastIndexOf('java.vendor ') > -1) {
|
} else if(props[i].lastIndexOf('java.vendor ') > -1) {
|
||||||
let vendorName = props[i].split('=')[1].trim()
|
let vendorName = props[i].split('=')[1].trim()
|
||||||
console.log(props[i].trim())
|
this.logger.debug(props[i].trim())
|
||||||
meta.vendor = vendorName
|
meta.vendor = vendorName
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -521,7 +523,7 @@ class JavaGuard extends EventEmitter {
|
|||||||
resolve({valid: false})
|
resolve({valid: false})
|
||||||
} else if(fs.existsSync(binaryExecPath)){
|
} else if(fs.existsSync(binaryExecPath)){
|
||||||
// Workaround (javaw.exe no longer outputs this information.)
|
// Workaround (javaw.exe no longer outputs this information.)
|
||||||
console.log(typeof binaryExecPath)
|
this.logger.debug(typeof binaryExecPath)
|
||||||
if(binaryExecPath.indexOf('javaw.exe') > -1) {
|
if(binaryExecPath.indexOf('javaw.exe') > -1) {
|
||||||
binaryExecPath.replace('javaw.exe', 'java.exe')
|
binaryExecPath.replace('javaw.exe', 'java.exe')
|
||||||
}
|
}
|
||||||
@ -958,6 +960,8 @@ class JavaGuard extends EventEmitter {
|
|||||||
*/
|
*/
|
||||||
class AssetGuard extends EventEmitter {
|
class AssetGuard extends EventEmitter {
|
||||||
|
|
||||||
|
static logger = LoggerUtil.getLogger('AssetGuard')
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create an instance of AssetGuard.
|
* Create an instance of AssetGuard.
|
||||||
* On creation the object's properties are never-null default
|
* On creation the object's properties are never-null default
|
||||||
@ -1116,7 +1120,8 @@ class AssetGuard extends EventEmitter {
|
|||||||
* @returns {Promise.<void>} An empty promise to indicate the extraction has completed.
|
* @returns {Promise.<void>} An empty promise to indicate the extraction has completed.
|
||||||
*/
|
*/
|
||||||
static _extractPackXZ(filePaths, javaExecutable){
|
static _extractPackXZ(filePaths, javaExecutable){
|
||||||
console.log('[PackXZExtract] Starting')
|
const extractLogger = LoggerUtil.getLogger('PackXZExtract')
|
||||||
|
extractLogger.info('Starting')
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
|
|
||||||
let libPath
|
let libPath
|
||||||
@ -1133,13 +1138,13 @@ class AssetGuard extends EventEmitter {
|
|||||||
const filePath = filePaths.join(',')
|
const filePath = filePaths.join(',')
|
||||||
const child = child_process.spawn(javaExecutable, ['-jar', libPath, '-packxz', filePath])
|
const child = child_process.spawn(javaExecutable, ['-jar', libPath, '-packxz', filePath])
|
||||||
child.stdout.on('data', (data) => {
|
child.stdout.on('data', (data) => {
|
||||||
console.log('[PackXZExtract]', data.toString('utf8'))
|
extractLogger.info(data.toString('utf8'))
|
||||||
})
|
})
|
||||||
child.stderr.on('data', (data) => {
|
child.stderr.on('data', (data) => {
|
||||||
console.log('[PackXZExtract]', data.toString('utf8'))
|
extractLogger.info(data.toString('utf8'))
|
||||||
})
|
})
|
||||||
child.on('close', (code, signal) => {
|
child.on('close', (code, signal) => {
|
||||||
console.log('[PackXZExtract]', 'Exited with code', code)
|
extractLogger.info('Exited with code', code)
|
||||||
resolve()
|
resolve()
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
@ -1205,7 +1210,7 @@ class AssetGuard extends EventEmitter {
|
|||||||
if(!fs.existsSync(versionFile) || force){
|
if(!fs.existsSync(versionFile) || force){
|
||||||
const url = await self._getVersionDataUrl(version)
|
const url = await self._getVersionDataUrl(version)
|
||||||
//This download will never be tracked as it's essential and trivial.
|
//This download will never be tracked as it's essential and trivial.
|
||||||
console.log('Preparing download of ' + version + ' assets.')
|
AssetGuard.logger.info('Preparing download of ' + version + ' assets.')
|
||||||
fs.ensureDirSync(versionPath)
|
fs.ensureDirSync(versionPath)
|
||||||
const stream = request(url).pipe(fs.createWriteStream(versionFile))
|
const stream = request(url).pipe(fs.createWriteStream(versionFile))
|
||||||
stream.on('finish', () => {
|
stream.on('finish', () => {
|
||||||
@ -1287,7 +1292,7 @@ class AssetGuard extends EventEmitter {
|
|||||||
|
|
||||||
let data = null
|
let data = null
|
||||||
if(!fs.existsSync(assetIndexLoc) || force){
|
if(!fs.existsSync(assetIndexLoc) || force){
|
||||||
console.log('Downloading ' + versionData.id + ' asset index.')
|
AssetGuard.logger.info('Downloading ' + versionData.id + ' asset index.')
|
||||||
fs.ensureDirSync(indexPath)
|
fs.ensureDirSync(indexPath)
|
||||||
const stream = request(assetIndex.url).pipe(fs.createWriteStream(assetIndexLoc))
|
const stream = request(assetIndex.url).pipe(fs.createWriteStream(assetIndexLoc))
|
||||||
stream.on('finish', () => {
|
stream.on('finish', () => {
|
||||||
@ -1576,9 +1581,9 @@ class AssetGuard extends EventEmitter {
|
|||||||
// Tar.gz
|
// Tar.gz
|
||||||
let h = null
|
let h = null
|
||||||
fs.createReadStream(a.to)
|
fs.createReadStream(a.to)
|
||||||
.on('error', err => console.log(err))
|
.on('error', err => AssetGuard.logger.error(err))
|
||||||
.pipe(zlib.createGunzip())
|
.pipe(zlib.createGunzip())
|
||||||
.on('error', err => console.log(err))
|
.on('error', err => AssetGuard.logger.error(err))
|
||||||
.pipe(tar.extract(dataDir, {
|
.pipe(tar.extract(dataDir, {
|
||||||
map: (header) => {
|
map: (header) => {
|
||||||
if(h == null){
|
if(h == null){
|
||||||
@ -1586,11 +1591,11 @@ class AssetGuard extends EventEmitter {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}))
|
}))
|
||||||
.on('error', err => console.log(err))
|
.on('error', err => AssetGuard.logger.error(err))
|
||||||
.on('finish', () => {
|
.on('finish', () => {
|
||||||
fs.unlink(a.to, err => {
|
fs.unlink(a.to, err => {
|
||||||
if(err){
|
if(err){
|
||||||
console.log(err)
|
AssetGuard.logger.error(err)
|
||||||
}
|
}
|
||||||
if(h.indexOf('/') > -1){
|
if(h.indexOf('/') > -1){
|
||||||
h = h.substring(0, h.indexOf('/'))
|
h = h.substring(0, h.indexOf('/'))
|
||||||
@ -1623,14 +1628,14 @@ class AssetGuard extends EventEmitter {
|
|||||||
const entries = await zip.entries()
|
const entries = await zip.entries()
|
||||||
pos = path.join(runtimeDir, Object.keys(entries)[0])
|
pos = path.join(runtimeDir, Object.keys(entries)[0])
|
||||||
|
|
||||||
console.log('Extracting jdk..')
|
AssetGuard.logger.info('Extracting jdk..')
|
||||||
await zip.extract(null, runtimeDir)
|
await zip.extract(null, runtimeDir)
|
||||||
console.log('Cleaning up..')
|
AssetGuard.logger.info('Cleaning up..')
|
||||||
await fs.remove(zipPath)
|
await fs.remove(zipPath)
|
||||||
console.log('Jdk extraction complete.')
|
AssetGuard.logger.info('Jdk extraction complete.')
|
||||||
|
|
||||||
} catch(err) {
|
} catch(err) {
|
||||||
console.log(err)
|
AssetGuard.logger.error(err)
|
||||||
} finally {
|
} finally {
|
||||||
zip.close()
|
zip.close()
|
||||||
self.emit('complete', 'java', JavaGuard.javaExecFromRoot(pos))
|
self.emit('complete', 'java', JavaGuard.javaExecFromRoot(pos))
|
||||||
@ -1696,7 +1701,7 @@ class AssetGuard extends EventEmitter {
|
|||||||
const dlQueue = dlTracker.dlqueue
|
const dlQueue = dlTracker.dlqueue
|
||||||
|
|
||||||
if(dlQueue.length > 0){
|
if(dlQueue.length > 0){
|
||||||
console.log('DLQueue', dlQueue)
|
AssetGuard.logger.info('DLQueue', dlQueue)
|
||||||
|
|
||||||
async.eachLimit(dlQueue, limit, (asset, cb) => {
|
async.eachLimit(dlQueue, limit, (asset, cb) => {
|
||||||
|
|
||||||
@ -1713,7 +1718,7 @@ class AssetGuard extends EventEmitter {
|
|||||||
const contentLength = parseInt(resp.headers['content-length'])
|
const contentLength = parseInt(resp.headers['content-length'])
|
||||||
|
|
||||||
if(contentLength !== asset.size){
|
if(contentLength !== asset.size){
|
||||||
console.log(`WARN: Got ${contentLength} bytes for ${asset.id}: Expected ${asset.size}`)
|
AssetGuard.logger.warn(`WARN: Got ${contentLength} bytes for ${asset.id}: Expected ${asset.size}`)
|
||||||
doHashCheck = true
|
doHashCheck = true
|
||||||
|
|
||||||
// Adjust download
|
// Adjust download
|
||||||
@ -1730,9 +1735,9 @@ class AssetGuard extends EventEmitter {
|
|||||||
if(doHashCheck){
|
if(doHashCheck){
|
||||||
const v = AssetGuard._validateLocal(asset.to, asset.type != null ? 'md5' : 'sha1', asset.hash)
|
const v = AssetGuard._validateLocal(asset.to, asset.type != null ? 'md5' : 'sha1', asset.hash)
|
||||||
if(v){
|
if(v){
|
||||||
console.log(`Hashes match for ${asset.id}, byte mismatch is an issue in the distro index.`)
|
AssetGuard.logger.warn(`Hashes match for ${asset.id}, byte mismatch is an issue in the distro index.`)
|
||||||
} else {
|
} else {
|
||||||
console.error(`Hashes do not match, ${asset.id} may be corrupted.`)
|
AssetGuard.logger.error(`Hashes do not match, ${asset.id} may be corrupted.`)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1744,7 +1749,7 @@ class AssetGuard extends EventEmitter {
|
|||||||
} else {
|
} else {
|
||||||
|
|
||||||
req.abort()
|
req.abort()
|
||||||
console.log(`Failed to download ${asset.id}(${typeof asset.from === 'object' ? asset.from.url : asset.from}). Response code ${resp.statusCode}`)
|
AssetGuard.logger.error(`Failed to download ${asset.id}(${typeof asset.from === 'object' ? asset.from.url : asset.from}). Response code ${resp.statusCode}`)
|
||||||
self.progress += asset.size*1
|
self.progress += asset.size*1
|
||||||
self.emit('progress', 'download', self.progress, self.totaldlsize)
|
self.emit('progress', 'download', self.progress, self.totaldlsize)
|
||||||
cb()
|
cb()
|
||||||
@ -1765,9 +1770,9 @@ class AssetGuard extends EventEmitter {
|
|||||||
}, (err) => {
|
}, (err) => {
|
||||||
|
|
||||||
if(err){
|
if(err){
|
||||||
console.log('An item in ' + identifier + ' failed to process')
|
AssetGuard.logger.warn('An item in ' + identifier + ' failed to process')
|
||||||
} else {
|
} else {
|
||||||
console.log('All ' + identifier + ' have been processed successfully')
|
AssetGuard.logger.info('All ' + identifier + ' have been processed successfully')
|
||||||
}
|
}
|
||||||
|
|
||||||
//self.totaldlsize -= dlTracker.dlsize
|
//self.totaldlsize -= dlTracker.dlsize
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
const fs = require('fs-extra')
|
const fs = require('fs-extra')
|
||||||
|
const { LoggerUtil } = require('helios-core')
|
||||||
const os = require('os')
|
const os = require('os')
|
||||||
const path = require('path')
|
const path = require('path')
|
||||||
|
|
||||||
const logger = require('./loggerutil')('%c[ConfigManager]', 'color: #a02d2a; font-weight: bold')
|
const logger = LoggerUtil.getLogger('ConfigManager')
|
||||||
|
|
||||||
const sysRoot = process.env.APPDATA || (process.platform == 'darwin' ? process.env.HOME + '/Library/Application Support' : process.env.HOME)
|
const sysRoot = process.env.APPDATA || (process.platform == 'darwin' ? process.env.HOME + '/Library/Application Support' : process.env.HOME)
|
||||||
// TODO change
|
// TODO change
|
||||||
@ -155,8 +156,8 @@ exports.load = function(){
|
|||||||
doValidate = true
|
doValidate = true
|
||||||
} catch (err){
|
} catch (err){
|
||||||
logger.error(err)
|
logger.error(err)
|
||||||
logger.log('Configuration file contains malformed JSON or is corrupt.')
|
logger.info('Configuration file contains malformed JSON or is corrupt.')
|
||||||
logger.log('Generating a new configuration file.')
|
logger.info('Generating a new configuration file.')
|
||||||
fs.ensureDirSync(path.join(configPath, '..'))
|
fs.ensureDirSync(path.join(configPath, '..'))
|
||||||
config = DEFAULT_CONFIG
|
config = DEFAULT_CONFIG
|
||||||
exports.save()
|
exports.save()
|
||||||
@ -166,7 +167,7 @@ exports.load = function(){
|
|||||||
exports.save()
|
exports.save()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
logger.log('Successfully Loaded')
|
logger.info('Successfully Loaded')
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
// Work in progress
|
// Work in progress
|
||||||
const logger = require('./loggerutil')('%c[DiscordWrapper]', 'color: #7289da; font-weight: bold')
|
const { LoggerUtil } = require('helios-core')
|
||||||
|
|
||||||
|
const logger = LoggerUtil.getLogger('DiscordWrapper')
|
||||||
|
|
||||||
const { Client } = require('discord-rpc-patch')
|
const { Client } = require('discord-rpc-patch')
|
||||||
|
|
||||||
@ -21,15 +23,15 @@ exports.initRPC = function(genSettings, servSettings, initialDetails = 'Waiting
|
|||||||
}
|
}
|
||||||
|
|
||||||
client.on('ready', () => {
|
client.on('ready', () => {
|
||||||
logger.log('Discord RPC Connected')
|
logger.info('Discord RPC Connected')
|
||||||
client.setActivity(activity)
|
client.setActivity(activity)
|
||||||
})
|
})
|
||||||
|
|
||||||
client.login({clientId: genSettings.clientId}).catch(error => {
|
client.login({clientId: genSettings.clientId}).catch(error => {
|
||||||
if(error.message.includes('ENOENT')) {
|
if(error.message.includes('ENOENT')) {
|
||||||
logger.log('Unable to initialize Discord Rich Presence, no client detected.')
|
logger.info('Unable to initialize Discord Rich Presence, no client detected.')
|
||||||
} else {
|
} else {
|
||||||
logger.log('Unable to initialize Discord Rich Presence: ' + error.message, error)
|
logger.info('Unable to initialize Discord Rich Presence: ' + error.message, error)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,11 @@
|
|||||||
const fs = require('fs')
|
const fs = require('fs')
|
||||||
const path = require('path')
|
const path = require('path')
|
||||||
const request = require('request')
|
const request = require('request')
|
||||||
|
const { LoggerUtil } = require('helios-core')
|
||||||
|
|
||||||
const ConfigManager = require('./configmanager')
|
const ConfigManager = require('./configmanager')
|
||||||
const logger = require('./loggerutil')('%c[DistroManager]', 'color: #a02d2a; font-weight: bold')
|
|
||||||
|
const logger = LoggerUtil.getLogger('DistroManager')
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents the download information
|
* Represents the download information
|
||||||
@ -599,10 +601,10 @@ exports.pullLocal = function(){
|
|||||||
|
|
||||||
exports.setDevMode = function(value){
|
exports.setDevMode = function(value){
|
||||||
if(value){
|
if(value){
|
||||||
logger.log('Developer mode enabled.')
|
logger.info('Developer mode enabled.')
|
||||||
logger.log('If you don\'t know what that means, revert immediately.')
|
logger.info('If you don\'t know what that means, revert immediately.')
|
||||||
} else {
|
} else {
|
||||||
logger.log('Developer mode disabled.')
|
logger.info('Developer mode disabled.')
|
||||||
}
|
}
|
||||||
DEV_MODE = value
|
DEV_MODE = value
|
||||||
}
|
}
|
||||||
|
@ -1,32 +0,0 @@
|
|||||||
class LoggerUtil {
|
|
||||||
|
|
||||||
constructor(prefix, style){
|
|
||||||
this.prefix = prefix
|
|
||||||
this.style = style
|
|
||||||
}
|
|
||||||
|
|
||||||
log(){
|
|
||||||
console.log.apply(null, [this.prefix, this.style, ...arguments])
|
|
||||||
}
|
|
||||||
|
|
||||||
info(){
|
|
||||||
console.info.apply(null, [this.prefix, this.style, ...arguments])
|
|
||||||
}
|
|
||||||
|
|
||||||
warn(){
|
|
||||||
console.warn.apply(null, [this.prefix, this.style, ...arguments])
|
|
||||||
}
|
|
||||||
|
|
||||||
debug(){
|
|
||||||
console.debug.apply(null, [this.prefix, this.style, ...arguments])
|
|
||||||
}
|
|
||||||
|
|
||||||
error(){
|
|
||||||
console.error.apply(null, [this.prefix, this.style, ...arguments])
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = function (prefix, style){
|
|
||||||
return new LoggerUtil(prefix, style)
|
|
||||||
}
|
|
@ -6,9 +6,11 @@ const path = require('path')
|
|||||||
const ConfigManager = require('./configmanager')
|
const ConfigManager = require('./configmanager')
|
||||||
const DistroManager = require('./distromanager')
|
const DistroManager = require('./distromanager')
|
||||||
const LangLoader = require('./langloader')
|
const LangLoader = require('./langloader')
|
||||||
const logger = require('./loggerutil')('%c[Preloader]', 'color: #a02d2a; font-weight: bold')
|
const { LoggerUtil } = require('helios-core')
|
||||||
|
|
||||||
logger.log('Loading..')
|
const logger = LoggerUtil.getLogger('Preloader')
|
||||||
|
|
||||||
|
logger.info('Loading..')
|
||||||
|
|
||||||
// Load ConfigManager
|
// Load ConfigManager
|
||||||
ConfigManager.load()
|
ConfigManager.load()
|
||||||
@ -21,7 +23,7 @@ function onDistroLoad(data){
|
|||||||
|
|
||||||
// Resolve the selected server if its value has yet to be set.
|
// Resolve the selected server if its value has yet to be set.
|
||||||
if(ConfigManager.getSelectedServer() == null || data.getServer(ConfigManager.getSelectedServer()) == null){
|
if(ConfigManager.getSelectedServer() == null || data.getServer(ConfigManager.getSelectedServer()) == null){
|
||||||
logger.log('Determining default selected server..')
|
logger.info('Determining default selected server..')
|
||||||
ConfigManager.setSelectedServer(data.getMainServer().getID())
|
ConfigManager.setSelectedServer(data.getMainServer().getID())
|
||||||
ConfigManager.save()
|
ConfigManager.save()
|
||||||
}
|
}
|
||||||
@ -31,26 +33,26 @@ function onDistroLoad(data){
|
|||||||
|
|
||||||
// Ensure Distribution is downloaded and cached.
|
// Ensure Distribution is downloaded and cached.
|
||||||
DistroManager.pullRemote().then((data) => {
|
DistroManager.pullRemote().then((data) => {
|
||||||
logger.log('Loaded distribution index.')
|
logger.info('Loaded distribution index.')
|
||||||
|
|
||||||
onDistroLoad(data)
|
onDistroLoad(data)
|
||||||
|
|
||||||
}).catch((err) => {
|
}).catch((err) => {
|
||||||
logger.log('Failed to load distribution index.')
|
logger.info('Failed to load distribution index.')
|
||||||
logger.error(err)
|
logger.error(err)
|
||||||
|
|
||||||
logger.log('Attempting to load an older version of the distribution index.')
|
logger.info('Attempting to load an older version of the distribution index.')
|
||||||
// Try getting a local copy, better than nothing.
|
// Try getting a local copy, better than nothing.
|
||||||
DistroManager.pullLocal().then((data) => {
|
DistroManager.pullLocal().then((data) => {
|
||||||
logger.log('Successfully loaded an older version of the distribution index.')
|
logger.info('Successfully loaded an older version of the distribution index.')
|
||||||
|
|
||||||
onDistroLoad(data)
|
onDistroLoad(data)
|
||||||
|
|
||||||
|
|
||||||
}).catch((err) => {
|
}).catch((err) => {
|
||||||
|
|
||||||
logger.log('Failed to load an older version of the distribution index.')
|
logger.info('Failed to load an older version of the distribution index.')
|
||||||
logger.log('Application cannot run.')
|
logger.info('Application cannot run.')
|
||||||
logger.error(err)
|
logger.error(err)
|
||||||
|
|
||||||
onDistroLoad(null)
|
onDistroLoad(null)
|
||||||
@ -64,6 +66,6 @@ fs.remove(path.join(os.tmpdir(), ConfigManager.getTempNativeFolder()), (err) =>
|
|||||||
if(err){
|
if(err){
|
||||||
logger.warn('Error while cleaning natives directory', err)
|
logger.warn('Error while cleaning natives directory', err)
|
||||||
} else {
|
} else {
|
||||||
logger.log('Cleaned natives directory.')
|
logger.info('Cleaned natives directory.')
|
||||||
}
|
}
|
||||||
})
|
})
|
@ -2,6 +2,7 @@ const AdmZip = require('adm-zip')
|
|||||||
const child_process = require('child_process')
|
const child_process = require('child_process')
|
||||||
const crypto = require('crypto')
|
const crypto = require('crypto')
|
||||||
const fs = require('fs-extra')
|
const fs = require('fs-extra')
|
||||||
|
const { LoggerUtil } = require('helios-core')
|
||||||
const os = require('os')
|
const os = require('os')
|
||||||
const path = require('path')
|
const path = require('path')
|
||||||
const { URL } = require('url')
|
const { URL } = require('url')
|
||||||
@ -9,9 +10,8 @@ const { URL } = require('url')
|
|||||||
const { Util, 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 logger = LoggerUtil('%c[ProcessBuilder]', 'color: #003996; font-weight: bold')
|
const logger = LoggerUtil.getLogger('ProcessBuilder')
|
||||||
|
|
||||||
class ProcessBuilder {
|
class ProcessBuilder {
|
||||||
|
|
||||||
@ -40,7 +40,7 @@ class ProcessBuilder {
|
|||||||
const tempNativePath = path.join(os.tmpdir(), ConfigManager.getTempNativeFolder(), crypto.pseudoRandomBytes(16).toString('hex'))
|
const tempNativePath = path.join(os.tmpdir(), ConfigManager.getTempNativeFolder(), crypto.pseudoRandomBytes(16).toString('hex'))
|
||||||
process.throwDeprecation = true
|
process.throwDeprecation = true
|
||||||
this.setupLiteLoader()
|
this.setupLiteLoader()
|
||||||
logger.log('Using liteloader:', this.usingLiteLoader)
|
logger.info('Using liteloader:', this.usingLiteLoader)
|
||||||
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
|
||||||
@ -59,7 +59,7 @@ class ProcessBuilder {
|
|||||||
args = args.concat(this.constructModList(modObj.fMods))
|
args = args.concat(this.constructModList(modObj.fMods))
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.log('Launch Arguments:', args)
|
logger.info('Launch Arguments:', args)
|
||||||
|
|
||||||
const child = child_process.spawn(ConfigManager.getJavaExecutable(this.server.getID()), args, {
|
const child = child_process.spawn(ConfigManager.getJavaExecutable(this.server.getID()), args, {
|
||||||
cwd: this.gameDir,
|
cwd: this.gameDir,
|
||||||
@ -73,22 +73,20 @@ class ProcessBuilder {
|
|||||||
child.stdout.setEncoding('utf8')
|
child.stdout.setEncoding('utf8')
|
||||||
child.stderr.setEncoding('utf8')
|
child.stderr.setEncoding('utf8')
|
||||||
|
|
||||||
const loggerMCstdout = LoggerUtil('%c[Minecraft]', 'color: #36b030; font-weight: bold')
|
|
||||||
const loggerMCstderr = LoggerUtil('%c[Minecraft]', 'color: #b03030; font-weight: bold')
|
|
||||||
|
|
||||||
child.stdout.on('data', (data) => {
|
child.stdout.on('data', (data) => {
|
||||||
loggerMCstdout.log(data)
|
data.trim().split('\n').forEach(x => console.log(`\x1b[32m[Minecraft]\x1b[0m ${x}`))
|
||||||
|
|
||||||
})
|
})
|
||||||
child.stderr.on('data', (data) => {
|
child.stderr.on('data', (data) => {
|
||||||
loggerMCstderr.log(data)
|
data.trim().split('\n').forEach(x => console.log(`\x1b[31m[Minecraft]\x1b[0m ${x}`))
|
||||||
})
|
})
|
||||||
child.on('close', (code, signal) => {
|
child.on('close', (code, signal) => {
|
||||||
logger.log('Exited with code', code)
|
logger.info('Exited with code', code)
|
||||||
fs.remove(tempNativePath, (err) => {
|
fs.remove(tempNativePath, (err) => {
|
||||||
if(err){
|
if(err){
|
||||||
logger.warn('Error while deleting temp dir', err)
|
logger.warn('Error while deleting temp dir', err)
|
||||||
} else {
|
} else {
|
||||||
logger.log('Temp dir deleted successfully.')
|
logger.info('Temp dir deleted successfully.')
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
@ -12,6 +12,7 @@ const DiscordWrapper = require('./assets/js/discordwrapper')
|
|||||||
const ProcessBuilder = require('./assets/js/processbuilder')
|
const ProcessBuilder = require('./assets/js/processbuilder')
|
||||||
const { Util } = require('./assets/js/assetguard')
|
const { Util } = require('./assets/js/assetguard')
|
||||||
const { RestResponseStatus, isDisplayableError } = require('helios-core/common')
|
const { RestResponseStatus, isDisplayableError } = require('helios-core/common')
|
||||||
|
const { stdout } = require('process')
|
||||||
|
|
||||||
// Launch Elements
|
// Launch Elements
|
||||||
const launch_content = document.getElementById('launch_content')
|
const launch_content = document.getElementById('launch_content')
|
||||||
@ -22,7 +23,7 @@ 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 = LoggerUtil1('%c[Landing]', 'color: #000668; font-weight: bold')
|
const loggerLanding = LoggerUtil.getLogger('Landing')
|
||||||
|
|
||||||
/* Launch Progress Wrapper Functions */
|
/* Launch Progress Wrapper Functions */
|
||||||
|
|
||||||
@ -86,7 +87,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){
|
||||||
loggerLanding.log('Launching game..')
|
loggerLanding.info('Launching game..')
|
||||||
const mcVersion = DistroManager.getDistribution().getServer(ConfigManager.getSelectedServer()).getMinecraftVersion()
|
const mcVersion = DistroManager.getDistribution().getServer(ConfigManager.getSelectedServer()).getMinecraftVersion()
|
||||||
const jExe = ConfigManager.getJavaExecutable(ConfigManager.getSelectedServer())
|
const jExe = ConfigManager.getJavaExecutable(ConfigManager.getSelectedServer())
|
||||||
if(jExe == null){
|
if(jExe == null){
|
||||||
@ -99,7 +100,7 @@ document.getElementById('launch_button').addEventListener('click', function(e){
|
|||||||
|
|
||||||
const jg = new JavaGuard(mcVersion)
|
const jg = new JavaGuard(mcVersion)
|
||||||
jg._validateJavaBinary(jExe).then((v) => {
|
jg._validateJavaBinary(jExe).then((v) => {
|
||||||
loggerLanding.log('Java version meta', v)
|
loggerLanding.info('Java version meta', v)
|
||||||
if(v.valid){
|
if(v.valid){
|
||||||
dlAsync()
|
dlAsync()
|
||||||
} else {
|
} else {
|
||||||
@ -160,7 +161,7 @@ server_selection_button.onclick = (e) => {
|
|||||||
|
|
||||||
// Update Mojang Status Color
|
// Update Mojang Status Color
|
||||||
const refreshMojangStatuses = async function(){
|
const refreshMojangStatuses = async function(){
|
||||||
loggerLanding.log('Refreshing Mojang Statuses..')
|
loggerLanding.info('Refreshing Mojang Statuses..')
|
||||||
|
|
||||||
let status = 'grey'
|
let status = 'grey'
|
||||||
let tooltipEssentialHTML = ''
|
let tooltipEssentialHTML = ''
|
||||||
@ -220,7 +221,7 @@ const refreshMojangStatuses = async function(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
const refreshServerStatus = async function(fade = false){
|
const refreshServerStatus = async function(fade = false){
|
||||||
loggerLanding.log('Refreshing Server Status')
|
loggerLanding.info('Refreshing Server Status')
|
||||||
const serv = DistroManager.getDistribution().getServer(ConfigManager.getSelectedServer())
|
const serv = DistroManager.getDistribution().getServer(ConfigManager.getSelectedServer())
|
||||||
|
|
||||||
let pLabel = 'SERVER'
|
let pLabel = 'SERVER'
|
||||||
@ -295,8 +296,6 @@ function asyncSystemScan(mcVersion, launchAfter = true){
|
|||||||
toggleLaunchArea(true)
|
toggleLaunchArea(true)
|
||||||
setLaunchPercentage(0, 100)
|
setLaunchPercentage(0, 100)
|
||||||
|
|
||||||
const loggerSysAEx = LoggerUtil1('%c[SysAEx]', 'color: #353232; font-weight: bold')
|
|
||||||
|
|
||||||
const forkEnv = JSON.parse(JSON.stringify(process.env))
|
const forkEnv = JSON.parse(JSON.stringify(process.env))
|
||||||
forkEnv.CONFIG_DIRECT_PATH = ConfigManager.getLauncherDirectory()
|
forkEnv.CONFIG_DIRECT_PATH = ConfigManager.getLauncherDirectory()
|
||||||
|
|
||||||
@ -311,12 +310,12 @@ function asyncSystemScan(mcVersion, launchAfter = true){
|
|||||||
// Stdout
|
// Stdout
|
||||||
sysAEx.stdio[1].setEncoding('utf8')
|
sysAEx.stdio[1].setEncoding('utf8')
|
||||||
sysAEx.stdio[1].on('data', (data) => {
|
sysAEx.stdio[1].on('data', (data) => {
|
||||||
loggerSysAEx.log(data)
|
console.log(`\x1b[32m[SysAEx]\x1b[0m ${data}`)
|
||||||
})
|
})
|
||||||
// Stderr
|
// Stderr
|
||||||
sysAEx.stdio[2].setEncoding('utf8')
|
sysAEx.stdio[2].setEncoding('utf8')
|
||||||
sysAEx.stdio[2].on('data', (data) => {
|
sysAEx.stdio[2].on('data', (data) => {
|
||||||
loggerSysAEx.log(data)
|
console.log(`\x1b[31m[SysAEx]\x1b[0m ${data}`)
|
||||||
})
|
})
|
||||||
|
|
||||||
const javaVer = Util.mcVersionAtLeast('1.17', mcVersion) ? '17' : '8'
|
const javaVer = Util.mcVersionAtLeast('1.17', mcVersion) ? '17' : '8'
|
||||||
@ -499,8 +498,7 @@ function dlAsync(login = true){
|
|||||||
toggleLaunchArea(true)
|
toggleLaunchArea(true)
|
||||||
setLaunchPercentage(0, 100)
|
setLaunchPercentage(0, 100)
|
||||||
|
|
||||||
const loggerAEx = LoggerUtil1('%c[AEx]', 'color: #353232; font-weight: bold')
|
const loggerLaunchSuite = LoggerUtil.getLogger('LaunchSuite')
|
||||||
const loggerLaunchSuite = LoggerUtil1('%c[LaunchSuite]', 'color: #000668; font-weight: bold')
|
|
||||||
|
|
||||||
const forkEnv = JSON.parse(JSON.stringify(process.env))
|
const forkEnv = JSON.parse(JSON.stringify(process.env))
|
||||||
forkEnv.CONFIG_DIRECT_PATH = ConfigManager.getLauncherDirectory()
|
forkEnv.CONFIG_DIRECT_PATH = ConfigManager.getLauncherDirectory()
|
||||||
@ -517,12 +515,12 @@ function dlAsync(login = true){
|
|||||||
// Stdout
|
// Stdout
|
||||||
aEx.stdio[1].setEncoding('utf8')
|
aEx.stdio[1].setEncoding('utf8')
|
||||||
aEx.stdio[1].on('data', (data) => {
|
aEx.stdio[1].on('data', (data) => {
|
||||||
loggerAEx.log(data)
|
console.log(`\x1b[32m[AEx]\x1b[0m ${data}`)
|
||||||
})
|
})
|
||||||
// Stderr
|
// Stderr
|
||||||
aEx.stdio[2].setEncoding('utf8')
|
aEx.stdio[2].setEncoding('utf8')
|
||||||
aEx.stdio[2].on('data', (data) => {
|
aEx.stdio[2].on('data', (data) => {
|
||||||
loggerAEx.log(data)
|
console.log(`\x1b[31m[AEx]\x1b[0m ${data}`)
|
||||||
})
|
})
|
||||||
aEx.on('error', (err) => {
|
aEx.on('error', (err) => {
|
||||||
loggerLaunchSuite.error('Error during launch', err)
|
loggerLaunchSuite.error('Error during launch', err)
|
||||||
@ -542,27 +540,27 @@ function dlAsync(login = true){
|
|||||||
switch(m.data){
|
switch(m.data){
|
||||||
case 'distribution':
|
case 'distribution':
|
||||||
setLaunchPercentage(20, 100)
|
setLaunchPercentage(20, 100)
|
||||||
loggerLaunchSuite.log('Validated distibution index.')
|
loggerLaunchSuite.info('Validated distibution index.')
|
||||||
setLaunchDetails('Loading version information..')
|
setLaunchDetails('Loading version information..')
|
||||||
break
|
break
|
||||||
case 'version':
|
case 'version':
|
||||||
setLaunchPercentage(40, 100)
|
setLaunchPercentage(40, 100)
|
||||||
loggerLaunchSuite.log('Version data loaded.')
|
loggerLaunchSuite.info('Version data loaded.')
|
||||||
setLaunchDetails('Validating asset integrity..')
|
setLaunchDetails('Validating asset integrity..')
|
||||||
break
|
break
|
||||||
case 'assets':
|
case 'assets':
|
||||||
setLaunchPercentage(60, 100)
|
setLaunchPercentage(60, 100)
|
||||||
loggerLaunchSuite.log('Asset Validation Complete')
|
loggerLaunchSuite.info('Asset Validation Complete')
|
||||||
setLaunchDetails('Validating library integrity..')
|
setLaunchDetails('Validating library integrity..')
|
||||||
break
|
break
|
||||||
case 'libraries':
|
case 'libraries':
|
||||||
setLaunchPercentage(80, 100)
|
setLaunchPercentage(80, 100)
|
||||||
loggerLaunchSuite.log('Library validation complete.')
|
loggerLaunchSuite.info('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)
|
||||||
loggerLaunchSuite.log('File validation complete.')
|
loggerLaunchSuite.info('File validation complete.')
|
||||||
setLaunchDetails('Downloading files..')
|
setLaunchDetails('Downloading files..')
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
@ -650,7 +648,7 @@ function dlAsync(login = true){
|
|||||||
|
|
||||||
if(login && allGood) {
|
if(login && allGood) {
|
||||||
const authUser = ConfigManager.getSelectedAccount()
|
const authUser = ConfigManager.getSelectedAccount()
|
||||||
loggerLaunchSuite.log(`Sending selected account (${authUser.displayName}) to ProcessBuilder.`)
|
loggerLaunchSuite.info(`Sending selected account (${authUser.displayName}) to ProcessBuilder.`)
|
||||||
let pb = new ProcessBuilder(serv, versionData, forgeData, authUser, remote.app.getVersion())
|
let pb = new ProcessBuilder(serv, versionData, forgeData, authUser, remote.app.getVersion())
|
||||||
setLaunchDetails('Launching game..')
|
setLaunchDetails('Launching game..')
|
||||||
|
|
||||||
@ -717,7 +715,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) => {
|
||||||
loggerLaunchSuite.log('Shutting down Discord Rich Presence..')
|
loggerLaunchSuite.info('Shutting down Discord Rich Presence..')
|
||||||
DiscordWrapper.shutdownRPC()
|
DiscordWrapper.shutdownRPC()
|
||||||
hasRPC = false
|
hasRPC = false
|
||||||
proc = null
|
proc = null
|
||||||
@ -748,7 +746,7 @@ 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) => {
|
||||||
loggerLaunchSuite.log('Error while fetching a fresh copy of the distribution index.', err)
|
loggerLaunchSuite.info('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())
|
||||||
|
@ -21,8 +21,6 @@ const loginForm = document.getElementById('loginForm')
|
|||||||
// Control variables.
|
// Control variables.
|
||||||
let lu = false, lp = false
|
let lu = false, lp = false
|
||||||
|
|
||||||
const loggerLogin = LoggerUtil1('%c[Login]', 'color: #000668; font-weight: bold')
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Show a login error.
|
* Show a login error.
|
||||||
|
@ -60,7 +60,7 @@ function getCurrentView(){
|
|||||||
function showMainUI(data){
|
function showMainUI(data){
|
||||||
|
|
||||||
if(!isDev){
|
if(!isDev){
|
||||||
loggerAutoUpdater.log('Initializing..')
|
loggerAutoUpdater.info('Initializing..')
|
||||||
ipcRenderer.send('autoUpdateAction', 'initAutoUpdater', ConfigManager.getAllowPrerelease())
|
ipcRenderer.send('autoUpdateAction', 'initAutoUpdater', ConfigManager.getAllowPrerelease())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10,11 +10,9 @@ const {ipcRenderer, shell, webFrame} = require('electron')
|
|||||||
const remote = require('@electron/remote')
|
const remote = require('@electron/remote')
|
||||||
const isDev = require('./assets/js/isdev')
|
const isDev = require('./assets/js/isdev')
|
||||||
const { LoggerUtil } = require('helios-core')
|
const { LoggerUtil } = require('helios-core')
|
||||||
const LoggerUtil1 = require('./assets/js/loggerutil')
|
|
||||||
|
|
||||||
const loggerUICore = LoggerUtil1('%c[UICore]', 'color: #000668; font-weight: bold')
|
const loggerUICore = LoggerUtil.getLogger('UICore')
|
||||||
const loggerAutoUpdater = LoggerUtil1('%c[AutoUpdater]', 'color: #000668; font-weight: bold')
|
const loggerAutoUpdater = LoggerUtil.getLogger('AutoUpdater')
|
||||||
const loggerAutoUpdaterSuccess = LoggerUtil1('%c[AutoUpdater]', 'color: #209b07; font-weight: bold')
|
|
||||||
|
|
||||||
// Log deprecation and process warnings.
|
// Log deprecation and process warnings.
|
||||||
process.traceProcessWarnings = true
|
process.traceProcessWarnings = true
|
||||||
@ -43,11 +41,11 @@ if(!isDev){
|
|||||||
ipcRenderer.on('autoUpdateNotification', (event, arg, info) => {
|
ipcRenderer.on('autoUpdateNotification', (event, arg, info) => {
|
||||||
switch(arg){
|
switch(arg){
|
||||||
case 'checking-for-update':
|
case 'checking-for-update':
|
||||||
loggerAutoUpdater.log('Checking for update..')
|
loggerAutoUpdater.info('Checking for update..')
|
||||||
settingsUpdateButtonStatus('Checking for Updates..', true)
|
settingsUpdateButtonStatus('Checking for Updates..', true)
|
||||||
break
|
break
|
||||||
case 'update-available':
|
case 'update-available':
|
||||||
loggerAutoUpdaterSuccess.log('New update available', info.version)
|
loggerAutoUpdater.info('New update available', info.version)
|
||||||
|
|
||||||
if(process.platform === 'darwin'){
|
if(process.platform === 'darwin'){
|
||||||
info.darwindownload = `https://github.com/dscalzi/HeliosLauncher/releases/download/v${info.version}/Helios-Launcher-setup-${info.version}${process.arch === 'arm64' ? '-arm64' : '-x64'}.dmg`
|
info.darwindownload = `https://github.com/dscalzi/HeliosLauncher/releases/download/v${info.version}/Helios-Launcher-setup-${info.version}${process.arch === 'arm64' ? '-arm64' : '-x64'}.dmg`
|
||||||
@ -57,7 +55,7 @@ if(!isDev){
|
|||||||
populateSettingsUpdateInformation(info)
|
populateSettingsUpdateInformation(info)
|
||||||
break
|
break
|
||||||
case 'update-downloaded':
|
case 'update-downloaded':
|
||||||
loggerAutoUpdaterSuccess.log('Update ' + info.version + ' ready to be installed.')
|
loggerAutoUpdater.info('Update ' + info.version + ' ready to be installed.')
|
||||||
settingsUpdateButtonStatus('Install Now', false, () => {
|
settingsUpdateButtonStatus('Install Now', false, () => {
|
||||||
if(!isDev){
|
if(!isDev){
|
||||||
ipcRenderer.send('autoUpdateAction', 'installUpdateNow')
|
ipcRenderer.send('autoUpdateAction', 'installUpdateNow')
|
||||||
@ -66,7 +64,7 @@ if(!isDev){
|
|||||||
showUpdateUI(info)
|
showUpdateUI(info)
|
||||||
break
|
break
|
||||||
case 'update-not-available':
|
case 'update-not-available':
|
||||||
loggerAutoUpdater.log('No new update found.')
|
loggerAutoUpdater.info('No new update found.')
|
||||||
settingsUpdateButtonStatus('Check for Updates')
|
settingsUpdateButtonStatus('Check for Updates')
|
||||||
break
|
break
|
||||||
case 'ready':
|
case 'ready':
|
||||||
@ -78,9 +76,9 @@ if(!isDev){
|
|||||||
case 'realerror':
|
case 'realerror':
|
||||||
if(info != null && info.code != null){
|
if(info != null && info.code != null){
|
||||||
if(info.code === 'ERR_UPDATER_INVALID_RELEASE_FEED'){
|
if(info.code === 'ERR_UPDATER_INVALID_RELEASE_FEED'){
|
||||||
loggerAutoUpdater.log('No suitable releases found.')
|
loggerAutoUpdater.info('No suitable releases found.')
|
||||||
} else if(info.code === 'ERR_XML_MISSED_ELEMENT'){
|
} else if(info.code === 'ERR_XML_MISSED_ELEMENT'){
|
||||||
loggerAutoUpdater.log('No releases found.')
|
loggerAutoUpdater.info('No releases found.')
|
||||||
} else {
|
} else {
|
||||||
loggerAutoUpdater.error('Error during update check..', info)
|
loggerAutoUpdater.error('Error during update check..', info)
|
||||||
loggerAutoUpdater.debug('Error Code:', info.code)
|
loggerAutoUpdater.debug('Error Code:', info.code)
|
||||||
@ -88,7 +86,7 @@ if(!isDev){
|
|||||||
}
|
}
|
||||||
break
|
break
|
||||||
default:
|
default:
|
||||||
loggerAutoUpdater.log('Unknown argument', arg)
|
loggerAutoUpdater.info('Unknown argument', arg)
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -131,12 +129,12 @@ function showUpdateUI(info){
|
|||||||
|
|
||||||
/* jQuery Example
|
/* jQuery Example
|
||||||
$(function(){
|
$(function(){
|
||||||
loggerUICore.log('UICore Initialized');
|
loggerUICore.info('UICore Initialized');
|
||||||
})*/
|
})*/
|
||||||
|
|
||||||
document.addEventListener('readystatechange', function () {
|
document.addEventListener('readystatechange', function () {
|
||||||
if (document.readyState === 'interactive'){
|
if (document.readyState === 'interactive'){
|
||||||
loggerUICore.log('UICore Initializing..')
|
loggerUICore.info('UICore Initializing..')
|
||||||
|
|
||||||
// Bind close button.
|
// Bind close button.
|
||||||
Array.from(document.getElementsByClassName('fCb')).map((val) => {
|
Array.from(document.getElementsByClassName('fCb')).map((val) => {
|
||||||
|
78
package-lock.json
generated
78
package-lock.json
generated
@ -31,7 +31,7 @@
|
|||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"electron": "^21.3.1",
|
"electron": "^21.3.1",
|
||||||
"electron-builder": "^23.6.0",
|
"electron-builder": "^23.6.0",
|
||||||
"eslint": "^8.28.0"
|
"eslint": "^8.30.0"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": "16.x.x"
|
"node": "16.x.x"
|
||||||
@ -309,15 +309,15 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@eslint/eslintrc": {
|
"node_modules/@eslint/eslintrc": {
|
||||||
"version": "1.3.3",
|
"version": "1.4.0",
|
||||||
"resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-1.3.3.tgz",
|
"resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-1.4.0.tgz",
|
||||||
"integrity": "sha512-uj3pT6Mg+3t39fvLrj8iuCIJ38zKO9FpGtJ4BBJebJhEwjoT+KLVNCcHT5QC9NGRIEi7fZ0ZR8YRb884auB4Lg==",
|
"integrity": "sha512-7yfvXy6MWLgWSFsLhz5yH3iQ52St8cdUY6FoGieKkRDVxuxmrNuUetIuu6cmjNWwniUHiWXjxCr5tTXDrbYS5A==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"ajv": "^6.12.4",
|
"ajv": "^6.12.4",
|
||||||
"debug": "^4.3.2",
|
"debug": "^4.3.2",
|
||||||
"espree": "^9.4.0",
|
"espree": "^9.4.0",
|
||||||
"globals": "^13.15.0",
|
"globals": "^13.19.0",
|
||||||
"ignore": "^5.2.0",
|
"ignore": "^5.2.0",
|
||||||
"import-fresh": "^3.2.1",
|
"import-fresh": "^3.2.1",
|
||||||
"js-yaml": "^4.1.0",
|
"js-yaml": "^4.1.0",
|
||||||
@ -332,9 +332,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@humanwhocodes/config-array": {
|
"node_modules/@humanwhocodes/config-array": {
|
||||||
"version": "0.11.7",
|
"version": "0.11.8",
|
||||||
"resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.7.tgz",
|
"resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.8.tgz",
|
||||||
"integrity": "sha512-kBbPWzN8oVMLb0hOUYXhmxggL/1cJE6ydvjDIGi9EnAGUyA7cLVKQg+d/Dsm+KZwx2czGHrCmMVLiyg8s5JPKw==",
|
"integrity": "sha512-UybHIJzJnR5Qc/MsD9Kr+RpO2h+/P1GhOwdiLPXK5TWk5sgTdu88bTD9UP+CKbPPh5Rni1u0GjAdYQLemG8g+g==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@humanwhocodes/object-schema": "^1.2.1",
|
"@humanwhocodes/object-schema": "^1.2.1",
|
||||||
@ -1713,13 +1713,13 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/eslint": {
|
"node_modules/eslint": {
|
||||||
"version": "8.28.0",
|
"version": "8.30.0",
|
||||||
"resolved": "https://registry.npmjs.org/eslint/-/eslint-8.28.0.tgz",
|
"resolved": "https://registry.npmjs.org/eslint/-/eslint-8.30.0.tgz",
|
||||||
"integrity": "sha512-S27Di+EVyMxcHiwDrFzk8dJYAaD+/5SoWKxL1ri/71CRHsnJnRDPNt2Kzj24+MT9FDupf4aqqyqPrvI8MvQ4VQ==",
|
"integrity": "sha512-MGADB39QqYuzEGov+F/qb18r4i7DohCDOfatHaxI2iGlPuC65bwG2gxgO+7DkyL38dRFaRH7RaRAgU6JKL9rMQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@eslint/eslintrc": "^1.3.3",
|
"@eslint/eslintrc": "^1.4.0",
|
||||||
"@humanwhocodes/config-array": "^0.11.6",
|
"@humanwhocodes/config-array": "^0.11.8",
|
||||||
"@humanwhocodes/module-importer": "^1.0.1",
|
"@humanwhocodes/module-importer": "^1.0.1",
|
||||||
"@nodelib/fs.walk": "^1.2.8",
|
"@nodelib/fs.walk": "^1.2.8",
|
||||||
"ajv": "^6.10.0",
|
"ajv": "^6.10.0",
|
||||||
@ -1738,7 +1738,7 @@
|
|||||||
"file-entry-cache": "^6.0.1",
|
"file-entry-cache": "^6.0.1",
|
||||||
"find-up": "^5.0.0",
|
"find-up": "^5.0.0",
|
||||||
"glob-parent": "^6.0.2",
|
"glob-parent": "^6.0.2",
|
||||||
"globals": "^13.15.0",
|
"globals": "^13.19.0",
|
||||||
"grapheme-splitter": "^1.0.4",
|
"grapheme-splitter": "^1.0.4",
|
||||||
"ignore": "^5.2.0",
|
"ignore": "^5.2.0",
|
||||||
"import-fresh": "^3.0.0",
|
"import-fresh": "^3.0.0",
|
||||||
@ -2204,9 +2204,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/globals": {
|
"node_modules/globals": {
|
||||||
"version": "13.18.0",
|
"version": "13.19.0",
|
||||||
"resolved": "https://registry.npmjs.org/globals/-/globals-13.18.0.tgz",
|
"resolved": "https://registry.npmjs.org/globals/-/globals-13.19.0.tgz",
|
||||||
"integrity": "sha512-/mR4KI8Ps2spmoc0Ulu9L7agOF0du1CZNQ3dke8yItYlyKNmGrkONemBbd6V8UTc1Wgcqn21t3WYB7dbRmh6/A==",
|
"integrity": "sha512-dkQ957uSRWHw7CFXLUtUHQI3g3aWApYhfNR2O6jn/907riyTYKVBmxYVROkBcY614FSSeSJh7Xm7SrUWCxvJMQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"type-fest": "^0.20.2"
|
"type-fest": "^0.20.2"
|
||||||
@ -2469,9 +2469,9 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"node_modules/ignore": {
|
"node_modules/ignore": {
|
||||||
"version": "5.2.1",
|
"version": "5.2.4",
|
||||||
"resolved": "https://registry.npmjs.org/ignore/-/ignore-5.2.1.tgz",
|
"resolved": "https://registry.npmjs.org/ignore/-/ignore-5.2.4.tgz",
|
||||||
"integrity": "sha512-d2qQLzTJ9WxQftPAuEQpSPmKqzxePjzVbpAVv62AQ64NTL+wR4JkrVqR/LqFsFEUsHDAiId52mJteHDFuDkElA==",
|
"integrity": "sha512-MAb38BcSbH0eHNBxn7ql2NH/kX33OkB3lZ1BNdh7ENeRChHTYsTvWrMubiIAMNS2llXEEgZ1MUOBtXChP3kaFQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">= 4"
|
"node": ">= 4"
|
||||||
@ -4456,15 +4456,15 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@eslint/eslintrc": {
|
"@eslint/eslintrc": {
|
||||||
"version": "1.3.3",
|
"version": "1.4.0",
|
||||||
"resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-1.3.3.tgz",
|
"resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-1.4.0.tgz",
|
||||||
"integrity": "sha512-uj3pT6Mg+3t39fvLrj8iuCIJ38zKO9FpGtJ4BBJebJhEwjoT+KLVNCcHT5QC9NGRIEi7fZ0ZR8YRb884auB4Lg==",
|
"integrity": "sha512-7yfvXy6MWLgWSFsLhz5yH3iQ52St8cdUY6FoGieKkRDVxuxmrNuUetIuu6cmjNWwniUHiWXjxCr5tTXDrbYS5A==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"ajv": "^6.12.4",
|
"ajv": "^6.12.4",
|
||||||
"debug": "^4.3.2",
|
"debug": "^4.3.2",
|
||||||
"espree": "^9.4.0",
|
"espree": "^9.4.0",
|
||||||
"globals": "^13.15.0",
|
"globals": "^13.19.0",
|
||||||
"ignore": "^5.2.0",
|
"ignore": "^5.2.0",
|
||||||
"import-fresh": "^3.2.1",
|
"import-fresh": "^3.2.1",
|
||||||
"js-yaml": "^4.1.0",
|
"js-yaml": "^4.1.0",
|
||||||
@ -4473,9 +4473,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@humanwhocodes/config-array": {
|
"@humanwhocodes/config-array": {
|
||||||
"version": "0.11.7",
|
"version": "0.11.8",
|
||||||
"resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.7.tgz",
|
"resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.8.tgz",
|
||||||
"integrity": "sha512-kBbPWzN8oVMLb0hOUYXhmxggL/1cJE6ydvjDIGi9EnAGUyA7cLVKQg+d/Dsm+KZwx2czGHrCmMVLiyg8s5JPKw==",
|
"integrity": "sha512-UybHIJzJnR5Qc/MsD9Kr+RpO2h+/P1GhOwdiLPXK5TWk5sgTdu88bTD9UP+CKbPPh5Rni1u0GjAdYQLemG8g+g==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"@humanwhocodes/object-schema": "^1.2.1",
|
"@humanwhocodes/object-schema": "^1.2.1",
|
||||||
@ -5563,13 +5563,13 @@
|
|||||||
"devOptional": true
|
"devOptional": true
|
||||||
},
|
},
|
||||||
"eslint": {
|
"eslint": {
|
||||||
"version": "8.28.0",
|
"version": "8.30.0",
|
||||||
"resolved": "https://registry.npmjs.org/eslint/-/eslint-8.28.0.tgz",
|
"resolved": "https://registry.npmjs.org/eslint/-/eslint-8.30.0.tgz",
|
||||||
"integrity": "sha512-S27Di+EVyMxcHiwDrFzk8dJYAaD+/5SoWKxL1ri/71CRHsnJnRDPNt2Kzj24+MT9FDupf4aqqyqPrvI8MvQ4VQ==",
|
"integrity": "sha512-MGADB39QqYuzEGov+F/qb18r4i7DohCDOfatHaxI2iGlPuC65bwG2gxgO+7DkyL38dRFaRH7RaRAgU6JKL9rMQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"@eslint/eslintrc": "^1.3.3",
|
"@eslint/eslintrc": "^1.4.0",
|
||||||
"@humanwhocodes/config-array": "^0.11.6",
|
"@humanwhocodes/config-array": "^0.11.8",
|
||||||
"@humanwhocodes/module-importer": "^1.0.1",
|
"@humanwhocodes/module-importer": "^1.0.1",
|
||||||
"@nodelib/fs.walk": "^1.2.8",
|
"@nodelib/fs.walk": "^1.2.8",
|
||||||
"ajv": "^6.10.0",
|
"ajv": "^6.10.0",
|
||||||
@ -5588,7 +5588,7 @@
|
|||||||
"file-entry-cache": "^6.0.1",
|
"file-entry-cache": "^6.0.1",
|
||||||
"find-up": "^5.0.0",
|
"find-up": "^5.0.0",
|
||||||
"glob-parent": "^6.0.2",
|
"glob-parent": "^6.0.2",
|
||||||
"globals": "^13.15.0",
|
"globals": "^13.19.0",
|
||||||
"grapheme-splitter": "^1.0.4",
|
"grapheme-splitter": "^1.0.4",
|
||||||
"ignore": "^5.2.0",
|
"ignore": "^5.2.0",
|
||||||
"import-fresh": "^3.0.0",
|
"import-fresh": "^3.0.0",
|
||||||
@ -5948,9 +5948,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"globals": {
|
"globals": {
|
||||||
"version": "13.18.0",
|
"version": "13.19.0",
|
||||||
"resolved": "https://registry.npmjs.org/globals/-/globals-13.18.0.tgz",
|
"resolved": "https://registry.npmjs.org/globals/-/globals-13.19.0.tgz",
|
||||||
"integrity": "sha512-/mR4KI8Ps2spmoc0Ulu9L7agOF0du1CZNQ3dke8yItYlyKNmGrkONemBbd6V8UTc1Wgcqn21t3WYB7dbRmh6/A==",
|
"integrity": "sha512-dkQ957uSRWHw7CFXLUtUHQI3g3aWApYhfNR2O6jn/907riyTYKVBmxYVROkBcY614FSSeSJh7Xm7SrUWCxvJMQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"type-fest": "^0.20.2"
|
"type-fest": "^0.20.2"
|
||||||
@ -6134,9 +6134,9 @@
|
|||||||
"integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA=="
|
"integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA=="
|
||||||
},
|
},
|
||||||
"ignore": {
|
"ignore": {
|
||||||
"version": "5.2.1",
|
"version": "5.2.4",
|
||||||
"resolved": "https://registry.npmjs.org/ignore/-/ignore-5.2.1.tgz",
|
"resolved": "https://registry.npmjs.org/ignore/-/ignore-5.2.4.tgz",
|
||||||
"integrity": "sha512-d2qQLzTJ9WxQftPAuEQpSPmKqzxePjzVbpAVv62AQ64NTL+wR4JkrVqR/LqFsFEUsHDAiId52mJteHDFuDkElA==",
|
"integrity": "sha512-MAb38BcSbH0eHNBxn7ql2NH/kX33OkB3lZ1BNdh7ENeRChHTYsTvWrMubiIAMNS2llXEEgZ1MUOBtXChP3kaFQ==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"import-fresh": {
|
"import-fresh": {
|
||||||
|
@ -45,7 +45,7 @@
|
|||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"electron": "^21.3.1",
|
"electron": "^21.3.1",
|
||||||
"electron-builder": "^23.6.0",
|
"electron-builder": "^23.6.0",
|
||||||
"eslint": "^8.28.0"
|
"eslint": "^8.30.0"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
|
Loading…
Reference in New Issue
Block a user