mirror of
https://github.com/Grasscutters/Grasscutter.git
synced 2025-12-16 08:56:04 +01:00
add config option to enable cors for dispatchserver (#579)
This commit is contained in:
committed by
GitHub
parent
3ede7523b0
commit
deee32a0a1
@@ -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