forked from OpenWF/SpaceNinjaServer
		
	Apply prettier changes
This commit is contained in:
		
							parent
							
								
									1c6412a6a4
								
							
						
					
					
						commit
						ba8a3afce5
					
				@ -3,7 +3,7 @@ import path from "path";
 | 
				
			|||||||
import fs from "fs";
 | 
					import fs from "fs";
 | 
				
			||||||
const rootDir = path.join(__dirname, "../../..");
 | 
					const rootDir = path.join(__dirname, "../../..");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const updateConfigDataController: RequestHandler = (req) => {
 | 
					const updateConfigDataController: RequestHandler = req => {
 | 
				
			||||||
    const updateSettingsData = req.body;
 | 
					    const updateSettingsData = req.body;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    fs.writeFile(path.join(rootDir, "config.json"), updateSettingsData, function (err: any) {
 | 
					    fs.writeFile(path.join(rootDir, "config.json"), updateSettingsData, function (err: any) {
 | 
				
			||||||
 | 
				
			|||||||
@ -96,8 +96,8 @@
 | 
				
			|||||||
                </div>
 | 
					                </div>
 | 
				
			||||||
                <div data-route="/webui/inventory" data-title="Inventory | OpenWF WebUI">
 | 
					                <div data-route="/webui/inventory" data-title="Inventory | OpenWF WebUI">
 | 
				
			||||||
                    <p id="refresh-note" class="mb-4">
 | 
					                    <p id="refresh-note" class="mb-4">
 | 
				
			||||||
                        Note: Changes made here will only be reflected in-game when the game re-downloads your inventory.
 | 
					                        Note: Changes made here will only be reflected in-game when the game re-downloads your
 | 
				
			||||||
                        Visiting the navigation should be the easiest way to trigger that.
 | 
					                        inventory. Visiting the navigation should be the easiest way to trigger that.
 | 
				
			||||||
                    </p>
 | 
					                    </p>
 | 
				
			||||||
                    <div class="card mb-4">
 | 
					                    <div class="card mb-4">
 | 
				
			||||||
                        <h5 class="card-header">Add Items</h5>
 | 
					                        <h5 class="card-header">Add Items</h5>
 | 
				
			||||||
@ -144,8 +144,8 @@
 | 
				
			|||||||
                </div>
 | 
					                </div>
 | 
				
			||||||
                <div data-route="/webui/mods" data-title="Mods | OpenWF WebUI">
 | 
					                <div data-route="/webui/mods" data-title="Mods | OpenWF WebUI">
 | 
				
			||||||
                    <p id="refresh-note" class="mb-4">
 | 
					                    <p id="refresh-note" class="mb-4">
 | 
				
			||||||
                        Note: Changes made here will only be reflected in-game when the game re-downloads your inventory.
 | 
					                        Note: Changes made here will only be reflected in-game when the game re-downloads your
 | 
				
			||||||
                        Visiting the navigation should be the easiest way to trigger that.
 | 
					                        inventory. Visiting the navigation should be the easiest way to trigger that.
 | 
				
			||||||
                    </p>
 | 
					                    </p>
 | 
				
			||||||
                    <div class="row">
 | 
					                    <div class="row">
 | 
				
			||||||
                        <div class="col-xxl-6">
 | 
					                        <div class="col-xxl-6">
 | 
				
			||||||
@ -209,7 +209,9 @@
 | 
				
			|||||||
                        <form class="card-body" onsubmit="doChangeSettings();return false;">
 | 
					                        <form class="card-body" onsubmit="doChangeSettings();return false;">
 | 
				
			||||||
                            <div class="form-check">
 | 
					                            <div class="form-check">
 | 
				
			||||||
                                <input class="form-check-input" type="checkbox" value="" id="skipStoryModeChoice" />
 | 
					                                <input class="form-check-input" type="checkbox" value="" id="skipStoryModeChoice" />
 | 
				
			||||||
                                <label label class="form-check-label" for="skipStoryModeChoice">Skip Story Mode Choice?</label>
 | 
					                                <label label class="form-check-label" for="skipStoryModeChoice"
 | 
				
			||||||
 | 
					                                    >Skip Story Mode Choice?</label
 | 
				
			||||||
 | 
					                                >
 | 
				
			||||||
                            </div>
 | 
					                            </div>
 | 
				
			||||||
                            <div class="form-check">
 | 
					                            <div class="form-check">
 | 
				
			||||||
                                <input class="form-check-input" type="checkbox" value="" id="skipTutorial" />
 | 
					                                <input class="form-check-input" type="checkbox" value="" id="skipTutorial" />
 | 
				
			||||||
@ -221,7 +223,9 @@
 | 
				
			|||||||
                            </div>
 | 
					                            </div>
 | 
				
			||||||
                            <div class="form-check">
 | 
					                            <div class="form-check">
 | 
				
			||||||
                                <input class="form-check-input" type="checkbox" value="" id="unlockAllMissions" />
 | 
					                                <input class="form-check-input" type="checkbox" value="" id="unlockAllMissions" />
 | 
				
			||||||
                                <label label class="form-check-label" for="unlockAllMissions">Unlock All Missions?</label>
 | 
					                                <label label class="form-check-label" for="unlockAllMissions"
 | 
				
			||||||
 | 
					                                    >Unlock All Missions?</label
 | 
				
			||||||
 | 
					                                >
 | 
				
			||||||
                            </div>
 | 
					                            </div>
 | 
				
			||||||
                            <div class="form-check">
 | 
					                            <div class="form-check">
 | 
				
			||||||
                                <input class="form-check-input" type="checkbox" value="" id="unlockAllQuests" />
 | 
					                                <input class="form-check-input" type="checkbox" value="" id="unlockAllQuests" />
 | 
				
			||||||
@ -229,30 +233,47 @@
 | 
				
			|||||||
                            </div>
 | 
					                            </div>
 | 
				
			||||||
                            <div class="form-check">
 | 
					                            <div class="form-check">
 | 
				
			||||||
                                <input class="form-check-input" type="checkbox" value="" id="completeAllQuests" />
 | 
					                                <input class="form-check-input" type="checkbox" value="" id="completeAllQuests" />
 | 
				
			||||||
                                <label label class="form-check-label" for="completeAllQuests">Complete All Quests?</label>
 | 
					                                <label label class="form-check-label" for="completeAllQuests"
 | 
				
			||||||
 | 
					                                    >Complete All Quests?</label
 | 
				
			||||||
 | 
					                                >
 | 
				
			||||||
                            </div>
 | 
					                            </div>
 | 
				
			||||||
                            <div class="form-check">
 | 
					                            <div class="form-check">
 | 
				
			||||||
                                <input class="form-check-input" type="checkbox" value="" id="infiniteResources" />
 | 
					                                <input class="form-check-input" type="checkbox" value="" id="infiniteResources" />
 | 
				
			||||||
                                <label label class="form-check-label" for="infiniteResources">Infinite Credits and Platinum?</label>
 | 
					                                <label label class="form-check-label" for="infiniteResources"
 | 
				
			||||||
 | 
					                                    >Infinite Credits and Platinum?</label
 | 
				
			||||||
 | 
					                                >
 | 
				
			||||||
                            </div>
 | 
					                            </div>
 | 
				
			||||||
                            <div class="form-check">
 | 
					                            <div class="form-check">
 | 
				
			||||||
                                <input class="form-check-input" type="checkbox" value="" id="unlockallShipFeatures" />
 | 
					                                <input class="form-check-input" type="checkbox" value="" id="unlockallShipFeatures" />
 | 
				
			||||||
                                <label label class="form-check-label" for="unlockallShipFeatures">Unlock All Ship Features?</label>
 | 
					                                <label label class="form-check-label" for="unlockallShipFeatures"
 | 
				
			||||||
 | 
					                                    >Unlock All Ship Features?</label
 | 
				
			||||||
 | 
					                                >
 | 
				
			||||||
                            </div>
 | 
					                            </div>
 | 
				
			||||||
                            <div class="form-check">
 | 
					                            <div class="form-check">
 | 
				
			||||||
                                <input class="form-check-input" type="checkbox" value="" id="unlockAllShipDecorations"  />
 | 
					                                <input
 | 
				
			||||||
                                <label label class="form-check-label" for="unlockAllShipDecorations">Unlock All Ship Decorations?</label>
 | 
					                                    class="form-check-input"
 | 
				
			||||||
 | 
					                                    type="checkbox"
 | 
				
			||||||
 | 
					                                    value=""
 | 
				
			||||||
 | 
					                                    id="unlockAllShipDecorations"
 | 
				
			||||||
 | 
					                                />
 | 
				
			||||||
 | 
					                                <label label class="form-check-label" for="unlockAllShipDecorations"
 | 
				
			||||||
 | 
					                                    >Unlock All Ship Decorations?</label
 | 
				
			||||||
 | 
					                                >
 | 
				
			||||||
                            </div>
 | 
					                            </div>
 | 
				
			||||||
                            <div class="form-check">
 | 
					                            <div class="form-check">
 | 
				
			||||||
                                <input class="form-check-input" type="checkbox" value="" id="unlockAllFlavourItems" />
 | 
					                                <input class="form-check-input" type="checkbox" value="" id="unlockAllFlavourItems" />
 | 
				
			||||||
                                <label label class="form-check-label" for="unlockAllFlavourItems">Unlock All Accessories?</label>
 | 
					                                <label label class="form-check-label" for="unlockAllFlavourItems"
 | 
				
			||||||
 | 
					                                    >Unlock All Accessories?</label
 | 
				
			||||||
 | 
					                                >
 | 
				
			||||||
                            </div>
 | 
					                            </div>
 | 
				
			||||||
                            <div class="form-check">
 | 
					                            <div class="form-check">
 | 
				
			||||||
                                <input class="form-check-input" type="checkbox" value="" id="unlockAllSkins" />
 | 
					                                <input class="form-check-input" type="checkbox" value="" id="unlockAllSkins" />
 | 
				
			||||||
                                <label label class="form-check-label" for="unlockAllSkins">Unlock All Skins?</label>
 | 
					                                <label label class="form-check-label" for="unlockAllSkins">Unlock All Skins?</label>
 | 
				
			||||||
                            </div>
 | 
					                            </div>
 | 
				
			||||||
                            <div class="form-check">
 | 
					                            <div class="form-check">
 | 
				
			||||||
                                <label label class="form-check-label" for="spoofMasteryRank">Spoofed Mastery Rank (-1 to disable)</label>
 | 
					                                <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="" />
 | 
					                                <input class="form-control" id="spoofMasteryRank" type="number" min="-1" value="" />
 | 
				
			||||||
                            </div>
 | 
					                            </div>
 | 
				
			||||||
                            <button class="btn btn-primary" type="submit">Save Settings</button>
 | 
					                            <button class="btn btn-primary" type="submit">Save Settings</button>
 | 
				
			||||||
 | 
				
			|||||||
@ -621,27 +621,29 @@ $("#mod-to-acquire").on("input", () => {
 | 
				
			|||||||
});
 | 
					});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function fetchSettings() {
 | 
					function fetchSettings() {
 | 
				
			||||||
    fetch('/custom/config')
 | 
					    fetch("/custom/config")
 | 
				
			||||||
        .then((response) => response.json())
 | 
					        .then(response => response.json())
 | 
				
			||||||
        .then((json) => Object.entries(json).forEach((entry) => {
 | 
					        .then(json =>
 | 
				
			||||||
 | 
					            Object.entries(json).forEach(entry => {
 | 
				
			||||||
                const [key, value] = entry;
 | 
					                const [key, value] = entry;
 | 
				
			||||||
                var x = document.getElementById(`${key}`);
 | 
					                var x = document.getElementById(`${key}`);
 | 
				
			||||||
                if (x != null) {
 | 
					                if (x != null) {
 | 
				
			||||||
                    if (x.type == "checkbox") {
 | 
					                    if (x.type == "checkbox") {
 | 
				
			||||||
                        if (value === true) {
 | 
					                        if (value === true) {
 | 
				
			||||||
                        x.setAttribute("checked", "checked")
 | 
					                            x.setAttribute("checked", "checked");
 | 
				
			||||||
                        }
 | 
					                        }
 | 
				
			||||||
                    } else if (x.type == "number") {
 | 
					                    } else if (x.type == "number") {
 | 
				
			||||||
                    x.setAttribute("value", `${value}`)
 | 
					                        x.setAttribute("value", `${value}`);
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
        }));
 | 
					            })
 | 
				
			||||||
 | 
					        );
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function doChangeSettings() {
 | 
					function doChangeSettings() {
 | 
				
			||||||
    fetch('/custom/config')
 | 
					    fetch("/custom/config")
 | 
				
			||||||
        .then((response) => response.json())
 | 
					        .then(response => response.json())
 | 
				
			||||||
        .then((json) => {
 | 
					        .then(json => {
 | 
				
			||||||
            for (var i in json) {
 | 
					            for (var i in json) {
 | 
				
			||||||
                var x = document.getElementById(`${i}`);
 | 
					                var x = document.getElementById(`${i}`);
 | 
				
			||||||
                if (x != null) {
 | 
					                if (x != null) {
 | 
				
			||||||
@ -660,6 +662,6 @@ function doChangeSettings() {
 | 
				
			|||||||
                url: "/custom/config",
 | 
					                url: "/custom/config",
 | 
				
			||||||
                contentType: "text/plain",
 | 
					                contentType: "text/plain",
 | 
				
			||||||
                data: JSON.stringify(json, null, 2)
 | 
					                data: JSON.stringify(json, null, 2)
 | 
				
			||||||
                })
 | 
					            });
 | 
				
			||||||
            })
 | 
					        });
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user