fix: login failure on U17 #1986

Merged
Sainan merged 2 commits from u17 into main 2025-05-05 18:09:03 -07:00
3 changed files with 9 additions and 3 deletions
Showing only changes of commit 1ea7a5f059 - Show all commits

View File

@ -23,7 +23,8 @@ app.use((req, _res, next) => {
} }
// U18 uses application/x-www-form-urlencoded even tho the data is JSON which Express doesn't like. // U18 uses application/x-www-form-urlencoded even tho the data is JSON which Express doesn't like.
if (req.headers["content-type"] == "application/x-www-form-urlencoded") { // U17 sets no Content-Type at all, which Express also doesn't like.
if (!req.headers["content-type"] || req.headers["content-type"] == "application/x-www-form-urlencoded") {
req.headers["content-type"] = "application/octet-stream"; req.headers["content-type"] = "application/octet-stream";
} }

View File

@ -82,9 +82,12 @@ export const loginController: RequestHandler = async (request, response) => {
} }
} else { } else {
if (account.Nonce && account.ClientType != "webui" && !account.Dropped && !loginRequest.kick) { if (account.Nonce && account.ClientType != "webui" && !account.Dropped && !loginRequest.kick) {
response.status(400).json({ error: "nonce still set" }); // U17 seems to handle "nonce still set" like a login failure.
if (version_compare(buildLabel, "2015.12.05.18.07") >= 0) {
response.status(400).send({ error: "nonce still set" });
return; return;
} }
}
account.ClientType = loginRequest.ClientType; account.ClientType = loginRequest.ClientType;
account.Nonce = nonce; account.Nonce = nonce;

View File

@ -186,6 +186,7 @@ apiRouter.get("/getVendorInfo.php", getVendorInfoController);
apiRouter.get("/hub", hubController); apiRouter.get("/hub", hubController);
apiRouter.get("/hubInstances", hubInstancesController); apiRouter.get("/hubInstances", hubInstancesController);
apiRouter.get("/inbox.php", inboxController); apiRouter.get("/inbox.php", inboxController);
apiRouter.get("/getMessages.php", inboxController); // unsure if this is correct, but needed for U17
apiRouter.get("/inventory.php", inventoryController); apiRouter.get("/inventory.php", inventoryController);
apiRouter.get("/loginRewards.php", loginRewardsController); apiRouter.get("/loginRewards.php", loginRewardsController);
apiRouter.get("/logout.php", logoutController); apiRouter.get("/logout.php", logoutController);
@ -278,6 +279,7 @@ apiRouter.post("/playerSkills.php", playerSkillsController);
apiRouter.post("/postGuildAdvertisement.php", postGuildAdvertisementController); apiRouter.post("/postGuildAdvertisement.php", postGuildAdvertisementController);
apiRouter.post("/projectionManager.php", projectionManagerController); apiRouter.post("/projectionManager.php", projectionManagerController);
apiRouter.post("/purchase.php", purchaseController); apiRouter.post("/purchase.php", purchaseController);
apiRouter.post("/questControl.php", questControlController); // U17
apiRouter.post("/redeemPromoCode.php", redeemPromoCodeController); apiRouter.post("/redeemPromoCode.php", redeemPromoCodeController);
apiRouter.post("/releasePet.php", releasePetController); apiRouter.post("/releasePet.php", releasePetController);
apiRouter.post("/removeFromGuild.php", removeFromGuildController); apiRouter.post("/removeFromGuild.php", removeFromGuildController);