mirror of
https://github.com/Melledy/Grasscutter.git
synced 2024-11-24 05:49:12 +00:00
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:
parent
d050407421
commit
d484ba7ed6
@ -74,7 +74,11 @@ public class Account {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public String getEmail() {
|
public String getEmail() {
|
||||||
|
if(email != null && !email.isEmpty()) {
|
||||||
return email;
|
return email;
|
||||||
|
} else {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setEmail(String email) {
|
public void setEmail(String email) {
|
||||||
|
@ -36,7 +36,7 @@ public final class DispatchHttpJsonHandler implements HttpContextHandler {
|
|||||||
public void handle(Request req, Response res) throws IOException {
|
public void handle(Request req, Response res) throws IOException {
|
||||||
// Checking for ALL here isn't required as when ALL is enabled enableDevLogging() gets enabled
|
// 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())) {
|
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);
|
res.send(response);
|
||||||
}
|
}
|
||||||
|
@ -319,9 +319,6 @@ public final class DispatchServer {
|
|||||||
responseData.data.account.uid = account.getId();
|
responseData.data.account.uid = account.getId();
|
||||||
responseData.data.account.token = account.generateSessionKey();
|
responseData.data.account.token = account.generateSessionKey();
|
||||||
responseData.data.account.email = account.getEmail();
|
responseData.data.account.email = account.getEmail();
|
||||||
if (responseData.data.account.email == null) {
|
|
||||||
responseData.data.account.email = "";
|
|
||||||
}
|
|
||||||
|
|
||||||
Grasscutter.getLogger()
|
Grasscutter.getLogger()
|
||||||
.info(String.format("[Dispatch] Client %s failed to log in: Account %s created",
|
.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.uid = account.getId();
|
||||||
responseData.data.account.token = account.generateSessionKey();
|
responseData.data.account.token = account.generateSessionKey();
|
||||||
responseData.data.account.email = account.getEmail();
|
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(),
|
Grasscutter.getLogger().info(String.format("[Dispatch] Client %s logged in as %s", req.ip(),
|
||||||
responseData.data.account.uid));
|
responseData.data.account.uid));
|
||||||
@ -389,9 +383,6 @@ public final class DispatchServer {
|
|||||||
responseData.data.account.uid = requestData.uid;
|
responseData.data.account.uid = requestData.uid;
|
||||||
responseData.data.account.token = requestData.token;
|
responseData.data.account.token = requestData.token;
|
||||||
responseData.data.account.email = account.getEmail();
|
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",
|
Grasscutter.getLogger().info(String.format("[Dispatch] Client %s logged in via token as %s",
|
||||||
req.ip(), responseData.data.account.uid));
|
req.ip(), responseData.data.account.uid));
|
||||||
|
@ -16,7 +16,7 @@ public class LoginResultJson {
|
|||||||
public static class VerifyAccountData {
|
public static class VerifyAccountData {
|
||||||
public String uid;
|
public String uid;
|
||||||
public String name = "";
|
public String name = "";
|
||||||
public String email;
|
public String email = "";
|
||||||
public String mobile = "";
|
public String mobile = "";
|
||||||
public String is_email_verify = "0";
|
public String is_email_verify = "0";
|
||||||
public String realname = "";
|
public String realname = "";
|
||||||
|
Loading…
Reference in New Issue
Block a user