Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
ziqian zhang
Grasscutter
Commits
8b8777e9
Commit
8b8777e9
authored
Apr 30, 2022
by
mingjun97
Committed by
Melledy
Apr 30, 2022
Browse files
Fix crash when login
* Prevent email to be `null` to avoid crash in certain client setup.
parent
3169e87c
Changes
1
Show whitespace changes
Inline
Side-by-side
src/main/java/emu/grasscutter/server/dispatch/DispatchServer.java
View file @
8b8777e9
...
...
@@ -381,6 +381,9 @@ 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
));
...
...
@@ -437,7 +440,7 @@ 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
.
pos
t
(
"/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\":\"\"}}}"
));
httpServer
.
ge
t
(
"/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
...
...
@@ -469,7 +472,7 @@ public final class DispatchServer {
// log-upload-os.mihoyo.com
httpServer
.
all
(
"/log/sdk/upload"
,
new
DispatchHttpJsonHandler
(
"{\"code\":0}"
));
httpServer
.
all
(
"/sdk/upload"
,
new
DispatchHttpJsonHandler
(
"{\"code\":0}"
));
httpServer
.
post
(
"/sdk/dataUpload"
,
new
DispatchHttpJsonHandler
(
"{\"code\":0}
"
));
httpServer
.
post
(
"/sdk/dataUpload"
,
(
req
,
res
)
->
res
.
send
(
"Hello
"
));
// /perf/config/verify?device_id=xxx&platform=x&name=xxx
httpServer
.
all
(
"/perf/config/verify"
,
new
DispatchHttpJsonHandler
(
"{\"code\":0}"
));
...
...
@@ -479,6 +482,9 @@ public final class DispatchServer {
// log-upload-os.mihoyo.com
httpServer
.
all
(
"/crash/dataUpload"
,
new
ClientLogHandler
());
// webstatic-sea.hoyoverse.com
httpServer
.
get
(
"/admin/mi18n/plat_oversea/m202003048/m202003048-version.json"
,
new
DispatchHttpJsonHandler
(
"{\"version\":51}"
));
httpServer
.
get
(
"/gacha"
,
(
req
,
res
)
->
res
.
send
(
"<!doctype html><html lang=\"en\"><head><title>Gacha</title></head><body></body></html>"
));
httpServer
.
listen
(
Grasscutter
.
getConfig
().
getDispatchOptions
().
Port
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment