mirror of
https://github.com/Melledy/Grasscutter.git
synced 2024-11-24 00:11:31 +00:00
Implement a handler for logging routes
This commit is contained in:
parent
8830da8bc1
commit
6fb0b5494f
@ -0,0 +1,19 @@
|
|||||||
|
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}");
|
||||||
|
}
|
||||||
|
}
|
@ -35,11 +35,11 @@ public final class DispatchServer {
|
|||||||
private final String defaultServerName = "os_usa";
|
private final String defaultServerName = "os_usa";
|
||||||
|
|
||||||
public String regionListBase64;
|
public String regionListBase64;
|
||||||
public HashMap<String, RegionData> regions;
|
public Map<String, RegionData> regions;
|
||||||
private Express httpServer;
|
private Express httpServer;
|
||||||
|
|
||||||
public DispatchServer() {
|
public DispatchServer() {
|
||||||
this.regions = new HashMap<String, RegionData>();
|
this.regions = new HashMap<>();
|
||||||
this.gson = new GsonBuilder().create();
|
this.gson = new GsonBuilder().create();
|
||||||
|
|
||||||
this.loadQueries();
|
this.loadQueries();
|
||||||
@ -475,9 +475,9 @@ public final class DispatchServer {
|
|||||||
|
|
||||||
// Logging servers
|
// Logging servers
|
||||||
// overseauspider.yuanshen.com
|
// overseauspider.yuanshen.com
|
||||||
httpServer.all("/log", new DispatchHttpJsonHandler("{\"code\":0}"));
|
httpServer.all("/log", new ClientLogHandler());
|
||||||
// log-upload-os.mihoyo.com
|
// 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>"));
|
httpServer.get("/gacha", (req, res) -> res.send("<!doctype html><html lang=\"en\"><head><title>Gacha</title></head><body></body></html>"));
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user