From eea9dc0b091644dac51440c4054ec60226dbd64c Mon Sep 17 00:00:00 2001 From: Sainan <63328889+Sainan@users.noreply.github.com> Date: Sat, 3 May 2025 00:54:08 +0200 Subject: [PATCH 1/2] fix: login failure on u25 & u26 also updated the setGuildMotd response for the old UI before LongMOTD --- src/controllers/api/getAllianceController.ts | 1 + src/controllers/api/loginController.ts | 25 +++++++++++-------- src/controllers/api/setGuildMotdController.ts | 7 +++++- src/routes/api.ts | 2 ++ src/types/loginTypes.ts | 2 +- 5 files changed, 24 insertions(+), 13 deletions(-) diff --git a/src/controllers/api/getAllianceController.ts b/src/controllers/api/getAllianceController.ts index 5da0966d..a4ea7bcd 100644 --- a/src/controllers/api/getAllianceController.ts +++ b/src/controllers/api/getAllianceController.ts @@ -18,6 +18,7 @@ export const getAllianceController: RequestHandler = async (req, res) => { res.end(); }; +// POST request since U27 /*interface IGetAllianceRequest { memberCount: number; clanLeaderName: string; diff --git a/src/controllers/api/loginController.ts b/src/controllers/api/loginController.ts index f872f3a2..492cd660 100644 --- a/src/controllers/api/loginController.ts +++ b/src/controllers/api/loginController.ts @@ -107,21 +107,24 @@ const createLoginResponse = (myAddress: string, account: IDatabaseAccountJson, b ConsentNeeded: account.ConsentNeeded, TrackedSettings: account.TrackedSettings, Nonce: account.Nonce, - Groups: [], IRC: config.myIrcAddresses ?? [myAddress], NRS: config.NRS, BuildLabel: buildLabel }; - if (version_compare(buildLabel, "2021.04.13.19.58") >= 0) { - resp.DTLS = 99; - if (version_compare(buildLabel, "2022.04.29.12.53") >= 0) { - resp.ClientType = account.ClientType; - if (version_compare(buildLabel, "2022.09.06.19.24") >= 0) { - resp.CrossPlatformAllowed = account.CrossPlatformAllowed; - resp.HUB = `https://${myAddress}/api/`; - resp.MatchmakingBuildId = buildConfig.matchmakingBuildId; - if (version_compare(buildLabel, "2023.04.25.23.40") >= 0) { - resp.platformCDNs = [`https://${myAddress}/`]; + if (version_compare(buildLabel, "2019.10.31.22.42") >= 0) { + // U26 and up + resp.Groups = []; + if (version_compare(buildLabel, "2021.04.13.19.58") >= 0) { + resp.DTLS = 99; + if (version_compare(buildLabel, "2022.04.29.12.53") >= 0) { + resp.ClientType = account.ClientType; + if (version_compare(buildLabel, "2022.09.06.19.24") >= 0) { + resp.CrossPlatformAllowed = account.CrossPlatformAllowed; + resp.HUB = `https://${myAddress}/api/`; + resp.MatchmakingBuildId = buildConfig.matchmakingBuildId; + if (version_compare(buildLabel, "2023.04.25.23.40") >= 0) { + resp.platformCDNs = [`https://${myAddress}/`]; + } } } } diff --git a/src/controllers/api/setGuildMotdController.ts b/src/controllers/api/setGuildMotdController.ts index 8f1e28a7..62f10521 100644 --- a/src/controllers/api/setGuildMotdController.ts +++ b/src/controllers/api/setGuildMotdController.ts @@ -2,6 +2,7 @@ import { Alliance, Guild, GuildMember } from "@/src/models/guildModel"; import { hasGuildPermissionEx } from "@/src/services/guildService"; import { getInventory } from "@/src/services/inventoryService"; import { getAccountForRequest, getSuffixedName } from "@/src/services/loginService"; +import { version_compare } from "@/src/services/worldStateService"; import { GuildPermission, ILongMOTD } from "@/src/types/guildTypes"; import { RequestHandler } from "express"; @@ -55,5 +56,9 @@ export const setGuildMotdController: RequestHandler = async (req, res) => { await guild.save(); } - res.json({ IsLongMOTD, MOTD }); + if (!account.BuildLabel || version_compare(account.BuildLabel, "2020.03.24.20.24") > 0) { + res.json({ IsLongMOTD, MOTD }); + } else { + res.send(MOTD).end(); + } }; diff --git a/src/routes/api.ts b/src/routes/api.ts index f594c845..30616eb3 100644 --- a/src/routes/api.ts +++ b/src/routes/api.ts @@ -170,6 +170,7 @@ apiRouter.get("/deleteSession.php", deleteSessionController); apiRouter.get("/divvyAllianceVault.php", divvyAllianceVaultController); apiRouter.get("/dojo", dojoController); apiRouter.get("/drones.php", dronesController); +apiRouter.get("/getAlliance.php", getAllianceController); apiRouter.get("/getDailyDealStockLevels.php", getDailyDealStockLevelsController); apiRouter.get("/getFriends.php", getFriendsController); apiRouter.get("/getGuild.php", getGuildController); @@ -308,6 +309,7 @@ apiRouter.post("/trainingResult.php", trainingResultController); apiRouter.post("/unlockShipFeature.php", unlockShipFeatureController); apiRouter.post("/updateAlignment.php", updateAlignmentController); apiRouter.post("/updateChallengeProgress.php", updateChallengeProgressController); +apiRouter.post("/updateInventory.php", missionInventoryUpdateController); // U26 and below apiRouter.post("/updateNodeIntros.php", genericUpdateController); apiRouter.post("/updateQuest.php", updateQuestController); apiRouter.post("/updateSession.php", updateSessionPostController); diff --git a/src/types/loginTypes.ts b/src/types/loginTypes.ts index 3f412d1e..1b980cb5 100644 --- a/src/types/loginTypes.ts +++ b/src/types/loginTypes.ts @@ -45,7 +45,7 @@ export interface ILoginRequest { export interface ILoginResponse extends IAccountAndLoginResponseCommons { id: string; - Groups: IGroup[]; + Groups?: IGroup[]; BuildLabel: string; MatchmakingBuildId?: string; platformCDNs?: string[]; -- 2.47.2 From 034be6558f43692d960b2f7db08565fdeb1dbde1 Mon Sep 17 00:00:00 2001 From: Sainan <63328889+Sainan@users.noreply.github.com> Date: Sat, 3 May 2025 06:59:16 +0200 Subject: [PATCH 2/2] Fix for pre-25.7 --- src/controllers/api/loginController.ts | 33 ++++++++++++++------------ src/types/loginTypes.ts | 2 +- 2 files changed, 19 insertions(+), 16 deletions(-) diff --git a/src/controllers/api/loginController.ts b/src/controllers/api/loginController.ts index 492cd660..013e9067 100644 --- a/src/controllers/api/loginController.ts +++ b/src/controllers/api/loginController.ts @@ -101,7 +101,6 @@ const createLoginResponse = (myAddress: string, account: IDatabaseAccountJson, b id: account.id, DisplayName: account.DisplayName, CountryCode: account.CountryCode, - ForceLogoutVersion: account.ForceLogoutVersion, AmazonAuthToken: account.AmazonAuthToken, AmazonRefreshToken: account.AmazonRefreshToken, ConsentNeeded: account.ConsentNeeded, @@ -111,23 +110,27 @@ const createLoginResponse = (myAddress: string, account: IDatabaseAccountJson, b NRS: config.NRS, BuildLabel: buildLabel }; + if (version_compare(buildLabel, "2019.08.29.20.01") >= 0) { + // U25.7 and up + resp.ForceLogoutVersion = account.ForceLogoutVersion; + } if (version_compare(buildLabel, "2019.10.31.22.42") >= 0) { // U26 and up resp.Groups = []; - if (version_compare(buildLabel, "2021.04.13.19.58") >= 0) { - resp.DTLS = 99; - if (version_compare(buildLabel, "2022.04.29.12.53") >= 0) { - resp.ClientType = account.ClientType; - if (version_compare(buildLabel, "2022.09.06.19.24") >= 0) { - resp.CrossPlatformAllowed = account.CrossPlatformAllowed; - resp.HUB = `https://${myAddress}/api/`; - resp.MatchmakingBuildId = buildConfig.matchmakingBuildId; - if (version_compare(buildLabel, "2023.04.25.23.40") >= 0) { - resp.platformCDNs = [`https://${myAddress}/`]; - } - } - } - } + } + if (version_compare(buildLabel, "2021.04.13.19.58") >= 0) { + resp.DTLS = 99; + } + if (version_compare(buildLabel, "2022.04.29.12.53") >= 0) { + resp.ClientType = account.ClientType; + } + if (version_compare(buildLabel, "2022.09.06.19.24") >= 0) { + resp.CrossPlatformAllowed = account.CrossPlatformAllowed; + resp.HUB = `https://${myAddress}/api/`; + resp.MatchmakingBuildId = buildConfig.matchmakingBuildId; + } + if (version_compare(buildLabel, "2023.04.25.23.40") >= 0) { + resp.platformCDNs = [`https://${myAddress}/`]; } return resp; }; diff --git a/src/types/loginTypes.ts b/src/types/loginTypes.ts index 1b980cb5..fc4bef6a 100644 --- a/src/types/loginTypes.ts +++ b/src/types/loginTypes.ts @@ -5,7 +5,7 @@ export interface IAccountAndLoginResponseCommons { CountryCode: string; ClientType?: string; CrossPlatformAllowed?: boolean; - ForceLogoutVersion: number; + ForceLogoutVersion?: number; AmazonAuthToken?: string; AmazonRefreshToken?: string; ConsentNeeded: boolean; -- 2.47.2