Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
ziqian zhang
Grasscutter
Commits
deee32a0
Commit
deee32a0
authored
May 07, 2022
by
Muhammad Eko Prasetyo
Committed by
GitHub
May 06, 2022
Browse files
add config option to enable cors for dispatchserver (#579)
parent
3ede7523
Changes
2
Show whitespace changes
Inline
Side-by-side
src/main/java/emu/grasscutter/Config.java
View file @
deee32a0
...
@@ -41,6 +41,8 @@ public final class Config {
...
@@ -41,6 +41,8 @@ public final class Config {
public
String
KeystorePassword
=
"123456"
;
public
String
KeystorePassword
=
"123456"
;
public
Boolean
UseSSL
=
true
;
public
Boolean
UseSSL
=
true
;
public
Boolean
FrontHTTPS
=
true
;
public
Boolean
FrontHTTPS
=
true
;
public
Boolean
CORS
=
false
;
public
String
[]
CORSAllowedOrigins
=
new
String
[]
{
"*"
};
public
boolean
AutomaticallyCreateAccounts
=
false
;
public
boolean
AutomaticallyCreateAccounts
=
false
;
public
String
[]
defaultPermissions
=
new
String
[]
{
""
};
public
String
[]
defaultPermissions
=
new
String
[]
{
""
};
...
...
src/main/java/emu/grasscutter/server/dispatch/DispatchServer.java
View file @
deee32a0
...
@@ -245,8 +245,11 @@ public final class DispatchServer {
...
@@ -245,8 +245,11 @@ public final class DispatchServer {
if
(
Grasscutter
.
getConfig
().
DebugMode
==
ServerDebugMode
.
ALL
)
{
if
(
Grasscutter
.
getConfig
().
DebugMode
==
ServerDebugMode
.
ALL
)
{
config
.
enableDevLogging
();
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
.
get
(
"/"
,
(
req
,
res
)
->
res
.
send
(
Grasscutter
.
getLanguage
().
Welcome
));
httpServer
.
raw
().
error
(
404
,
ctx
->
{
httpServer
.
raw
().
error
(
404
,
ctx
->
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment