From b298649e30c6d17a3381336eb43d524b147d284b Mon Sep 17 00:00:00 2001 From: memetrollsXD Date: Tue, 2 Aug 2022 02:19:54 +0200 Subject: [PATCH] BREAKING: Version checking --- src/commands/alias.json | 3 ++- src/http/routes/query_gateway.ts | 9 +++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/commands/alias.json b/src/commands/alias.json index 621a901..0957982 100644 --- a/src/commands/alias.json +++ b/src/commands/alias.json @@ -4,5 +4,6 @@ "t": "target", "acc": "account", "d": "debug", - "?": "help" + "?": "help", + "m": "maintenance" } \ No newline at end of file diff --git a/src/http/routes/query_gateway.ts b/src/http/routes/query_gateway.ts index 6a807ef..5318f7c 100644 --- a/src/http/routes/query_gateway.ts +++ b/src/http/routes/query_gateway.ts @@ -25,6 +25,15 @@ export default function handle(req: Request, res: Response) { dataObj.stopEndTime = Date.now() * 2; } + const url = new URL(`https://crepe.sr${req.originalUrl}`); + const query = new URLSearchParams(url.search); + const version = query.get("version"); + + if (version !== "OSGMWin0.70.0") { + dataObj.retcode = 2; + dataObj.msg = "Unknown StarRail version. Did you forget to update your client?\nSupport Discord: https://discord.gg/QYZxrcJkjH"; + } + let rsp; try { rsp = Gateserver.encode(dataObj).finish();