返回提交历史
Modified
src/controllers/dynamic/worldStateController.ts
+6
-7
XFEstudio/XFESpaceNinjaServer
chore: improve worldState buildLabel detection for manual requests (#4185)
A game client would provide either buildLabel (via client patch) or accountId-nonce pair for very early versions, so in the absence of those, assume latest. Reviewed-on: https://onlyg.it/OpenWF/SpaceNinjaServer/pulls/4185 Co-authored-by: Sainan <63328889+Sainan@users.noreply.github.com> Co-committed-by: Sainan <63328889+Sainan@users.noreply.github.com>
7daab3e2
代码差异
1 个文件
+6
-7
@@ -5,19 +5,18 @@ import {
5
5
populateFeaturedGuilds,
6
6
populateFissures
7
7
} from "../../services/worldStateService.ts";
8
import {
9
getAccountForRequest,
10
getBuildLabel,
11
getBuildLabelForUnauthenticatedRequest
12
} from "../../services/loginService.ts";
8
import { getAccountForRequest, getBuildLabel } from "../../services/loginService.ts";
9
import { BL_LATEST } from "../../constants/gameVersions.ts";
13
10
14
11
export const worldStateController: RequestHandler = async (req, res) => {
15
12
let buildLabel: string;
16
if (req.query.accountId && !req.query.buildLabel) {
13
if (typeof req.query.buildLabel == "string") {
14
buildLabel = req.query.buildLabel.replaceAll(" ", "+");
15
} else if (req.query.accountId) {
17
16
const account = await getAccountForRequest(req);
18
17
buildLabel = getBuildLabel(req, account);
19
18
} else {
20
buildLabel = getBuildLabelForUnauthenticatedRequest(req);
19
buildLabel = BL_LATEST;
21
20
}
22
21
23
22
const worldState = getWorldState(buildLabel);