XFE Git
XFE Studio Git
Git 首页 全局搜索
XFE 主站 文档 NuGet

SpaceNinjaServer

A simple server for a small space ninja game

公开
关注 0 Fork 1 Star 0
返回提交历史

XFEstudio/SpaceNinjaServer

Apply prettier changes

ba8a3afc
OrdisPrime <OrdisPrime@users.noreply.github.com>
提交于

代码差异

4 个文件 +76 -53
Modified src/controllers/custom/updateConfigDataController.ts +4 -4
@@ -3,11 +3,11 @@ import path from "path";
3 3 import fs from "fs";
4 4 const rootDir = path.join(__dirname, "../../..");
5 5
6 const updateConfigDataController: RequestHandler = (req) => {
6 const updateConfigDataController: RequestHandler = req => {
7 7 const updateSettingsData = req.body;
8
9 fs.writeFile(path.join(rootDir, "config.json"), updateSettingsData, function(err:any) {
10 if(err) {
8
9 fs.writeFile(path.join(rootDir, "config.json"), updateSettingsData, function (err: any) {
10 if (err) {
11 11 return console.log(err);
12 12 }
13 13 });
Modified src/routes/custom.ts +1 -1
@@ -15,4 +15,4 @@ customRouter.post("/addItem", addItemController);
15 15 customRouter.get("/config", getConfigDataController);
16 16 customRouter.post("/config", updateConfigDataController);
17 17
18 export { customRouter };
18 export { customRouter };
Modified static/webui/index.html +44 -23
@@ -96,8 +96,8 @@
96 96 </div>
97 97 <div data-route="/webui/inventory" data-title="Inventory | OpenWF WebUI">
98 98 <p id="refresh-note" class="mb-4">
99 Note: Changes made here will only be reflected in-game when the game re-downloads your inventory.
100 Visiting the navigation should be the easiest way to trigger that.
99 Note: Changes made here will only be reflected in-game when the game re-downloads your
100 inventory. Visiting the navigation should be the easiest way to trigger that.
101 101 </p>
102 102 <div class="card mb-4">
103 103 <h5 class="card-header">Add Items</h5>
@@ -144,8 +144,8 @@
144 144 </div>
145 145 <div data-route="/webui/mods" data-title="Mods | OpenWF WebUI">
146 146 <p id="refresh-note" class="mb-4">
147 Note: Changes made here will only be reflected in-game when the game re-downloads your inventory.
148 Visiting the navigation should be the easiest way to trigger that.
147 Note: Changes made here will only be reflected in-game when the game re-downloads your
148 inventory. Visiting the navigation should be the easiest way to trigger that.
149 149 </p>
150 150 <div class="row">
151 151 <div class="col-xxl-6">
@@ -208,51 +208,72 @@
208 208 <h5 class="card-header">Change Settings</h5>
209 209 <form class="card-body" onsubmit="doChangeSettings();return false;">
210 210 <div class="form-check">
211 <input class="form-check-input" type="checkbox" value="" id="skipStoryModeChoice" />
212 <label label class="form-check-label" for="skipStoryModeChoice">Skip Story Mode Choice?</label>
211 <input class="form-check-input" type="checkbox" value="" id="skipStoryModeChoice" />
212 <label label class="form-check-label" for="skipStoryModeChoice"
213 >Skip Story Mode Choice?</label
214 >
213 215 </div>
214 216 <div class="form-check">
215 <input class="form-check-input" type="checkbox" value="" id="skipTutorial" />
217 <input class="form-check-input" type="checkbox" value="" id="skipTutorial" />
216 218 <label label class="form-check-label" for="skipTutorial">Skip Tutorial?</label>
217 219 </div>
218 220 <div class="form-check">
219 <input class="form-check-input" type="checkbox" value="" id="unlockAllScans" />
221 <input class="form-check-input" type="checkbox" value="" id="unlockAllScans" />
220 222 <label label class="form-check-label" for="unlockAllScans">Unlock All Scans?</label>
221 223 </div>
222 224 <div class="form-check">
223 <input class="form-check-input" type="checkbox" value="" id="unlockAllMissions" />
224 <label label class="form-check-label" for="unlockAllMissions">Unlock All Missions?</label>
225 <input class="form-check-input" type="checkbox" value="" id="unlockAllMissions" />
226 <label label class="form-check-label" for="unlockAllMissions"
227 >Unlock All Missions?</label
228 >
225 229 </div>
226 230 <div class="form-check">
227 <input class="form-check-input" type="checkbox" value="" id="unlockAllQuests" />
231 <input class="form-check-input" type="checkbox" value="" id="unlockAllQuests" />
228 232 <label label class="form-check-label" for="unlockAllQuests">Unlock All Quests?</label>
229 233 </div>
230 234 <div class="form-check">
231 <input class="form-check-input" type="checkbox" value="" id="completeAllQuests" />
232 <label label class="form-check-label" for="completeAllQuests">Complete All Quests?</label>
235 <input class="form-check-input" type="checkbox" value="" id="completeAllQuests" />
236 <label label class="form-check-label" for="completeAllQuests"
237 >Complete All Quests?</label
238 >
233 239 </div>
234 240 <div class="form-check">
235 <input class="form-check-input" type="checkbox" value="" id="infiniteResources" />
236 <label label class="form-check-label" for="infiniteResources">Infinite Credits and Platinum?</label>
241 <input class="form-check-input" type="checkbox" value="" id="infiniteResources" />
242 <label label class="form-check-label" for="infiniteResources"
243 >Infinite Credits and Platinum?</label
244 >
237 245 </div>
238 246 <div class="form-check">
239 <input class="form-check-input" type="checkbox" value="" id="unlockallShipFeatures" />
240 <label label class="form-check-label" for="unlockallShipFeatures">Unlock All Ship Features?</label>
247 <input class="form-check-input" type="checkbox" value="" id="unlockallShipFeatures" />
248 <label label class="form-check-label" for="unlockallShipFeatures"
249 >Unlock All Ship Features?</label
250 >
241 251 </div>
242 252 <div class="form-check">
243 <input class="form-check-input" type="checkbox" value="" id="unlockAllShipDecorations" />
244 <label label class="form-check-label" for="unlockAllShipDecorations">Unlock All Ship Decorations?</label>
253 <input
254 class="form-check-input"
255 type="checkbox"
256 value=""
257 id="unlockAllShipDecorations"
258 />
259 <label label class="form-check-label" for="unlockAllShipDecorations"
260 >Unlock All Ship Decorations?</label
261 >
245 262 </div>
246 263 <div class="form-check">
247 <input class="form-check-input" type="checkbox" value="" id="unlockAllFlavourItems" />
248 <label label class="form-check-label" for="unlockAllFlavourItems">Unlock All Accessories?</label>
264 <input class="form-check-input" type="checkbox" value="" id="unlockAllFlavourItems" />
265 <label label class="form-check-label" for="unlockAllFlavourItems"
266 >Unlock All Accessories?</label
267 >
249 268 </div>
250 269 <div class="form-check">
251 <input class="form-check-input" type="checkbox" value="" id="unlockAllSkins" />
270 <input class="form-check-input" type="checkbox" value="" id="unlockAllSkins" />
252 271 <label label class="form-check-label" for="unlockAllSkins">Unlock All Skins?</label>
253 272 </div>
254 273 <div class="form-check">
255 <label label class="form-check-label" for="spoofMasteryRank">Spoofed Mastery Rank (-1 to disable)</label>
274 <label label class="form-check-label" for="spoofMasteryRank"
275 >Spoofed Mastery Rank (-1 to disable)</label
276 >
256 277 <input class="form-control" id="spoofMasteryRank" type="number" min="-1" value="" />
257 278 </div>
258 279 <button class="btn btn-primary" type="submit">Save Settings</button>
Modified static/webui/script.js +27 -25
@@ -621,38 +621,40 @@ $("#mod-to-acquire").on("input", () => {
621 621 });
622 622
623 623 function fetchSettings() {
624 fetch('/custom/config')
625 .then((response) => response.json())
626 .then((json) => Object.entries(json).forEach((entry) => {
627 const [key, value] = entry;
628 var x = document.getElementById(`${key}`);
629 if (x!=null) {
630 if (x.type == "checkbox") {
631 if (value === true) {
632 x.setAttribute("checked", "checked")
633 }
634 } else if (x.type == "number") {
635 x.setAttribute("value", `${value}`)
624 fetch("/custom/config")
625 .then(response => response.json())
626 .then(json =>
627 Object.entries(json).forEach(entry => {
628 const [key, value] = entry;
629 var x = document.getElementById(`${key}`);
630 if (x != null) {
631 if (x.type == "checkbox") {
632 if (value === true) {
633 x.setAttribute("checked", "checked");
634 }
635 } else if (x.type == "number") {
636 x.setAttribute("value", `${value}`);
637 }
636 638 }
637 }
638 }));
639 })
640 );
639 641 }
640 642
641 643 function doChangeSettings() {
642 fetch('/custom/config')
643 .then((response) => response.json())
644 .then((json) => {
645 for(var i in json) {
644 fetch("/custom/config")
645 .then(response => response.json())
646 .then(json => {
647 for (var i in json) {
646 648 var x = document.getElementById(`${i}`);
647 if (x!=null) {
649 if (x != null) {
648 650 if (x.type == "checkbox") {
649 651 if (x.checked === true) {
650 json[i]=true;
652 json[i] = true;
651 653 } else {
652 json[i]=false;
654 json[i] = false;
653 655 }
654 656 } else if (x.type == "number") {
655 json[i]=parseInt(x.value);
657 json[i] = parseInt(x.value);
656 658 }
657 659 }
658 660 }
@@ -660,6 +662,6 @@ function doChangeSettings() {
660 662 url: "/custom/config",
661 663 contentType: "text/plain",
662 664 data: JSON.stringify(json, null, 2)
663 })
664 })
665 }
665 });
666 });
667 }