mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-20 07:43:12 +09:00
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.
This commit is contained in:
1 parent
3cf9f96233
commit
4e1116ae2d
7 files changed
+104
-3
No files matched your search
@@ -0,0 +1,28 @@
|
||||
"use strict";
|
||||
const { ModPack } = require("@clusterio/lib");
|
||||
|
||||
const pack = new ModPack();
|
||||
pack.name = "test-settings";
|
||||
pack.mods.set("test_mod", { name: "test_mod", enabled: true, version: "0.0.0" });
|
||||
const settingTypes = [
|
||||
"bool-setting",
|
||||
"int-setting",
|
||||
"double-setting",
|
||||
"string-setting",
|
||||
"color-setting",
|
||||
];
|
||||
const settingValues = {
|
||||
"bool": false,
|
||||
"int": 1,
|
||||
"double": 0.5,
|
||||
"string": "str",
|
||||
"color": { r: 0, g: 1, b: 0, a: 1 },
|
||||
// "missing":
|
||||
};
|
||||
for (const type of settingTypes) {
|
||||
for (const [valueType, value] of Object.entries(settingValues)) {
|
||||
pack.settings.startup.set(`${type}-with-${valueType}-value`, { value });
|
||||
}
|
||||
}
|
||||
/* eslint-disable no-console */
|
||||
console.log(pack.toModPackString());
|
||||
Reference in new issue
Block a user