Commit 0d262e2d authored by 4Benj_'s avatar 4Benj_ Committed by GitHub
Browse files

Cleaned up dispatch iOS fixes (#396)

* Attempting to fix crashing on iOS devices

plus I forgot a thing in string.format

* Removed unnecessary things
parent d0c6be55
......@@ -74,7 +74,11 @@ public class Account {
}
public String getEmail() {
return email;
if(email != null && !email.isEmpty()) {
return email;
} else {
return "";
}
}
public void setEmail(String email) {
......
......@@ -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);
}
......
......@@ -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));
......
......@@ -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 = "";
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment