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

XFESpaceNinjaServer

A simple server for a small space ninja game

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

XFEstudio/XFESpaceNinjaServer

fix(webui): handle config having no worldState entry at all (#2427)

Reviewed-on: https://onlyg.it/OpenWF/SpaceNinjaServer/pulls/2427 Co-authored-by: Sainan <63328889+Sainan@users.noreply.github.com> Co-committed-by: Sainan <63328889+Sainan@users.noreply.github.com>

1545cdb8
Sainan <63328889+Sainan@users.noreply.github.com>
提交于

代码差异

3 个文件 +4 -2
Modified src/controllers/custom/configController.ts +2 -0
@@ -37,6 +37,8 @@ const configIdToIndexable = (id: string): [Record<string, boolean | string | num
37 37 let obj = config as unknown as Record<string, never>;
38 38 const arr = id.split(".");
39 39 while (arr.length > 1) {
40 // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
41 obj[arr[0]] ??= {} as never;
40 42 obj = obj[arr[0]];
41 43 arr.splice(0, 1);
42 44 }
Modified static/webui/index.html +1 -1
@@ -870,7 +870,7 @@
870 870 </div>
871 871 <div class="form-group mt-2">
872 872 <label class="form-label" for="worldState.galleonOfGhouls" data-loc="worldState_galleonOfGhouls"></label>
873 <select class="form-control" id="worldState.galleonOfGhouls" data-default="">
873 <select class="form-control" id="worldState.galleonOfGhouls" data-default="0">
874 874 <option value="0" data-loc="disabled"></option>
875 875 <option value="1" data-loc="worldState_we1"></option>
876 876 <option value="2" data-loc="worldState_we2"></option>
Modified static/webui/script.js +1 -1
@@ -2010,7 +2010,7 @@ single.getRoute("/webui/cheats").on("beforeload", function () {
2010 2010 if (elm.type == "checkbox") {
2011 2011 elm.checked = value;
2012 2012 } else if (elm.classList.contains("tags-input")) {
2013 elm.value = value.join(", ");
2013 elm.value = (value ?? []).join(", ");
2014 2014 elm.oninput();
2015 2015 } else {
2016 2016 elm.value = value ?? elm.getAttribute("data-default");