Fix creating/deleting sessions in pre-Specters of the Rail builds
This commit is contained in:
		
							parent
							
								
									8bce83d14c
								
							
						
					
					
						commit
						77dcbd5578
					
				@ -1,9 +1,17 @@
 | 
			
		||||
import type { RequestHandler } from "express";
 | 
			
		||||
import { deleteSession } from "../../managers/sessionManager.ts";
 | 
			
		||||
import { getAccountForRequest } from "../../services/loginService.ts";
 | 
			
		||||
import { version_compare } from "../../helpers/inventoryHelpers.ts";
 | 
			
		||||
 | 
			
		||||
const deleteSessionController: RequestHandler = (_req, res) => {
 | 
			
		||||
const deleteSessionController: RequestHandler = async (_req, res) => {
 | 
			
		||||
    const account = await getAccountForRequest(_req);
 | 
			
		||||
    deleteSession(_req.query.sessionId as string);
 | 
			
		||||
    if (account.BuildLabel && version_compare(account.BuildLabel, "2016.07.08.16.56") < 0) {
 | 
			
		||||
        // Pre-Specters of the Rail
 | 
			
		||||
        res.send(_req.query.sessionId as string);
 | 
			
		||||
    } else {
 | 
			
		||||
        res.sendStatus(200);
 | 
			
		||||
    }
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
export { deleteSessionController };
 | 
			
		||||
 | 
			
		||||
@ -13,8 +13,8 @@ const hostSessionController: RequestHandler = async (req, res) => {
 | 
			
		||||
    const session = createNewSession(hostSessionRequest, account._id);
 | 
			
		||||
    logger.debug(`New Session Created`, { session });
 | 
			
		||||
 | 
			
		||||
    if (account.BuildLabel && version_compare(account.BuildLabel, "2015.03.21.08.17") < 0) {
 | 
			
		||||
        // U15 or below
 | 
			
		||||
    if (account.BuildLabel && version_compare(account.BuildLabel, "2016.07.08.16.56") < 0) {
 | 
			
		||||
        // Pre-Specters of the Rail
 | 
			
		||||
        res.send(session.sessionId.toString());
 | 
			
		||||
    } else {
 | 
			
		||||
        res.json({ sessionId: toOid2(session.sessionId, account.BuildLabel), rewardSeed: 99999999 });
 | 
			
		||||
 | 
			
		||||
@ -170,6 +170,7 @@ import { upgradeOperatorController } from "../controllers/api/upgradeOperatorCon
 | 
			
		||||
import { upgradesController } from "../controllers/api/upgradesController.ts";
 | 
			
		||||
import { valenceSwapController } from "../controllers/api/valenceSwapController.ts";
 | 
			
		||||
import { wishlistController } from "../controllers/api/wishlistController.ts";
 | 
			
		||||
import { aggregateSessionsController } from "../controllers/dynamic/aggregateSessionsController.ts";
 | 
			
		||||
 | 
			
		||||
const apiRouter = express.Router();
 | 
			
		||||
 | 
			
		||||
@ -246,6 +247,7 @@ apiRouter.post("/addPendingFriend.php", addPendingFriendController);
 | 
			
		||||
apiRouter.post("/addToAlliance.php", addToAllianceController);
 | 
			
		||||
apiRouter.post("/addToGuild.php", addToGuildController);
 | 
			
		||||
apiRouter.post("/adoptPet.php", adoptPetController);
 | 
			
		||||
apiRouter.post("/aggregateSessions.php", aggregateSessionsController); // Pre-Specters of the Rail builds
 | 
			
		||||
apiRouter.post("/arcaneCommon.php", arcaneCommonController);
 | 
			
		||||
apiRouter.post("/archonFusion.php", archonFusionController);
 | 
			
		||||
apiRouter.post("/artifacts.php", artifactsController);
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user