From f0fb471ea13898e879d0f3b47203fc52760c0aa0 Mon Sep 17 00:00:00 2001 From: Danielv123 Date: Tue, 23 Apr 2024 21:56:12 +0200 Subject: [PATCH 01/11] Correctly handle module files missing from a previously patched save Resolves #611 --- packages/host/src/patch.ts | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/packages/host/src/patch.ts b/packages/host/src/patch.ts index 05497637..85850181 100644 --- a/packages/host/src/patch.ts +++ b/packages/host/src/patch.ts @@ -78,7 +78,14 @@ export class SaveModule { static async fromSave(json: Static, root: JSZip) { const module = new this(lib.ModuleInfo.fromJSON(json)); module.files = new Map( - await Promise.all(json.files.map(async f => [f, await root.file(f)!.async("nodebuffer")] as const)) + await Promise.all(json.files.map(async filename => { + const file = root.file(filename); + if (file === null) { + lib.logger.warn(`Missing file ${filename} in save`); + return [filename, Buffer.alloc(0)] as const; + } + return [filename, await file.async("nodebuffer")] as const; + })) ); return module; } @@ -395,8 +402,11 @@ export async function patch(savePath: string, modules: SaveModule[]) { } } else { for (let module of patchInfo.modules) { - for (let file of module.files.keys()) { - zip.remove(root.file(file)!.name); + for (let filepath of module.files.keys()) { + const file = root.file(filepath); + if (file !== null) { + zip.remove(file.name); + } } } patchInfo.modules = []; From 811c4f7127d902b9d3d50cd444e4a0b276f819bf Mon Sep 17 00:00:00 2001 From: Daniel Date: Tue, 23 Apr 2024 23:19:30 +0200 Subject: [PATCH 02/11] Use shell:true when running non-user input .cmd files on windows (#614) Required after CVE fix: https://nodejs.org/en/blog/vulnerability/april-2024-security-releases-2/ Resolves #612 --- packages/create/create.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/create/create.js b/packages/create/create.js index 66e4084a..3126f0dc 100755 --- a/packages/create/create.js +++ b/packages/create/create.js @@ -108,7 +108,7 @@ async function safeOutputFile(file, data, options={}) { async function execFile(cmd, args) { logger.verbose(`executing ${cmd} ${args.join(" ")}`); return new Promise((resolve, reject) => { - let child = child_process.execFile(cmd, args, (err, stdout, stderr) => { + let child = child_process.execFile(cmd, args, { shell: true }, (err, stdout, stderr) => { if (err) { reject(err); } else { From 7e7e7635175eb307a711bbeeee246c9efdcd660f Mon Sep 17 00:00:00 2001 From: Hornwitser Date: Sat, 27 Apr 2024 19:35:58 +0200 Subject: [PATCH 03/11] Add changelog for #600 --- CHANGELOG.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 31908653..eb69ae4a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -31,11 +31,13 @@ Many thanks to the following for contributing to this release: ### Changes -- Fixed Inventory Sync reporting a negative database size [ยค598](https://github.com/clusterio/clusterio/pull/598). +- Fixed Inventory Sync reporting a negative database size [#598](https://github.com/clusterio/clusterio/pull/598). - Fixed plugin events being invoked while a host connection was in an invalid state. +- Suppresed bogus warning about event listener leak in the browser's console [#600](https://github.com/clusterio/clusterio/pull/600). Many thanks to the following for contributing to this release: [@Cooldude2606](https://github.com/Cooldude2606) +[@Danielv123](https://github.com/Danielv123) ## Version 2.0.0-alpha.17 From b885e37b5b368e549587fb12b21840227f6a2c6e Mon Sep 17 00:00:00 2001 From: Hornwitser Date: Sat, 27 Apr 2024 19:39:57 +0200 Subject: [PATCH 04/11] Add changelog for #606 --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index eb69ae4a..57a8268f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -28,6 +28,7 @@ Many thanks to the following for contributing to this release: ### Features - Added logging of HTTP requests and errors on the controller [#556](https://github.com/clusterio/clusterio/pull/556). +- Added caching of data parsed from mods to speed up startup time [#606](https://github.com/clusterio/clusterio/pull/606). ### Changes @@ -38,6 +39,7 @@ Many thanks to the following for contributing to this release: Many thanks to the following for contributing to this release: [@Cooldude2606](https://github.com/Cooldude2606) [@Danielv123](https://github.com/Danielv123) +[@Hornwitser](https://github.com/Hornwitser) ## Version 2.0.0-alpha.17 From 9b416583f0db800685fc4e8d121cc526e6d7fdb5 Mon Sep 17 00:00:00 2001 From: Hornwitser Date: Sat, 27 Apr 2024 19:54:12 +0200 Subject: [PATCH 05/11] Add changelog for #570 --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 57a8268f..c03b895b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -29,6 +29,7 @@ Many thanks to the following for contributing to this release: - Added logging of HTTP requests and errors on the controller [#556](https://github.com/clusterio/clusterio/pull/556). - Added caching of data parsed from mods to speed up startup time [#606](https://github.com/clusterio/clusterio/pull/606). +- Added command to installer to generate the code for making a new plugin [#570](https://github.com/clusterio/clusterio/pull/570). ### Changes From 56124574fb612f7b5fb2f74713098b3c4c8b2f9f Mon Sep 17 00:00:00 2001 From: Hornwitser Date: Sat, 27 Apr 2024 19:58:00 +0200 Subject: [PATCH 06/11] Add changelog for #614 --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index c03b895b..f5b001ac 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -36,6 +36,7 @@ Many thanks to the following for contributing to this release: - Fixed Inventory Sync reporting a negative database size [#598](https://github.com/clusterio/clusterio/pull/598). - Fixed plugin events being invoked while a host connection was in an invalid state. - Suppresed bogus warning about event listener leak in the browser's console [#600](https://github.com/clusterio/clusterio/pull/600). +- Fixed installer breaking on Windows after Node.js released a security fix [#614](https://github.com/clusterio/clusterio/pull/614). Many thanks to the following for contributing to this release: [@Cooldude2606](https://github.com/Cooldude2606) From 8831b33c019d26272a44f77014fcacdb0b4fb26d Mon Sep 17 00:00:00 2001 From: Danielv123 Date: Sat, 27 Apr 2024 22:09:16 +0200 Subject: [PATCH 07/11] Filter out missing files on load --- packages/host/src/patch.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/packages/host/src/patch.ts b/packages/host/src/patch.ts index 85850181..c0047667 100644 --- a/packages/host/src/patch.ts +++ b/packages/host/src/patch.ts @@ -77,16 +77,16 @@ export class SaveModule { static async fromSave(json: Static, root: JSZip) { const module = new this(lib.ModuleInfo.fromJSON(json)); - module.files = new Map( - await Promise.all(json.files.map(async filename => { - const file = root.file(filename); + module.files = new Map(await Promise.all(json.files + .map(filename => ({filename, file: root.file(filename)})) + .filter(({filename, file}) => { if (file === null) { lib.logger.warn(`Missing file ${filename} in save`); - return [filename, Buffer.alloc(0)] as const; } - return [filename, await file.async("nodebuffer")] as const; - })) - ); + return file !== null; + }) + .map(async ({filename, file}) => [filename, await file!.async("nodebuffer")] as const) + )); return module; } From 3cf9f9623321adcd3cc582bffae26126593cdb01 Mon Sep 17 00:00:00 2001 From: Hornwitser Date: Sun, 28 Apr 2024 16:35:08 +0200 Subject: [PATCH 08/11] Coerce mod settings types during data export Use the settings prototypes to coerce any incorrectly typed mod settings to the correct type either by casting or by replacing the value with the default value from the prototype. This will fix cases where an update to a mod changes the type of ono of its defined settings. --- CHANGELOG.md | 1 + packages/lib/src/data/ModPack.ts | 29 ++++++++---- test/lib/data/ModPack.js | 78 ++++++++++++++++++++++++++++++++ 3 files changed, 99 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f5b001ac..eb8459f9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -37,6 +37,7 @@ Many thanks to the following for contributing to this release: - Fixed plugin events being invoked while a host connection was in an invalid state. - Suppresed bogus warning about event listener leak in the browser's console [#600](https://github.com/clusterio/clusterio/pull/600). - Fixed installer breaking on Windows after Node.js released a security fix [#614](https://github.com/clusterio/clusterio/pull/614). +- During a data export the mod settings in mod packs will now be corrected to the type of the settings prototype if the type is incorrect. Many thanks to the following for contributing to this release: [@Cooldude2606](https://github.com/Cooldude2606) diff --git a/packages/lib/src/data/ModPack.ts b/packages/lib/src/data/ModPack.ts index 85dba1fb..4321fee5 100644 --- a/packages/lib/src/data/ModPack.ts +++ b/packages/lib/src/data/ModPack.ts @@ -334,10 +334,11 @@ export default class ModPack { } /** - * Fill in missing settings with their default values + * Fill in missing and incorrect settings with their default values * - * Uses the provided setting prototypes to add any missing mod settings - * in the mod pack with the default value from the prototype. + * Uses the provided setting prototypes to correct any missing and or + * incorrect mod settings in the mod pack with the default value from + * the prototype. * * @param settingPrototypes - * Setting prototypes exported from the game. @@ -360,13 +361,23 @@ export default class ModPack { logger.warn(`Ignoring ${prototype.name} with missing default_value`); continue; } - if (this.settings[settingType].get(prototype.name)) { - continue; + let value = this.settings[settingType].get(prototype.name)?.value ?? prototype.default_value; + const type = prototype.type; + if ( + type === "bool-setting" && typeof value !== "boolean" + || type === "color-setting" && typeof value !== "object" + || (type === "int-setting" || type === "double-setting") && typeof value !== "number" + ) { + value = prototype.default_value; } - - let value = prototype.default_value; - if (prototype.type === "color-setting") { - value = libLuaTools.normalizeColor(value); + if (type === "string-setting" && typeof value !== "string") { + value = typeof value === "object" ? prototype.default_value : String(value ?? ""); + } + if (type === "color-setting") { + if (typeof value !== "object") { + value = prototype.default_value; + } + value = libLuaTools.normalizeColor(value as object); } this.settings[settingType].set(prototype.name, { value }); } diff --git a/test/lib/data/ModPack.js b/test/lib/data/ModPack.js index 14616da3..d1fc713e 100644 --- a/test/lib/data/ModPack.js +++ b/test/lib/data/ModPack.js @@ -179,6 +179,84 @@ describe("lib/data/ModPack", function() { "runtime-per-user": {}, }); }); + it("should coerce values of the incorrect type into the correct type", function() { + const boolDefault = true; + const intDefault = 123; + const doubleDefault = 1234.5; + const stringDefault = "default"; + const colorDefault = { r: 1, g: 0, b: 1, a: 1}; + const settingDefaultValues = { + "bool-setting": boolDefault, + "int-setting": intDefault, + "double-setting": doubleDefault, + "string-setting": stringDefault, + "color-setting": colorDefault, + }; + const possibleValues = ["bool", "int", "double", "string", "color"]; + const settingPrototypes = { + "bool-setting": {}, + "int-setting": {}, + "double-setting": {}, + "string-setting": {}, + "color-setting": {}, + }; + for (const [type, default_value] of Object.entries(settingDefaultValues)) { + for (const value of possibleValues) { + const settingName = `${type}-with-${value}-value`; + settingPrototypes[type][settingName] = { + type, + name: settingName, + setting_type: "startup", + default_value, + }; + } + }; + + const pack = new ModPack(); + const settingValues = { + "bool": false, + "int": 1, + "double": 2.5, + "string": "str", + "color": { r: 0, g: 1, b: 0, a: 1 }, + }; + for (const type of Object.keys(settingDefaultValues)) { + for (const [valueType, value] of Object.entries(settingValues)) { + pack.settings.startup.set(`${type}-with-${valueType}-value`, { value }); + } + } + pack.fillDefaultSettings(settingPrototypes); + assert.deepEqual( + pack.settings["startup"], + new Map([ + ["bool-setting-with-bool-value", false], + ["bool-setting-with-int-value", boolDefault], + ["bool-setting-with-double-value", boolDefault], + ["bool-setting-with-string-value", boolDefault], + ["bool-setting-with-color-value", boolDefault], + ["int-setting-with-bool-value", intDefault], + ["int-setting-with-int-value", 1], + ["int-setting-with-double-value", 2.5], + ["int-setting-with-string-value", intDefault], + ["int-setting-with-color-value", intDefault], + ["double-setting-with-bool-value", doubleDefault], + ["double-setting-with-int-value", 1], + ["double-setting-with-double-value", 2.5], + ["double-setting-with-string-value", doubleDefault], + ["double-setting-with-color-value", doubleDefault], + ["string-setting-with-bool-value", "false"], + ["string-setting-with-int-value", "1"], + ["string-setting-with-double-value", "2.5"], + ["string-setting-with-string-value", "str"], + ["string-setting-with-color-value", stringDefault], + ["color-setting-with-bool-value", colorDefault], + ["color-setting-with-int-value", colorDefault], + ["color-setting-with-double-value", colorDefault], + ["color-setting-with-string-value", colorDefault], + ["color-setting-with-color-value", { r: 0, g: 1, b: 0, a: 1}], + ].map(([k, v]) => [k, { value: v }])), + ); + }); }); describe(".fromModPackString()", function() { From 4e1116ae2db0cef7fc1cd4b22a3731142ad0b431 Mon Sep 17 00:00:00 2001 From: Hornwitser Date: Sun, 28 Apr 2024 16:39:33 +0200 Subject: [PATCH 09/11] Gracefully handle bad mod setting types in Web UI Make sure all cobinations of missmatched types and missing mod settings are gracefully handled by the Web UI. Fixes #609. --- CHANGELOG.md | 1 + package.json | 2 +- .../web_ui/src/components/ModPackViewPage.tsx | 12 +++++-- test/manual/README.md | 35 +++++++++++++++++++ test/manual/test_mod/info.json | 7 ++++ test/manual/test_mod/settings.lua | 22 ++++++++++++ test/manual/test_settings_mod_pack.js | 28 +++++++++++++++ 7 files changed, 104 insertions(+), 3 deletions(-) create mode 100644 test/manual/README.md create mode 100644 test/manual/test_mod/info.json create mode 100644 test/manual/test_mod/settings.lua create mode 100644 test/manual/test_settings_mod_pack.js diff --git a/CHANGELOG.md b/CHANGELOG.md index eb8459f9..9dd176b9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -38,6 +38,7 @@ Many thanks to the following for contributing to this release: - Suppresed bogus warning about event listener leak in the browser's console [#600](https://github.com/clusterio/clusterio/pull/600). - Fixed installer breaking on Windows after Node.js released a security fix [#614](https://github.com/clusterio/clusterio/pull/614). - During a data export the mod settings in mod packs will now be corrected to the type of the settings prototype if the type is incorrect. +- Fixed missing color setting causing the Mod Pack view in the Web UI to show an error [#609](https://github.com/clusterio/clusterio/issues/609). Many thanks to the following for contributing to this release: [@Cooldude2606](https://github.com/Cooldude2606) diff --git a/package.json b/package.json index a5f4a506..e62b1c7f 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "scripts": { "build": "tsc --build", "watch": "tsc --build --watch", - "test": "pnpm run build && mocha --check-leaks -R spec --recursive test \"plugins/*/test/**\"", + "test": "pnpm run build && mocha --check-leaks -R spec --recursive test \"plugins/*/test/**\" --exclude \"test/manual/**\"", "fast-test": "FAST_TEST=y pnpm test", "cover": "nyc pnpm test", "fast-cover": "FAST_TEST=y nyc pnpm test", diff --git a/packages/web_ui/src/components/ModPackViewPage.tsx b/packages/web_ui/src/components/ModPackViewPage.tsx index 840155f2..93f07889 100644 --- a/packages/web_ui/src/components/ModPackViewPage.tsx +++ b/packages/web_ui/src/components/ModPackViewPage.tsx @@ -424,7 +424,15 @@ function InputColor(props: { value: lib.ModSettingColor, onChange: (value: lib.ModSettingColor) => void, }) { - const value = props.value; + // In certain edge cases it's possible a value for this mod setting does not exist + // or is of the wrong type. Fallback to black if this is the case. + function isColor(input: unknown) { + if (typeof input !== "object" || input === null) { + return false; + } + return "r" in input && "g" in input && "b" in input && "a" in input; + } + const value = isColor(props.value) ? props.value : { r: 0, g: 0, b: 0, a: 1 }; return Date: Sun, 28 Apr 2024 19:14:27 +0200 Subject: [PATCH 10/11] v2.0.0-alpha.18 --- packages/controller/package.json | 6 +++--- packages/create/package.json | 2 +- packages/ctl/package.json | 4 ++-- packages/host/package.json | 4 ++-- packages/lib/package.json | 2 +- packages/web_ui/package.json | 4 ++-- plugins/global_chat/package.json | 6 +++--- plugins/inventory_sync/package.json | 6 +++--- plugins/player_auth/package.json | 6 +++--- plugins/research_sync/package.json | 6 +++--- plugins/statistics_exporter/package.json | 6 +++--- plugins/subspace_storage/package.json | 6 +++--- 12 files changed, 29 insertions(+), 29 deletions(-) diff --git a/packages/controller/package.json b/packages/controller/package.json index 61a728e4..70238955 100644 --- a/packages/controller/package.json +++ b/packages/controller/package.json @@ -3,7 +3,7 @@ "description": "Implementation of Clusterio controller", "author": "Hornwitser", "license": "MIT", - "version": "2.0.0-alpha.17", + "version": "2.0.0-alpha.18", "main": "dist/node/index.js", "scripts": { "prepare": "tsc --build && webpack-cli --env production", @@ -19,7 +19,7 @@ "node": ">=18" }, "dependencies": { - "@clusterio/lib": "^2.0.0-alpha.17", + "@clusterio/lib": "^2.0.0-alpha.18", "@sinclair/typebox": "^0.30.4", "busboy": "^1.6.0", "compression": "^1.7.4", @@ -36,7 +36,7 @@ "yargs": "^17.7.2" }, "devDependencies": { - "@clusterio/web_ui": "^2.0.0-alpha.17", + "@clusterio/web_ui": "^2.0.0-alpha.18", "@swc/core": "^1.4.0", "@types/busboy": "^1.5.0", "@types/compression": "^1.7.2", diff --git a/packages/create/package.json b/packages/create/package.json index 7929cbb1..814e26f0 100644 --- a/packages/create/package.json +++ b/packages/create/package.json @@ -3,7 +3,7 @@ "description": "Installer for clusterio", "author": "Hornwitser", "license": "MIT", - "version": "2.0.0-alpha.17", + "version": "2.0.0-alpha.18", "main": "create.js", "bin": { "clusteriocreate": "./create.js" diff --git a/packages/ctl/package.json b/packages/ctl/package.json index 879afe37..4cfa6b84 100644 --- a/packages/ctl/package.json +++ b/packages/ctl/package.json @@ -3,7 +3,7 @@ "description": "Clusterio command line management tool", "author": "Hornwitser", "license": "MIT", - "version": "2.0.0-alpha.17", + "version": "2.0.0-alpha.18", "main": "dist/node/index.js", "scripts": { "prepare": "tsc --build", @@ -19,7 +19,7 @@ "node": ">=18" }, "dependencies": { - "@clusterio/lib": "^2.0.0-alpha.17", + "@clusterio/lib": "^2.0.0-alpha.18", "as-table": "^1.0.55", "fs-extra": "^11.1.1", "phin": "^3.7.0", diff --git a/packages/host/package.json b/packages/host/package.json index b339d0a0..613d40fd 100644 --- a/packages/host/package.json +++ b/packages/host/package.json @@ -3,7 +3,7 @@ "description": "Implementation of Clusterio host server", "author": "Hornwitser", "license": "MIT", - "version": "2.0.0-alpha.17", + "version": "2.0.0-alpha.18", "main": "dist/node/index.js", "scripts": { "prepare": "tsc --build", @@ -19,7 +19,7 @@ "node": ">=18" }, "dependencies": { - "@clusterio/lib": "^2.0.0-alpha.17", + "@clusterio/lib": "^2.0.0-alpha.18", "@sinclair/typebox": "^0.30.4", "fs-extra": "^11.1.1", "jimp": "^0.22.8", diff --git a/packages/lib/package.json b/packages/lib/package.json index 82afa633..bf27858b 100644 --- a/packages/lib/package.json +++ b/packages/lib/package.json @@ -1,7 +1,7 @@ { "name": "@clusterio/lib", "description": "Shared library for Clusterio", - "version": "2.0.0-alpha.17", + "version": "2.0.0-alpha.18", "repository": "https://github.com/clusterio/clusterio", "license": "MIT", "scripts": { diff --git a/packages/web_ui/package.json b/packages/web_ui/package.json index 0c7c4cc8..97c6aab5 100644 --- a/packages/web_ui/package.json +++ b/packages/web_ui/package.json @@ -3,7 +3,7 @@ "description": "Clusterio web interface implementation", "author": "Hornwitser", "license": "MIT", - "version": "2.0.0-alpha.17", + "version": "2.0.0-alpha.18", "browser": "src/index.ts", "main": "dist/browser/src/index.js", "scripts": { @@ -17,7 +17,7 @@ }, "dependencies": { "@ant-design/icons": "^5.1.4", - "@clusterio/lib": "^2.0.0-alpha.17", + "@clusterio/lib": "^2.0.0-alpha.18", "@swc/core": "^1.4.0", "antd": "^5.13.0", "assert": "^2.0.0", diff --git a/plugins/global_chat/package.json b/plugins/global_chat/package.json index 8f82dc80..2d1226a6 100644 --- a/plugins/global_chat/package.json +++ b/plugins/global_chat/package.json @@ -1,6 +1,6 @@ { "name": "@clusterio/plugin-global_chat", - "version": "2.0.0-alpha.17", + "version": "2.0.0-alpha.18", "description": "Clusterio plugin forwarding between Factorio servers", "author": "Hornwitser ", "homepage": "https://github.com/clusterio/clusterio#readme", @@ -21,8 +21,8 @@ "@clusterio/lib": "^2.0.0-alpha.0" }, "devDependencies": { - "@clusterio/lib": "^2.0.0-alpha.17", - "@clusterio/web_ui": "^2.0.0-alpha.17", + "@clusterio/lib": "^2.0.0-alpha.18", + "@clusterio/web_ui": "^2.0.0-alpha.18", "@types/node": "^20.4.5", "@types/react": "^18.2.21", "typescript": "^5.1.6", diff --git a/plugins/inventory_sync/package.json b/plugins/inventory_sync/package.json index 566e4006..d98b9ea7 100644 --- a/plugins/inventory_sync/package.json +++ b/plugins/inventory_sync/package.json @@ -1,6 +1,6 @@ { "name": "@clusterio/plugin-inventory_sync", - "version": "2.0.0-alpha.17", + "version": "2.0.0-alpha.18", "description": "Clusterio plugin forwarding between Factorio servers", "author": "Danielv ", "homepage": "https://github.com/clusterio/factorioClusterio#readme", @@ -25,8 +25,8 @@ "fs-extra": "^8.1.0" }, "devDependencies": { - "@clusterio/lib": "^2.0.0-alpha.17", - "@clusterio/web_ui": "^2.0.0-alpha.17", + "@clusterio/lib": "^2.0.0-alpha.18", + "@clusterio/web_ui": "^2.0.0-alpha.18", "@types/fs-extra": "^11.0.1", "@types/node": "^20.4.5", "@types/react": "^18.2.21", diff --git a/plugins/player_auth/package.json b/plugins/player_auth/package.json index b65f9186..c2e35762 100644 --- a/plugins/player_auth/package.json +++ b/plugins/player_auth/package.json @@ -1,6 +1,6 @@ { "name": "@clusterio/plugin-player_auth", - "version": "2.0.0-alpha.17", + "version": "2.0.0-alpha.18", "description": "Clusterio plugin authenticating logged in players to the web interface", "author": "Hornwitser ", "homepage": "https://github.com/clusterio/clusterio#readme", @@ -26,8 +26,8 @@ "jsonwebtoken": "^9.0.1" }, "devDependencies": { - "@clusterio/lib": "^2.0.0-alpha.17", - "@clusterio/web_ui": "^2.0.0-alpha.17", + "@clusterio/lib": "^2.0.0-alpha.18", + "@clusterio/web_ui": "^2.0.0-alpha.18", "@types/express": "^4.17.17", "@types/jsonwebtoken": "^9.0.2", "@types/node": "^20.4.5", diff --git a/plugins/research_sync/package.json b/plugins/research_sync/package.json index ed6c298a..d1bf14fa 100644 --- a/plugins/research_sync/package.json +++ b/plugins/research_sync/package.json @@ -1,6 +1,6 @@ { "name": "@clusterio/plugin-research_sync", - "version": "2.0.0-alpha.17", + "version": "2.0.0-alpha.18", "description": "Clusterio plugin for synchronizing research between Factorio servers", "author": "Hornwitser ", "homepage": "https://github.com/clusterio/clusterio#readme", @@ -25,8 +25,8 @@ "fs-extra": "^8.1.0" }, "devDependencies": { - "@clusterio/lib": "^2.0.0-alpha.17", - "@clusterio/web_ui": "^2.0.0-alpha.17", + "@clusterio/lib": "^2.0.0-alpha.18", + "@clusterio/web_ui": "^2.0.0-alpha.18", "@types/fs-extra": "^11.0.1", "@types/node": "^20.4.5", "@types/react": "^18.2.21", diff --git a/plugins/statistics_exporter/package.json b/plugins/statistics_exporter/package.json index c1bb9490..68a4d8f1 100644 --- a/plugins/statistics_exporter/package.json +++ b/plugins/statistics_exporter/package.json @@ -1,6 +1,6 @@ { "name": "@clusterio/plugin-statistics_exporter", - "version": "2.0.0-alpha.17", + "version": "2.0.0-alpha.18", "description": "Clusterio plugin for gathering statistics from Factorio servers", "author": "Hornwitser ", "homepage": "https://github.com/clusterio/clusterio#readme", @@ -21,8 +21,8 @@ "@clusterio/lib": "^2.0.0-alpha.0" }, "devDependencies": { - "@clusterio/lib": "^2.0.0-alpha.17", - "@clusterio/web_ui": "^2.0.0-alpha.17", + "@clusterio/lib": "^2.0.0-alpha.18", + "@clusterio/web_ui": "^2.0.0-alpha.18", "@types/node": "^20.4.5", "@types/react": "^18.2.21", "typescript": "^5.1.6", diff --git a/plugins/subspace_storage/package.json b/plugins/subspace_storage/package.json index 22fd77a8..288b4743 100644 --- a/plugins/subspace_storage/package.json +++ b/plugins/subspace_storage/package.json @@ -1,6 +1,6 @@ { "name": "@clusterio/plugin-subspace_storage", - "version": "2.0.0-alpha.17", + "version": "2.0.0-alpha.18", "description": "Clusterio plugin for sharing storage between Factorio servers", "author": "Hornwitser ", "homepage": "https://github.com/clusterio/clusterio#readme", @@ -25,8 +25,8 @@ "fs-extra": "^8.1.0" }, "devDependencies": { - "@clusterio/lib": "^2.0.0-alpha.17", - "@clusterio/web_ui": "^2.0.0-alpha.17", + "@clusterio/lib": "^2.0.0-alpha.18", + "@clusterio/web_ui": "^2.0.0-alpha.18", "@types/express": "^4.17.17", "@types/fs-extra": "^11.0.1", "@types/node": "^20.4.5", From e341adfb29c5c616511cc3076057ce1387074c9f Mon Sep 17 00:00:00 2001 From: Hornwitser Date: Sun, 28 Apr 2024 20:39:27 +0200 Subject: [PATCH 11/11] Remove redundant if condition Noticed-By: @Cooldude2606 --- packages/lib/src/data/ModPack.ts | 3 --- 1 file changed, 3 deletions(-) diff --git a/packages/lib/src/data/ModPack.ts b/packages/lib/src/data/ModPack.ts index 4321fee5..d8fa5b3a 100644 --- a/packages/lib/src/data/ModPack.ts +++ b/packages/lib/src/data/ModPack.ts @@ -374,9 +374,6 @@ export default class ModPack { value = typeof value === "object" ? prototype.default_value : String(value ?? ""); } if (type === "color-setting") { - if (typeof value !== "object") { - value = prototype.default_value; - } value = libLuaTools.normalizeColor(value as object); } this.settings[settingType].set(prototype.name, { value });