Update to fix raised concerns

Sans hot reload
This commit is contained in:
Vampire Kitten 2024-06-14 22:15:00 +02:00
parent 31469424f1
commit 17cd9e5fde
5 changed files with 70 additions and 67 deletions

View File

@ -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 };

View File

@ -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 };

View File

@ -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 };

View File

@ -94,62 +94,6 @@
<button class="btn btn-primary" type="submit">Login</button>
</form>
</div>
<div data-route="/webui/settings" data-title="Settings | OpenWF WebUI">
<div class="card mb-4">
<h5 class="card-header">Change Settings</h5>
<form class="card-body" onsubmit="doChangeSettings();return false;">
<div class="form-check">
<input class="form-check-input" type="checkbox" value="" id="skipStoryModeChoice" />
<label label class="form-check-label" for="skipStoryModeChoice">Skip Story Mode Choice?</label>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" value="" id="skipTutorial" />
<label label class="form-check-label" for="skipTutorial">Skip Tutorial?</label>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" value="" id="unlockAllScans" />
<label label class="form-check-label" for="unlockAllScans">Unlock All Scans?</label>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" value="" id="unlockAllMissions" />
<label label class="form-check-label" for="unlockAllMissions">Unlock All Missions?</label>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" value="" id="unlockAllQuests" />
<label label class="form-check-label" for="unlockAllQuests">Unlock All Quests?</label>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" value="" id="completeAllQuests" />
<label label class="form-check-label" for="completeAllQuests">Complete All Quests?</label>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" value="" id="infiniteResources" />
<label label class="form-check-label" for="infiniteResources">Infinite Credits and Platinum?</label>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" value="" id="unlockallShipFeatures" />
<label label class="form-check-label" for="unlockallShipFeatures">Unlock All Ship Features?</label>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" value="" id="unlockAllShipDecorations" />
<label label class="form-check-label" for="unlockAllShipDecorations">Unlock All Ship Decorations?</label>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" value="" id="unlockAllFlavourItems" />
<label label class="form-check-label" for="unlockAllFlavourItems">Unlock All Accessories?</label>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" value="" id="unlockAllSkins" />
<label label class="form-check-label" for="unlockAllSkins">Unlock All Skins?</label>
</div>
<div class="form-check">
<label label class="form-check-label" for="spoofMasteryRank">Spoofed Mastery Rank (-1 to disable)</label>
<input class="form-control" id="spoofMasteryRank" type="number" min="-1" value="" />
</div>
<button class="btn btn-primary" type="submit">Save Settings</button>
</form>
</div>
</div>
<div data-route="/webui/inventory" data-title="Inventory | OpenWF WebUI">
<p id="refresh-note" class="mb-4">
Note: Changes made here will only be reflected in-game when the game re-downloads your inventory.
@ -259,6 +203,62 @@
</div>
</div>
</div>
<div data-route="/webui/settings" data-title="Settings | OpenWF WebUI">
<div class="card mb-4">
<h5 class="card-header">Change Settings</h5>
<form class="card-body" onsubmit="doChangeSettings();return false;">
<div class="form-check">
<input class="form-check-input" type="checkbox" value="" id="skipStoryModeChoice" />
<label label class="form-check-label" for="skipStoryModeChoice">Skip Story Mode Choice?</label>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" value="" id="skipTutorial" />
<label label class="form-check-label" for="skipTutorial">Skip Tutorial?</label>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" value="" id="unlockAllScans" />
<label label class="form-check-label" for="unlockAllScans">Unlock All Scans?</label>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" value="" id="unlockAllMissions" />
<label label class="form-check-label" for="unlockAllMissions">Unlock All Missions?</label>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" value="" id="unlockAllQuests" />
<label label class="form-check-label" for="unlockAllQuests">Unlock All Quests?</label>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" value="" id="completeAllQuests" />
<label label class="form-check-label" for="completeAllQuests">Complete All Quests?</label>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" value="" id="infiniteResources" />
<label label class="form-check-label" for="infiniteResources">Infinite Credits and Platinum?</label>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" value="" id="unlockallShipFeatures" />
<label label class="form-check-label" for="unlockallShipFeatures">Unlock All Ship Features?</label>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" value="" id="unlockAllShipDecorations" />
<label label class="form-check-label" for="unlockAllShipDecorations">Unlock All Ship Decorations?</label>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" value="" id="unlockAllFlavourItems" />
<label label class="form-check-label" for="unlockAllFlavourItems">Unlock All Accessories?</label>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" value="" id="unlockAllSkins" />
<label label class="form-check-label" for="unlockAllSkins">Unlock All Skins?</label>
</div>
<div class="form-check">
<label label class="form-check-label" for="spoofMasteryRank">Spoofed Mastery Rank (-1 to disable)</label>
<input class="form-control" id="spoofMasteryRank" type="number" min="-1" value="" />
</div>
<button class="btn btn-primary" type="submit">Save Settings</button>
</form>
</div>
</div>
</div>
</div>
<datalist id="datalist-warframes"></datalist>

View File

@ -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;