From 8a655c16eb0425bb5a6ad096e69df3808bf2e92c Mon Sep 17 00:00:00 2001 From: mingjun97 Date: Sat, 30 Apr 2022 22:11:42 -0700 Subject: [PATCH] Fix crash and revise route * Fix another point which will trigger iOS client to crash * Revise `compareProtocolVersion` route to handle all method --- .../emu/grasscutter/server/dispatch/DispatchServer.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/java/emu/grasscutter/server/dispatch/DispatchServer.java b/src/main/java/emu/grasscutter/server/dispatch/DispatchServer.java index 9fc85b477..5ef8f7a89 100644 --- a/src/main/java/emu/grasscutter/server/dispatch/DispatchServer.java +++ b/src/main/java/emu/grasscutter/server/dispatch/DispatchServer.java @@ -319,6 +319,9 @@ public final class DispatchServer { responseData.data.account.uid = account.getId(); responseData.data.account.token = account.generateSessionKey(); responseData.data.account.email = account.getEmail(); + if (responseData.data.account.email == null) { + responseData.data.account.email = ""; + } Grasscutter.getLogger() .info(String.format("[Dispatch] Client %s failed to log in: Account %s created", @@ -442,7 +445,8 @@ public final class DispatchServer { // hk4e-sdk-os.hoyoverse.com httpServer.get("/hk4e_global/mdk/agreement/api/getAgreementInfos", new DispatchHttpJsonHandler("{\"retcode\":0,\"message\":\"OK\",\"data\":{\"marketing_agreements\":[]}}")); // hk4e-sdk-os.hoyoverse.com - httpServer.get("/hk4e_global/combo/granter/api/compareProtocolVersion", new DispatchHttpJsonHandler("{\"retcode\":0,\"message\":\"OK\",\"data\":{\"modified\":true,\"protocol\":{\"id\":0,\"app_id\":4,\"language\":\"en\",\"user_proto\":\"\",\"priv_proto\":\"\",\"major\":7,\"minimum\":0,\"create_time\":\"0\",\"teenager_proto\":\"\",\"third_proto\":\"\"}}}")); + // this could be either GET or POST based on the observation of different clients + httpServer.all("/hk4e_global/combo/granter/api/compareProtocolVersion", new DispatchHttpJsonHandler("{\"retcode\":0,\"message\":\"OK\",\"data\":{\"modified\":true,\"protocol\":{\"id\":0,\"app_id\":4,\"language\":\"en\",\"user_proto\":\"\",\"priv_proto\":\"\",\"major\":7,\"minimum\":0,\"create_time\":\"0\",\"teenager_proto\":\"\",\"third_proto\":\"\"}}}")); // Game data // hk4e-api-os.hoyoverse.com