diff --git a/packages/ctl/src/commands.js b/packages/ctl/src/commands.js
index 81400b8d..3ee812c7 100644
--- a/packages/ctl/src/commands.js
+++ b/packages/ctl/src/commands.js
@@ -875,7 +875,7 @@ modPackCommands.add(new libCommand.Command({
if (field === "mods") {
print(`${field}:`);
for (let entry of value) {
- print(` ${entry.name} ${entry.version}${entry.hash ? ` (${entry.hash})` : ""}`);
+ print(` ${entry.name} ${entry.version}${entry.sha1 ? ` (${entry.sha1})` : ""}`);
}
} else if (field === "settings") {
print(`${field}:`);
@@ -958,7 +958,7 @@ function setModPackMods(modPack, mods) {
if (sha1 && !/^[0-9a-f]{40}$/.test(sha1)) {
throw new libErrors.CommandError("sha1 must be a 40 digit lower case hex string");
}
- modPack.mods.set(name, { name, version, hash: sha1 ? `sha1:${sha1}` : undefined });
+ modPack.mods.set(name, { name, version, sha1 });
}
}
diff --git a/packages/lib/data/ModInfo.js b/packages/lib/data/ModInfo.js
index e1949d0c..e3bcce46 100644
--- a/packages/lib/data/ModInfo.js
+++ b/packages/lib/data/ModInfo.js
@@ -111,10 +111,10 @@ class ModInfo {
size = 0;
/**
- * Hash of this mod
+ * SHA1 hash of this mod
* @type {string=}
*/
- hash;
+ sha1;
/**
* True if this mod has been deleted
@@ -147,7 +147,7 @@ class ModInfo {
...this.infoJsonSchema.properties,
"filename": { type: "string" },
"size": { type: "integer" },
- "hash": { type: "string" },
+ "sha1": { type: "string" },
"is_deleted": { type: "boolean" },
},
};
@@ -169,7 +169,7 @@ class ModInfo {
// Additional data
if (json.filename) { this.filename = json.filename; }
if (json.size) { this.size = json.size; }
- if (json.hash) { this.hash = json.hash; }
+ if (json.sha1) { this.sha1 = json.sha1; }
if (json.is_deleted) { this.isDeleted = json.is_deleted; }
}
@@ -189,7 +189,7 @@ class ModInfo {
}
if (this.filename) { json.filename = this.filename; }
if (this.size) { json.size = this.size; }
- if (this.hash) { json.hash = this.hash; }
+ if (this.sha1) { json.sha1 = this.sha1; }
if (this.isDeleted) { json.is_deleted = this.isDeleted; }
return json;
}
@@ -215,13 +215,12 @@ class ModInfo {
throw new Error("Mod's info.json is not valid");
}
- let hash = `sha1:${await libHash.hashFile(modPath)}`;
return new this({
...modInfo,
filename: path.basename(modPath),
size: (await fs.stat(modPath)).size,
- hash,
+ sha1: await libHash.hashFile(modPath),
is_deleted: false,
});
}
diff --git a/packages/lib/data/ModPack.js b/packages/lib/data/ModPack.js
index 9dd09154..c13e6bf0 100644
--- a/packages/lib/data/ModPack.js
+++ b/packages/lib/data/ModPack.js
@@ -28,7 +28,7 @@ const ModSettingsJsonSchema = {
* @typedef {object} module:lib/data/ModPack~ModRecord
* @property {string} name - name of the mod.
* @property {string} version - version of the mod.
- * @property {string} hash - hash of the zip file.
+ * @property {string} sha1 - SHA1 hash of the zip file.
*/
const ModRecordJsonSchema = {
type: "object",
@@ -37,7 +37,7 @@ const ModRecordJsonSchema = {
properties: {
"name": { type: "string" },
"version": { type: "string" },
- "hash": { type: "string" },
+ "sha1": { type: "string" },
},
};
@@ -176,7 +176,7 @@ class ModPack {
if (json.mods && !includeHash) {
json.mods = json.mods.map(m => {
m = { ...m };
- delete m.hash;
+ delete m.sha1;
return m;
});
}
diff --git a/packages/master/src/ControlConnection.js b/packages/master/src/ControlConnection.js
index bcae4226..6e9cd9a2 100644
--- a/packages/master/src/ControlConnection.js
+++ b/packages/master/src/ControlConnection.js
@@ -576,7 +576,7 @@ class ControlConnection extends BaseConnection {
// dependencies
filename: "word",
// size
- hash: "word",
+ sha1: "word",
});
let factorioVersion = message.data.factorio_version;
diff --git a/packages/web_ui/src/components/ModDetails.jsx b/packages/web_ui/src/components/ModDetails.jsx
index f6e1b1d0..af5ebd78 100644
--- a/packages/web_ui/src/components/ModDetails.jsx
+++ b/packages/web_ui/src/components/ModDetails.jsx
@@ -33,7 +33,7 @@ export default function ModDetails(props) {
{mod.size !== undefined
&& {libHelpers.formatBytes(mod.size)}
}
- {mod.hash && {mod.hash}}
+ {mod.sha1 && {mod.sha1}}
{mod.dependencies && mod.dependencies.length
&&
{mod.dependencies
diff --git a/packages/web_ui/src/components/ModPackViewPage.jsx b/packages/web_ui/src/components/ModPackViewPage.jsx
index 1d01ca5e..17042616 100644
--- a/packages/web_ui/src/components/ModPackViewPage.jsx
+++ b/packages/web_ui/src/components/ModPackViewPage.jsx
@@ -95,7 +95,7 @@ function SearchModsTable(props) {
props.onChange({
type: "mods.set",
name: mod.name,
- value: { name: mod.name, version: mod.version, hash: mod.hash },
+ value: { name: mod.name, version: mod.version, sha1: mod.sha1 },
});
}}
>{props.modPack.mods.has(mod.name) ? "change" : "add"}
@@ -107,7 +107,7 @@ function SearchModsTable(props) {
props.onChange({
type: "mods.delete",
name: mod.name,
- value: { name: mod.name, version: mod.version, hash: mod.hash },
+ value: { name: mod.name, version: mod.version, sha1: mod.sha1 },
});
}}
>remove
diff --git a/test/integration/clusterio.js b/test/integration/clusterio.js
index 8c88c244..f1ecbb1c 100644
--- a/test/integration/clusterio.js
+++ b/test/integration/clusterio.js
@@ -917,7 +917,7 @@ describe("Integration of Clusterio", function() {
"dependencies:\n" +
"filename: empty_mod_1.0.0.zip\n" +
`size: ${stat.size}\n` +
- `hash: sha1:${hash}\n`,
+ `sha1: ${hash}\n`,
);
});
});
diff --git a/test/lib/data/ModInfo.js b/test/lib/data/ModInfo.js
index f3de1794..9e435e81 100644
--- a/test/lib/data/ModInfo.js
+++ b/test/lib/data/ModInfo.js
@@ -34,7 +34,7 @@ describe("lib/data/ModInfo", function() {
check(new ModInfo({ dependencies: ["UltraMod", "SuperLib >= 1.00", "! bad-mod"] }));
check(new ModInfo({ filename: "MyMod_1.0.0.zip" }));
check(new ModInfo({ size: 1024 }));
- check(new ModInfo({ hash: "sha5:verified-as-MyMod" }));
+ check(new ModInfo({ sha1: "verified-as-MyMod" }));
check(new ModInfo({ is_deleted: true }));
// All at once
@@ -50,7 +50,7 @@ describe("lib/data/ModInfo", function() {
dependencies: ["UltraMod", "SuperLib >= 1.00", "! bad-mod"],
filename: "MyMod_1.0.0.zip",
size: 1024,
- hash: "sha5:verified-as-MyMod",
+ sha1: "verified-as-MyMod",
is_deleted: true,
}));
});
@@ -93,7 +93,7 @@ describe("lib/data/ModInfo", function() {
dependencies: [],
filename: "empty_mod_1.0.0.zip",
size: stat.size,
- hash: `sha1:${hash}`,
+ sha1: hash,
})
);
});
diff --git a/test/lib/data/ModPack.js b/test/lib/data/ModPack.js
index 9c32a17e..9d08bdc5 100644
--- a/test/lib/data/ModPack.js
+++ b/test/lib/data/ModPack.js
@@ -27,7 +27,7 @@ describe("lib/data/ModPack", function() {
check(new ModPack({ factorio_version: "2.0" }));
check(new ModPack({ mods: [
{ name: "subspace_storage", version: "1.99.8" },
- { name: "clusterio_lib", version: "0.1.2", hash: "sha1:012345abcd" },
+ { name: "clusterio_lib", version: "0.1.2", sha1: "012345abcd" },
]}));
check(new ModPack({ settings: {
"startup": {
@@ -47,7 +47,7 @@ describe("lib/data/ModPack", function() {
factorio_version: "2.0",
mods: [
{ name: "subspace_storage", version: "1.99.8" },
- { name: "clusterio_lib", version: "0.1.2", hash: "sha1:012345abcd" },
+ { name: "clusterio_lib", version: "0.1.2", sha1: "012345abcd" },
],
settings: {
"startup": {