diff --git a/src/controllers/custom/updateConfigDataController.ts b/src/controllers/custom/updateConfigDataController.ts index 38d6ca35b..1b13cc608 100644 --- a/src/controllers/custom/updateConfigDataController.ts +++ b/src/controllers/custom/updateConfigDataController.ts @@ -3,11 +3,11 @@ import path from "path"; import fs from "fs"; const rootDir = path.join(__dirname, "../../.."); -const updateConfigDataController: RequestHandler = (req) => { +const updateConfigDataController: RequestHandler = req => { const updateSettingsData = req.body; - - fs.writeFile(path.join(rootDir, "config.json"), updateSettingsData, function(err:any) { - if(err) { + + fs.writeFile(path.join(rootDir, "config.json"), updateSettingsData, function (err: any) { + if (err) { return console.log(err); } }); diff --git a/src/routes/custom.ts b/src/routes/custom.ts index 6c0a74165..476c59977 100644 --- a/src/routes/custom.ts +++ b/src/routes/custom.ts @@ -15,4 +15,4 @@ customRouter.post("/addItem", addItemController); customRouter.get("/config", getConfigDataController); customRouter.post("/config", updateConfigDataController); -export { customRouter }; \ No newline at end of file +export { customRouter }; diff --git a/static/webui/index.html b/static/webui/index.html index 6ab05badf..df711a5f5 100644 --- a/static/webui/index.html +++ b/static/webui/index.html @@ -96,8 +96,8 @@

- Note: Changes made here will only be reflected in-game when the game re-downloads your inventory. - Visiting the navigation should be the easiest way to trigger that. + Note: Changes made here will only be reflected in-game when the game re-downloads your + inventory. Visiting the navigation should be the easiest way to trigger that.

Add Items
@@ -144,8 +144,8 @@

- Note: Changes made here will only be reflected in-game when the game re-downloads your inventory. - Visiting the navigation should be the easiest way to trigger that. + Note: Changes made here will only be reflected in-game when the game re-downloads your + inventory. Visiting the navigation should be the easiest way to trigger that.

@@ -208,51 +208,72 @@
Change Settings
- - + +
- +
- +
- - + +
- +
- - + +
- - + +
- - + +
- - + +
- - + +
- +
- +
diff --git a/static/webui/script.js b/static/webui/script.js index b03de1d2f..37fa51779 100644 --- a/static/webui/script.js +++ b/static/webui/script.js @@ -621,38 +621,40 @@ $("#mod-to-acquire").on("input", () => { }); function fetchSettings() { - fetch('/custom/config') - .then((response) => response.json()) - .then((json) => Object.entries(json).forEach((entry) => { - const [key, value] = entry; - var x = document.getElementById(`${key}`); - if (x!=null) { - if (x.type == "checkbox") { - if (value === true) { - x.setAttribute("checked", "checked") - } - } else if (x.type == "number") { - x.setAttribute("value", `${value}`) + fetch("/custom/config") + .then(response => response.json()) + .then(json => + Object.entries(json).forEach(entry => { + const [key, value] = entry; + var x = document.getElementById(`${key}`); + if (x != null) { + if (x.type == "checkbox") { + if (value === true) { + x.setAttribute("checked", "checked"); + } + } else if (x.type == "number") { + x.setAttribute("value", `${value}`); + } } - } - })); + }) + ); } function doChangeSettings() { - fetch('/custom/config') - .then((response) => response.json()) - .then((json) => { - for(var i in json) { + fetch("/custom/config") + .then(response => response.json()) + .then(json => { + for (var i in json) { var x = document.getElementById(`${i}`); - if (x!=null) { + if (x != null) { if (x.type == "checkbox") { if (x.checked === true) { - json[i]=true; + json[i] = true; } else { - json[i]=false; + json[i] = false; } } else if (x.type == "number") { - json[i]=parseInt(x.value); + json[i] = parseInt(x.value); } } } @@ -660,6 +662,6 @@ function doChangeSettings() { url: "/custom/config", contentType: "text/plain", data: JSON.stringify(json, null, 2) - }) - }) -} \ No newline at end of file + }); + }); +}