v1.0.4 - Logic cleanup, minor bug fixes.

Removed the old workaround logic for queueing archives for extraction.
Removed the old forge callback (this was replaced a while ago).
Fixed a typo in _parseDistroModules (getType).
Use discordrpc straight from the repository. The author has refused to push the bugfix for nearly a month.
Fix timestamp issue on discord rich presence.
Dependency upgrades.
This commit is contained in:
Daniel Scalzi
2018-10-31 01:25:38 -04:00
parent 96d08955a4
commit ce86840a87
4 changed files with 46 additions and 97 deletions

View File

@@ -1282,14 +1282,6 @@ class AssetGuard extends EventEmitter {
const self = this
return new Promise((resolve, reject) => {
self.forge = self._parseDistroModules(server.getModules(), server.getMinecraftVersion(), server.getID())
// Correct our workaround here.
let decompressqueue = self.forge.callback
self.extractQueue = decompressqueue
self.forge.callback = (asset, self) => {
if(asset.type === DistroManager.Types.ForgeHosted || asset.type === DistroManager.Types.Forge){
AssetGuard._finalizeForgeAsset(asset, self.commonPath).catch(err => console.log(err))
}
}
resolve(server)
})
}
@@ -1297,29 +1289,25 @@ class AssetGuard extends EventEmitter {
_parseDistroModules(modules, version, servid){
let alist = []
let asize = 0
let decompressqueue = []
for(let ob of modules){
let obType = ob.getType
let obArtifact = ob.getArtifact()
let obPath = obArtifact.getPath()
let artifact = new DistroModule(ob.getIdentifier(), obArtifact.getHash(), obArtifact.getSize(), obArtifact.getURL(), obPath, obType)
let artifact = new DistroModule(ob.getIdentifier(), obArtifact.getHash(), obArtifact.getSize(), obArtifact.getURL(), obPath, ob.getType())
const validationPath = obPath.toLowerCase().endsWith('.pack.xz') ? obPath.substring(0, obPath.toLowerCase().lastIndexOf('.pack.xz')) : obPath
if(!AssetGuard._validateLocal(validationPath, 'MD5', artifact.hash)){
asize += artifact.size*1
alist.push(artifact)
if(validationPath !== obPath) decompressqueue.push(obPath)
if(validationPath !== obPath) this.extractQueue.push(obPath)
}
//Recursively process the submodules then combine the results.
if(ob.getSubModules() != null){
let dltrack = this._parseDistroModules(ob.getSubModules(), version, servid)
asize += dltrack.dlsize*1
alist = alist.concat(dltrack.dlqueue)
decompressqueue = decompressqueue.concat(dltrack.callback)
}
}
//Since we have no callback at this point, we use this value to store the decompressqueue.
return new DLTracker(alist, asize, decompressqueue)
return new DLTracker(alist, asize)
}
/**

View File

@@ -16,7 +16,7 @@ exports.initRPC = function(genSettings, servSettings, initialDetails = 'Waiting
largeImageText: servSettings.largeImageText,
smallImageKey: genSettings.smallImageKey,
smallImageText: genSettings.smallImageText,
startTimestamp: new Date().getTime() / 1000,
startTimestamp: new Date().getTime(),
instance: false
}