返回提交历史
Modified
src/services/configWatcherService.ts
+16
-0
Modified
static/webui/index.html
+1
-1
XFEstudio/XFESpaceNinjaServer
chore: range check for community synthesis target & progress (#4080)
- Allows only 0-10 range (target number) in WebUI, as 11 and higher result in no target (there's only 10 targets). - Config: Fallback to 0 if target number is lower than 0 or higher than 10. - Config: Fallback to 0 if progress number is lower than 0, or fallback to 100 if progress number is higher than 100. --------- Co-authored-by: Sainan <63328889+Sainan@users.noreply.github.com> Reviewed-on: https://onlyg.it/OpenWF/SpaceNinjaServer/pulls/4080 Co-authored-by: Animan8000 <187183497+Veniman8000@users.noreply.github.com> Co-committed-by: Animan8000 <187183497+Veniman8000@users.noreply.github.com>
4e75d44f
代码差异
2 个文件
+17
-1
@@ -182,6 +182,22 @@ export const validateConfig = (): void => {
182
182
delete config.worldState.lunarNewYear;
183
183
modified = true;
184
184
}
185
if (
186
config.worldState?.communitySynthesisTarget &&
187
(config.worldState.communitySynthesisTarget < 0 || config.worldState.communitySynthesisTarget > 10)
188
) {
189
config.worldState.communitySynthesisTarget = 0;
190
modified = true;
191
}
192
if (config.worldState?.communitySynthesisProgress) {
193
if (config.worldState.communitySynthesisProgress < 0) {
194
config.worldState.communitySynthesisProgress = 0;
195
modified = true;
196
} else if (config.worldState.communitySynthesisProgress > 100) {
197
config.worldState.communitySynthesisProgress = 100;
198
modified = true;
199
}
200
}
185
201
if (modified) {
186
202
logger.info(`Updating config file to fix some issues with it.`);
187
203
void saveConfig();
@@ -1700,7 +1700,7 @@
1700
1700
<form class="form-group mt-2" onsubmit="doSaveConfigInt('worldState.communitySynthesisTarget'); return false;">
1701
1701
<label class="form-label" for="worldState.communitySynthesisTarget" data-loc="worldState_communitySynthesisTarget"></label>
1702
1702
<div class="input-group">
1703
<input id="worldState.communitySynthesisTarget" class="form-control" type="number" data-default="0" />
1703
<input id="worldState.communitySynthesisTarget" class="form-control" type="number" min="0" max="10" data-default="0" />
1704
1704
<button class="btn btn-secondary" type="submit" data-loc="cheats_save"></button>
1705
1705
</div>
1706
1706
</form>