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: login failure on u25 & u26 (#1967)

also updated the setGuildMotd response for the old UI before LongMOTD Reviewed-on: https://onlyg.it/OpenWF/SpaceNinjaServer/pulls/1967 Co-authored-by: Sainan <63328889+Sainan@users.noreply.github.com> Co-committed-by: Sainan <63328889+Sainan@users.noreply.github.com>

8ae5fcfa
Sainan <63328889+Sainan@users.noreply.github.com>
提交于

代码差异

5 个文件 +30 -16
Modified src/controllers/api/getAllianceController.ts +1 -0
@@ -18,6 +18,7 @@ export const getAllianceController: RequestHandler = async (req, res) => {
18 18 res.end();
19 19 };
20 20
21 // POST request since U27
21 22 /*interface IGetAllianceRequest {
22 23 memberCount: number;
23 24 clanLeaderName: string;
Modified src/controllers/api/loginController.ts +19 -13
@@ -101,30 +101,36 @@ const createLoginResponse = (myAddress: string, account: IDatabaseAccountJson, b
101 101 id: account.id,
102 102 DisplayName: account.DisplayName,
103 103 CountryCode: account.CountryCode,
104 ForceLogoutVersion: account.ForceLogoutVersion,
105 104 AmazonAuthToken: account.AmazonAuthToken,
106 105 AmazonRefreshToken: account.AmazonRefreshToken,
107 106 ConsentNeeded: account.ConsentNeeded,
108 107 TrackedSettings: account.TrackedSettings,
109 108 Nonce: account.Nonce,
110 Groups: [],
111 109 IRC: config.myIrcAddresses ?? [myAddress],
112 110 NRS: config.NRS,
113 111 BuildLabel: buildLabel
114 112 };
113 if (version_compare(buildLabel, "2019.08.29.20.01") >= 0) {
114 // U25.7 and up
115 resp.ForceLogoutVersion = account.ForceLogoutVersion;
116 }
117 if (version_compare(buildLabel, "2019.10.31.22.42") >= 0) {
118 // U26 and up
119 resp.Groups = [];
120 }
115 121 if (version_compare(buildLabel, "2021.04.13.19.58") >= 0) {
116 122 resp.DTLS = 99;
117 if (version_compare(buildLabel, "2022.04.29.12.53") >= 0) {
118 resp.ClientType = account.ClientType;
119 if (version_compare(buildLabel, "2022.09.06.19.24") >= 0) {
120 resp.CrossPlatformAllowed = account.CrossPlatformAllowed;
121 resp.HUB = `https://${myAddress}/api/`;
122 resp.MatchmakingBuildId = buildConfig.matchmakingBuildId;
123 if (version_compare(buildLabel, "2023.04.25.23.40") >= 0) {
124 resp.platformCDNs = [`https://${myAddress}/`];
125 }
126 }
127 }
123 }
124 if (version_compare(buildLabel, "2022.04.29.12.53") >= 0) {
125 resp.ClientType = account.ClientType;
126 }
127 if (version_compare(buildLabel, "2022.09.06.19.24") >= 0) {
128 resp.CrossPlatformAllowed = account.CrossPlatformAllowed;
129 resp.HUB = `https://${myAddress}/api/`;
130 resp.MatchmakingBuildId = buildConfig.matchmakingBuildId;
131 }
132 if (version_compare(buildLabel, "2023.04.25.23.40") >= 0) {
133 resp.platformCDNs = [`https://${myAddress}/`];
128 134 }
129 135 return resp;
130 136 };
Modified src/controllers/api/setGuildMotdController.ts +6 -1
@@ -2,6 +2,7 @@ import { Alliance, Guild, GuildMember } from "@/src/models/guildModel";
2 2 import { hasGuildPermissionEx } from "@/src/services/guildService";
3 3 import { getInventory } from "@/src/services/inventoryService";
4 4 import { getAccountForRequest, getSuffixedName } from "@/src/services/loginService";
5 import { version_compare } from "@/src/services/worldStateService";
5 6 import { GuildPermission, ILongMOTD } from "@/src/types/guildTypes";
6 7 import { RequestHandler } from "express";
7 8
@@ -55,5 +56,9 @@ export const setGuildMotdController: RequestHandler = async (req, res) => {
55 56 await guild.save();
56 57 }
57 58
58 res.json({ IsLongMOTD, MOTD });
59 if (!account.BuildLabel || version_compare(account.BuildLabel, "2020.03.24.20.24") > 0) {
60 res.json({ IsLongMOTD, MOTD });
61 } else {
62 res.send(MOTD).end();
63 }
59 64 };
Modified src/routes/api.ts +2 -0
@@ -170,6 +170,7 @@ apiRouter.get("/deleteSession.php", deleteSessionController);
170 170 apiRouter.get("/divvyAllianceVault.php", divvyAllianceVaultController);
171 171 apiRouter.get("/dojo", dojoController);
172 172 apiRouter.get("/drones.php", dronesController);
173 apiRouter.get("/getAlliance.php", getAllianceController);
173 174 apiRouter.get("/getDailyDealStockLevels.php", getDailyDealStockLevelsController);
174 175 apiRouter.get("/getFriends.php", getFriendsController);
175 176 apiRouter.get("/getGuild.php", getGuildController);
@@ -308,6 +309,7 @@ apiRouter.post("/trainingResult.php", trainingResultController);
308 309 apiRouter.post("/unlockShipFeature.php", unlockShipFeatureController);
309 310 apiRouter.post("/updateAlignment.php", updateAlignmentController);
310 311 apiRouter.post("/updateChallengeProgress.php", updateChallengeProgressController);
312 apiRouter.post("/updateInventory.php", missionInventoryUpdateController); // U26 and below
311 313 apiRouter.post("/updateNodeIntros.php", genericUpdateController);
312 314 apiRouter.post("/updateQuest.php", updateQuestController);
313 315 apiRouter.post("/updateSession.php", updateSessionPostController);
Modified src/types/loginTypes.ts +2 -2
@@ -5,7 +5,7 @@ export interface IAccountAndLoginResponseCommons {
5 5 CountryCode: string;
6 6 ClientType?: string;
7 7 CrossPlatformAllowed?: boolean;
8 ForceLogoutVersion: number;
8 ForceLogoutVersion?: number;
9 9 AmazonAuthToken?: string;
10 10 AmazonRefreshToken?: string;
11 11 ConsentNeeded: boolean;
@@ -45,7 +45,7 @@ export interface ILoginRequest {
45 45
46 46 export interface ILoginResponse extends IAccountAndLoginResponseCommons {
47 47 id: string;
48 Groups: IGroup[];
48 Groups?: IGroup[];
49 49 BuildLabel: string;
50 50 MatchmakingBuildId?: string;
51 51 platformCDNs?: string[];