返回提交历史
Modified
src/controllers/custom/abilityOverrideController.ts
+3
-0
Modified
static/webui/script.js
+5
-1
XFEstudio/XFESpaceNinjaServer
fix(webui): more robust handling for AbilityOverride (#3665)
Closes #3661 Reviewed-on: https://onlyg.it/OpenWF/SpaceNinjaServer/pulls/3665 Co-authored-by: Sainan <63328889+Sainan@users.noreply.github.com> Co-committed-by: Sainan <63328889+Sainan@users.noreply.github.com>
1d7f5ddc
代码差异
2 个文件
+8
-1
@@ -11,6 +11,9 @@ export const abilityOverrideController: RequestHandler = async (req, res) => {
11
11
const inventory = await getInventory(accountId, request.category);
12
12
const item = inventory[request.category].id(request.oid);
13
13
if (item) {
14
while (item.Configs.length <= request.configIndex) {
15
item.Configs.push({});
16
}
14
17
if (request.action == "set") {
15
18
item.Configs[request.configIndex].AbilityOverride = request.AbilityOverride;
16
19
} else {
@@ -2029,7 +2029,7 @@ function translateInventoryDataToDom() {
2029
2029
abilityOverrideInput.value = options.find(
2030
2030
option =>
2031
2031
config.AbilityOverride.Ability == option.getAttribute("data-key")
2032
).value;
2032
)?.value;
2033
2033
}
2034
2034
abilityOverrideInputGroup.appendChild(abilityOverrideInput);
2035
2035
@@ -4981,6 +4981,10 @@ function handleAbilityOverride(event, configIndex) {
4981
4981
const urlParams = new URLSearchParams(window.location.search);
4982
4982
const action = event.submitter.value;
4983
4983
const Ability = getKey(document.getElementById(`abilityOverride-ability-config-${configIndex}`));
4984
if (action == "set" && !Ability) {
4985
$(`#abilityOverride-ability-config-${configIndex}`).addClass("is-invalid").focus();
4986
return;
4987
}
4984
4988
const Index = document.getElementById(`abilityOverride-ability-index-config-${configIndex}`).value;
4985
4989
revalidateAuthz().then(() => {
4986
4990
$.post({