mirror of
https://github.com/Melledy/Grasscutter.git
synced 2024-11-29 10:43:14 +00:00
add config option to enable cors for dispatchserver (#579)
This commit is contained in:
parent
3ede7523b0
commit
deee32a0a1
@ -41,6 +41,8 @@ public final class Config {
|
||||
public String KeystorePassword = "123456";
|
||||
public Boolean UseSSL = true;
|
||||
public Boolean FrontHTTPS = true;
|
||||
public Boolean CORS = false;
|
||||
public String[] CORSAllowedOrigins = new String[] { "*" };
|
||||
|
||||
public boolean AutomaticallyCreateAccounts = false;
|
||||
public String[] defaultPermissions = new String[] { "" };
|
||||
|
@ -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 -> {
|
||||
|
Loading…
Reference in New Issue
Block a user