feat: respect client-supplied buildLabel for login & worldState requests
This commit is contained in:
parent
397c57b348
commit
48e0d6069e
@ -20,6 +20,11 @@ const loginController: RequestHandler = async (request, response) => {
|
|||||||
const account = await Account.findOne({ email: loginRequest.email }); //{ _id: 0, __v: 0 }
|
const account = await Account.findOne({ email: loginRequest.email }); //{ _id: 0, __v: 0 }
|
||||||
const nonce = Math.round(Math.random() * Number.MAX_SAFE_INTEGER);
|
const nonce = Math.round(Math.random() * Number.MAX_SAFE_INTEGER);
|
||||||
|
|
||||||
|
const buildLabel: string =
|
||||||
|
typeof request.query.buildLabel == "string"
|
||||||
|
? request.query.buildLabel.split(" ").join("+")
|
||||||
|
: buildConfig.buildLabel;
|
||||||
|
|
||||||
if (!account && config.autoCreateAccount && loginRequest.ClientType != "webui") {
|
if (!account && config.autoCreateAccount && loginRequest.ClientType != "webui") {
|
||||||
try {
|
try {
|
||||||
const newAccount = await createAccount({
|
const newAccount = await createAccount({
|
||||||
@ -45,7 +50,7 @@ const loginController: RequestHandler = async (request, response) => {
|
|||||||
DTLS: DTLS,
|
DTLS: DTLS,
|
||||||
IRC: config.myIrcAddresses ?? [config.myAddress],
|
IRC: config.myIrcAddresses ?? [config.myAddress],
|
||||||
HUB: HUB,
|
HUB: HUB,
|
||||||
BuildLabel: buildConfig.buildLabel,
|
BuildLabel: buildLabel,
|
||||||
MatchmakingBuildId: buildConfig.matchmakingBuildId
|
MatchmakingBuildId: buildConfig.matchmakingBuildId
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -81,7 +86,7 @@ const loginController: RequestHandler = async (request, response) => {
|
|||||||
DTLS: DTLS,
|
DTLS: DTLS,
|
||||||
IRC: config.myIrcAddresses ?? [config.myAddress],
|
IRC: config.myIrcAddresses ?? [config.myAddress],
|
||||||
HUB: HUB,
|
HUB: HUB,
|
||||||
BuildLabel: buildConfig.buildLabel,
|
BuildLabel: buildLabel,
|
||||||
MatchmakingBuildId: buildConfig.matchmakingBuildId
|
MatchmakingBuildId: buildConfig.matchmakingBuildId
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -2,10 +2,13 @@ import { RequestHandler } from "express";
|
|||||||
import worldState from "@/static/fixed_responses/worldState.json";
|
import worldState from "@/static/fixed_responses/worldState.json";
|
||||||
import buildConfig from "@/static/data/buildConfig.json";
|
import buildConfig from "@/static/data/buildConfig.json";
|
||||||
|
|
||||||
const worldStateController: RequestHandler = (_req, res) => {
|
const worldStateController: RequestHandler = (req, res) => {
|
||||||
|
const buildLabel: string =
|
||||||
|
typeof req.query.buildLabel == "string" ? req.query.buildLabel.split(" ").join("+") : buildConfig.buildLabel;
|
||||||
|
|
||||||
res.json({
|
res.json({
|
||||||
...worldState,
|
...worldState,
|
||||||
BuildLabel: buildConfig.buildLabel,
|
BuildLabel: buildLabel,
|
||||||
Time: Math.round(Date.now() / 1000)
|
Time: Math.round(Date.now() / 1000)
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user