XFE Git
XFE Studio Git
Git 首页 全局搜索
XFE 主站 文档 NuGet

SpaceNinjaServer

A simple server for a small space ninja game

公开
关注 0 Fork 1 Star 0
返回提交历史

XFEstudio/SpaceNinjaServer

fix: creating/deleting sessions in pre-Specters of the Rail builds (#2978)

This is only verified to work as far back as U15, I have not tried to test any builds older than that yet until they are added to the support list. Reviewed-on: https://onlyg.it/OpenWF/SpaceNinjaServer/pulls/2978 Reviewed-by: Sainan <63328889+sainan@users.noreply.github.com> Co-authored-by: VoltPrime <subsonicjackal@gmail.com> Co-committed-by: VoltPrime <subsonicjackal@gmail.com>

4d93dc80
VoltPrime <subsonicjackal@gmail.com>
提交于

代码差异

3 个文件 +14 -4
Modified src/controllers/api/deleteSessionController.ts +10 -2
@@ -1,9 +1,17 @@
1 1 import type { RequestHandler } from "express";
2 2 import { deleteSession } from "../../managers/sessionManager.ts";
3 import { getAccountForRequest } from "../../services/loginService.ts";
4 import { version_compare } from "../../helpers/inventoryHelpers.ts";
3 5
4 const deleteSessionController: RequestHandler = (_req, res) => {
6 const deleteSessionController: RequestHandler = async (_req, res) => {
7 const account = await getAccountForRequest(_req);
5 8 deleteSession(_req.query.sessionId as string);
6 res.sendStatus(200);
9 if (account.BuildLabel && version_compare(account.BuildLabel, "2016.07.08.16.56") < 0) {
10 // Pre-Specters of the Rail
11 res.send(_req.query.sessionId as string); // Unsure if this is correct, but the client is chill with it
12 } else {
13 res.sendStatus(200);
14 }
7 15 };
8 16
9 17 export { deleteSessionController };
Modified src/controllers/api/hostSessionController.ts +2 -2
@@ -13,8 +13,8 @@ const hostSessionController: RequestHandler = async (req, res) => {
13 13 const session = createNewSession(hostSessionRequest, account._id);
14 14 logger.debug(`New Session Created`, { session });
15 15
16 if (account.BuildLabel && version_compare(account.BuildLabel, "2015.03.21.08.17") < 0) {
17 // U15 or below
16 if (account.BuildLabel && version_compare(account.BuildLabel, "2016.07.08.16.56") < 0) {
17 // Pre-Specters of the Rail
18 18 res.send(session.sessionId.toString());
19 19 } else {
20 20 res.json({ sessionId: toOid2(session.sessionId, account.BuildLabel), rewardSeed: 99999999 });
Modified src/routes/api.ts +2 -0
@@ -10,6 +10,7 @@ import { addPendingFriendController } from "../controllers/api/addPendingFriendC
10 10 import { addToAllianceController } from "../controllers/api/addToAllianceController.ts";
11 11 import { addToGuildController } from "../controllers/api/addToGuildController.ts";
12 12 import { adoptPetController } from "../controllers/api/adoptPetController.ts";
13 import { aggregateSessionsController } from "../controllers/dynamic/aggregateSessionsController.ts";
13 14 import { apartmentController } from "../controllers/api/apartmentController.ts";
14 15 import { arcaneCommonController } from "../controllers/api/arcaneCommonController.ts";
15 16 import { archonFusionController } from "../controllers/api/archonFusionController.ts";
@@ -248,6 +249,7 @@ apiRouter.post("/addPendingFriend.php", addPendingFriendController);
248 249 apiRouter.post("/addToAlliance.php", addToAllianceController);
249 250 apiRouter.post("/addToGuild.php", addToGuildController);
250 251 apiRouter.post("/adoptPet.php", adoptPetController);
252 apiRouter.post("/aggregateSessions.php", aggregateSessionsController); // Pre-Specters of the Rail builds
251 253 apiRouter.post("/arcaneCommon.php", arcaneCommonController);
252 254 apiRouter.post("/archonFusion.php", archonFusionController);
253 255 apiRouter.post("/artifacts.php", artifactsController);