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
a044448a
Commit
a044448a
authored
Apr 30, 2022
by
KingRainbow44
Browse files
Implement a handler for logging routes
parent
5f0c9203
Changes
2
Show whitespace changes
Inline
Side-by-side
src/main/java/emu/grasscutter/server/dispatch/ClientLogHandler.java
0 → 100644
View file @
a044448a
package
emu.grasscutter.server.dispatch
;
import
express.http.HttpContextHandler
;
import
express.http.Request
;
import
express.http.Response
;
import
java.io.IOException
;
/**
* Used for processing crash dumps & logs generated by the game.
* Logs are in JSON, and are sent to the server for logging.
*/
public
final
class
ClientLogHandler
implements
HttpContextHandler
{
@Override
public
void
handle
(
Request
request
,
Response
response
)
throws
IOException
{
// TODO: Figure out how to dump request body and log to file.
response
.
send
(
"{\"code\":0}"
);
}
}
src/main/java/emu/grasscutter/server/dispatch/DispatchServer.java
View file @
a044448a
...
...
@@ -35,11 +35,11 @@ public final class DispatchServer {
private
final
String
defaultServerName
=
"os_usa"
;
public
String
regionListBase64
;
public
Hash
Map
<
String
,
RegionData
>
regions
;
public
Map
<
String
,
RegionData
>
regions
;
private
Express
httpServer
;
public
DispatchServer
()
{
this
.
regions
=
new
HashMap
<
String
,
RegionData
>();
this
.
regions
=
new
HashMap
<>();
this
.
gson
=
new
GsonBuilder
().
create
();
this
.
loadQueries
();
...
...
@@ -475,9 +475,9 @@ public final class DispatchServer {
// Logging servers
// overseauspider.yuanshen.com
httpServer
.
all
(
"/log"
,
new
DispatchHttpJsonHandler
(
"{\"code\":0}"
));
httpServer
.
all
(
"/log"
,
new
ClientLogHandler
(
));
// log-upload-os.mihoyo.com
httpServer
.
all
(
"/crash/dataUpload"
,
new
DispatchHttpJsonHandler
(
"{\"code\":0}"
));
httpServer
.
all
(
"/crash/dataUpload"
,
new
ClientLogHandler
(
));
httpServer
.
get
(
"/gacha"
,
(
req
,
res
)
->
res
.
send
(
"<!doctype html><html lang=\"en\"><head><title>Gacha</title></head><body></body></html>"
));
...
...
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