mirror of
https://github.com/Grasscutters/Grasscutter.git
synced 2025-12-19 18:34:49 +01:00
add config option to enable cors for dispatchserver (#579)
This commit is contained in:
committed by
GitHub
parent
da99140d20
commit
63a37acc1b
@@ -245,8 +245,11 @@ public final class DispatchServer {
|
||||
if(Grasscutter.getConfig().DebugMode == ServerDebugMode.ALL) {
|
||||
config.enableDevLogging();
|
||||
}
|
||||
if (Grasscutter.getConfig().getDispatchOptions().CORS){
|
||||
if (Grasscutter.getConfig().getDispatchOptions().CORSAllowedOrigins.length > 0) config.enableCorsForOrigin(Grasscutter.getConfig().getDispatchOptions().CORSAllowedOrigins);
|
||||
else config.enableCorsForAllOrigins();
|
||||
}
|
||||
});
|
||||
|
||||
httpServer.get("/", (req, res) -> res.send(Grasscutter.getLanguage().Welcome));
|
||||
|
||||
httpServer.raw().error(404, ctx -> {
|
||||
|
||||
Reference in New Issue
Block a user