Cleaned up dispatch iOS fixes (#396)

* Attempting to fix crashing on iOS devices

plus I forgot a thing in string.format

* Removed unnecessary things
This commit is contained in:
4Benj_ 2022-05-01 14:31:39 +08:00 committed by GitHub
parent d050407421
commit d484ba7ed6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 7 additions and 12 deletions

View File

@ -74,7 +74,11 @@ public class Account {
}
public String getEmail() {
if(email != null && !email.isEmpty()) {
return email;
} else {
return "";
}
}
public void setEmail(String email) {

View File

@ -36,7 +36,7 @@ public final class DispatchHttpJsonHandler implements HttpContextHandler {
public void handle(Request req, Response res) throws IOException {
// Checking for ALL here isn't required as when ALL is enabled enableDevLogging() gets enabled
if(Grasscutter.getConfig().DebugMode == ServerDebugMode.MISSING && Arrays.stream(missingRoutes).anyMatch(x -> x == req.baseUrl())) {
Grasscutter.getLogger().info(String.format("[Dispatch] Client %s %s request: ", req.ip(), req.method(), req.baseUrl()) + (Grasscutter.getConfig().DebugMode == ServerDebugMode.MISSING ? "(MISSING)" : ""));
Grasscutter.getLogger().info(String.format("[Dispatch] Client %s %s request: %s", req.ip(), req.method(), req.baseUrl()) + (Grasscutter.getConfig().DebugMode == ServerDebugMode.MISSING ? "(MISSING)" : ""));
}
res.send(response);
}

View File

@ -319,9 +319,6 @@ 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",
@ -346,9 +343,6 @@ 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 logged in as %s", req.ip(),
responseData.data.account.uid));
@ -389,9 +383,6 @@ public final class DispatchServer {
responseData.data.account.uid = requestData.uid;
responseData.data.account.token = requestData.token;
responseData.data.account.email = account.getEmail();
if (responseData.data.account.email == null) { // null will trigger crash in some client
responseData.data.account.email = "";
}
Grasscutter.getLogger().info(String.format("[Dispatch] Client %s logged in via token as %s",
req.ip(), responseData.data.account.uid));

View File

@ -16,7 +16,7 @@ public class LoginResultJson {
public static class VerifyAccountData {
public String uid;
public String name = "";
public String email;
public String email = "";
public String mobile = "";
public String is_email_verify = "0";
public String realname = "";