From 17cd9e5fde6acda520de32cbf3762c9e7c1ab725 Mon Sep 17 00:00:00 2001 From: Vampire Kitten Date: Fri, 14 Jun 2024 22:15:00 +0200 Subject: [PATCH] Update to fix raised concerns Sans hot reload --- ...nfigData.ts => getConfigDataController.ts} | 4 +- ...gData.ts => updateConfigDataController.ts} | 4 +- src/routes/custom.ts | 8 +- static/webui/index.html | 112 +++++++++--------- static/webui/script.js | 9 +- 5 files changed, 70 insertions(+), 67 deletions(-) rename src/controllers/custom/{getConfigData.ts => getConfigDataController.ts} (52%) rename src/controllers/custom/{updateConfigData.ts => updateConfigDataController.ts} (77%) diff --git a/src/controllers/custom/getConfigData.ts b/src/controllers/custom/getConfigDataController.ts similarity index 52% rename from src/controllers/custom/getConfigData.ts rename to src/controllers/custom/getConfigDataController.ts index 632971e4..8d946384 100644 --- a/src/controllers/custom/getConfigData.ts +++ b/src/controllers/custom/getConfigDataController.ts @@ -1,8 +1,8 @@ import { RequestHandler } from "express"; import configFile from "@/config.json"; -const getConfigData: RequestHandler = (_req, res) => { +const getConfigDataController: RequestHandler = (_req, res) => { res.json(configFile); }; -export { getConfigData }; +export { getConfigDataController }; diff --git a/src/controllers/custom/updateConfigData.ts b/src/controllers/custom/updateConfigDataController.ts similarity index 77% rename from src/controllers/custom/updateConfigData.ts rename to src/controllers/custom/updateConfigDataController.ts index 8c650f76..38d6ca35 100644 --- a/src/controllers/custom/updateConfigData.ts +++ b/src/controllers/custom/updateConfigDataController.ts @@ -3,7 +3,7 @@ import path from "path"; import fs from "fs"; const rootDir = path.join(__dirname, "../../.."); -const updateConfigData: RequestHandler = (req) => { +const updateConfigDataController: RequestHandler = (req) => { const updateSettingsData = req.body; fs.writeFile(path.join(rootDir, "config.json"), updateSettingsData, function(err:any) { @@ -13,4 +13,4 @@ const updateConfigData: RequestHandler = (req) => { }); }; -export { updateConfigData }; +export { updateConfigDataController }; diff --git a/src/routes/custom.ts b/src/routes/custom.ts index 4b01f1ca..6c0a7416 100644 --- a/src/routes/custom.ts +++ b/src/routes/custom.ts @@ -2,8 +2,8 @@ import express from "express"; import { getItemListsController } from "@/src/controllers/custom/getItemListsController"; import { createAccountController } from "@/src/controllers/custom/createAccountController"; import { addItemController } from "@/src/controllers/custom/addItemController"; -import { getConfigData } from "@/src/controllers/custom/getConfigData"; -import { updateConfigData } from "@/src/controllers/custom/updateConfigData"; +import { getConfigDataController } from "@/src/controllers/custom/getConfigDataController"; +import { updateConfigDataController } from "@/src/controllers/custom/updateConfigDataController"; const customRouter = express.Router(); @@ -12,7 +12,7 @@ customRouter.get("/getItemLists", getItemListsController); customRouter.post("/createAccount", createAccountController); customRouter.post("/addItem", addItemController); -customRouter.get("/config", getConfigData); -customRouter.post("/config", updateConfigData); +customRouter.get("/config", getConfigDataController); +customRouter.post("/config", updateConfigDataController); export { customRouter }; \ No newline at end of file diff --git a/static/webui/index.html b/static/webui/index.html index 61194238..109a482d 100644 --- a/static/webui/index.html +++ b/static/webui/index.html @@ -94,62 +94,6 @@ -
-
-
Change Settings
-
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
- -
-
-

Note: Changes made here will only be reflected in-game when the game re-downloads your inventory. @@ -259,6 +203,62 @@

+
+
+
Change Settings
+
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+ +
+
+
diff --git a/static/webui/script.js b/static/webui/script.js index bcbf3a09..b03de1d2 100644 --- a/static/webui/script.js +++ b/static/webui/script.js @@ -15,6 +15,7 @@ function loginFromLocalStorage() { window.accountId = data.id; window.authz = "accountId=" + data.id + "&nonce=" + data.Nonce; updateInventory(); + fetchSettings(); }, () => { logout(); @@ -95,15 +96,17 @@ window.itemListPromise = new Promise(resolve => { "/Lotus/Weapons/Tenno/Rifle/LotusRifle": { name: "Rifle" }, "/Lotus/Weapons/Tenno/Shotgun/LotusShotgun": { name: "Shotgun" }, // Missing in data sources - "/Lotus/Upgrades/CosmeticEnhancers/Peculiars/CyoteMod": { name: "Traumatic Peculiar" }, - "/Lotus/Weapons/Tenno/Grimoire/TnGrimoire": { name: "Grimoire" } + "/Lotus/Upgrades/CosmeticEnhancers/Peculiars/CyoteMod": { name: "Traumatic Peculiar" } }; for (const [type, items] of Object.entries(data)) { if (type != "badItems") { items.forEach(item => { if (item.uniqueName in data.badItems) { item.name += " (Imposter)"; - } else if (item.uniqueName.substr(0, 18) != "/Lotus/Types/Game/") { + } else if ( + item.uniqueName.substr(0, 18) != "/Lotus/Types/Game/" && + item.uniqueName.substr(0, 18) != "/Lotus/StoreItems/" + ) { const option = document.createElement("option"); option.setAttribute("data-key", item.uniqueName); option.value = item.name;