Utils for gacha history record subsystem

* Auto generate mapping files with command `java -jar grasscutter.jar -gachamap`

* Static file provider
  * For gacha record webpage
  * All static files should be stored at `GRASSCUTTER_RESOURCE/gcstatic/`
  * Can benefit other subsystem in future when webpages involved
This commit is contained in:
mingjun97
2022-05-01 23:17:18 -07:00
committed by Melledy
parent 6a20e383f7
commit a102613313
7 changed files with 148 additions and 4 deletions

View File

@@ -21,6 +21,7 @@ import emu.grasscutter.server.dispatch.json.ComboTokenReqJson.LoginTokenData;
import emu.grasscutter.server.event.dispatch.QueryAllRegionsEvent;
import emu.grasscutter.server.event.dispatch.QueryCurrentRegionEvent;
import emu.grasscutter.server.http.gacha.GachaRecordHandler;
import emu.grasscutter.server.http.gcstatic.StaticFileHandler;
import emu.grasscutter.utils.FileUtils;
import express.Express;
import org.eclipse.jetty.server.Connector;
@@ -445,8 +446,12 @@ public final class DispatchServer {
// webstatic-sea.hoyoverse.com
httpServer.get("/admin/mi18n/plat_oversea/m202003048/m202003048-version.json", new DispatchHttpJsonHandler("{\"version\":51}"));
// gacha record
httpServer.get("/gacha", new GachaRecordHandler());
// static file provider
httpServer.get("/gcstatic/*", new StaticFileHandler());
httpServer.listen(Grasscutter.getConfig().getDispatchOptions().Port);
Grasscutter.getLogger().info("[Dispatch] Dispatch server started on port " + httpServer.raw().port());
}