Skip to content

Commit

Permalink
v1.0.4 - Logic cleanup, minor bug fixes.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
dscalzi committed Oct 31, 2018
1 parent 96d0895 commit ce86840
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 97 deletions.
18 changes: 3 additions & 15 deletions app/assets/js/assetguard.js
Original file line number Diff line number Diff line change
Expand Up @@ -1282,44 +1282,32 @@ 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)
})
}

_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)
}

/**
Expand Down
2 changes: 1 addition & 1 deletion app/assets/js/discordwrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
115 changes: 38 additions & 77 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "westeroscraftlauncher",
"version": "1.0.3",
"version": "1.0.4",
"description": "Custom modded launcher for Westeroscraft",
"productName": "WesterosCraft Launcher",
"main": "index.js",
Expand Down Expand Up @@ -33,10 +33,10 @@
"dependencies": {
"adm-zip": "^0.4.11",
"async": "^2.6.1",
"discord-rpc": "^3.0.1",
"discord-rpc": "discordjs/RPC",
"ejs": "^2.6.1",
"ejs-electron": "^2.0.3",
"electron-updater": "^3.1.5",
"electron-updater": "^3.1.6",
"github-syntax-dark": "^0.5.0",
"jquery": "^3.3.1",
"mkdirp": "^0.5.1",
Expand All @@ -49,7 +49,7 @@
},
"devDependencies": {
"electron": "^3.0.6",
"electron-builder": "^20.29.1",
"electron-builder": "^20.30.0",
"eslint": "^5.8.0"
},
"build": {
Expand Down

0 comments on commit ce86840

Please sign in to comment.