Remove includeHash option to toModPackString

Since the Mod Portal provides SHA1 hashes it makes sense to always
include the hashes with mod pack strings if they are available.
This commit is contained in:
Hornwitser committed 2022-09-24 21:49:41 +02:00
1 parent 9b4ca86650
commit af79e2abbd
2 files changed
+2 -9

No files matched your search

+1 -8
View File
@@ -170,16 +170,9 @@ class ModPack {
return json; return json;
} }
toModPackString(includeHash = false) { toModPackString() {
const json = this.toJSON(); const json = this.toJSON();
delete json.id; delete json.id;
if (json.mods && !includeHash) {
json.mods = json.mods.map(m => {
m = { ...m };
delete m.sha1;
return m;
});
}
// eslint-disable-next-line node/no-sync // eslint-disable-next-line node/no-sync
let buf = zlib.deflateSync(JSON.stringify(json)); let buf = zlib.deflateSync(JSON.stringify(json));
+1 -1
View File
@@ -16,7 +16,7 @@ describe("lib/data/ModPack", function() {
throw validate.errors; throw validate.errors;
} }
assert.deepEqual(new ModPack(json), pack); assert.deepEqual(new ModPack(json), pack);
const packStringed = ModPack.fromModPackString(pack.toModPackString(true)); const packStringed = ModPack.fromModPackString(pack.toModPackString());
packStringed.id = pack.id; packStringed.id = pack.id;
assert.deepEqual(packStringed, pack); assert.deepEqual(packStringed, pack);
} }