5c7e0c3c8a
Fixed an issue with concurrency when there are no downloads queued on launch. Added support for static function execution in AssetExec. Fixed a binding issue in uicore.js caused by delayed div loading. For now the solution is just hard coding in the value, will probably switch these two a css file later on. Included the launcher's x64 runtime directory in Java scans.
39 lines
1.2 KiB
JavaScript
39 lines
1.2 KiB
JavaScript
const {AssetGuard} = require('./assetguard.js')
|
|
|
|
const tracker = new AssetGuard(process.argv[2], process.argv[3])
|
|
console.log('AssetExec Started')
|
|
|
|
// Temporary for debug purposes.
|
|
process.on('unhandledRejection', r => console.log(r))
|
|
|
|
tracker.on('totaldlprogress', (data) => {
|
|
process.send({task: 0, total: data.total, value: data.acc, percent: parseInt((data.acc/data.total)*100), content: 'dl'})
|
|
})
|
|
|
|
tracker.on('dlcomplete', () => {
|
|
process.send({task: 1, content: 'dl'})
|
|
})
|
|
|
|
process.on('message', (msg) => {
|
|
if(msg.task === 0){
|
|
const func = msg.content
|
|
let nS = tracker[func]
|
|
let iS = AssetGuard[func]
|
|
if(typeof nS === 'function' || typeof iS === 'function'){
|
|
const f = typeof nS === 'function' ? nS : iS
|
|
const res = f.apply(f === nS ? tracker : null, msg.argsArr)
|
|
if(res instanceof Promise){
|
|
res.then((v) => {
|
|
process.send({result: v, content: msg.content})
|
|
})
|
|
} else {
|
|
process.send({result: res, content: msg.content})
|
|
}
|
|
}
|
|
}
|
|
})
|
|
|
|
process.on('disconnect', () => {
|
|
console.log('AssetExec Disconnected')
|
|
process.exit(0)
|
|
}) |