Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
G
Grasscutter
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
ziqian zhang
Grasscutter
Commits
0ff6ea42
Commit
0ff6ea42
authored
3 years ago
by
naufal
Browse files
Options
Downloads
Patches
Plain Diff
feat: added configuration for change upload port
feat: added configuration for use non SSL
parent
4cf734fb
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/main/java/emu/grasscutter/Config.java
+3
-0
3 additions, 0 deletions
src/main/java/emu/grasscutter/Config.java
src/main/java/emu/grasscutter/server/dispatch/DispatchServer.java
+24
-18
24 additions, 18 deletions
.../java/emu/grasscutter/server/dispatch/DispatchServer.java
with
27 additions
and
18 deletions
src/main/java/emu/grasscutter/Config.java
+
3
−
0
View file @
0ff6ea42
...
...
@@ -6,12 +6,15 @@ public final class Config {
public
int
DispatchServerPort
=
443
;
public
String
DispatchServerKeystorePath
=
"./keystore.p12"
;
public
String
DispatchServerKeystorePassword
=
""
;
public
Boolean
UseSSL
=
true
;
public
String
GameServerName
=
"Test"
;
public
String
GameServerIp
=
"127.0.0.1"
;
public
String
GameServerPublicIp
=
""
;
public
int
GameServerPort
=
22102
;
public
int
UploadLogPort
=
80
;
public
String
DatabaseUrl
=
"mongodb://localhost:27017"
;
public
String
DatabaseCollection
=
"grasscutter"
;
...
...
This diff is collapsed.
Click to expand it.
src/main/java/emu/grasscutter/server/dispatch/DispatchServer.java
+
24
−
18
View file @
0ff6ea42
...
...
@@ -139,9 +139,11 @@ public final class DispatchServer {
}
public
void
start
()
throws
Exception
{
HttpsServer
server
=
HttpsServer
.
create
(
getAddress
(),
0
);
HttpServer
server
;
if
(
Grasscutter
.
getConfig
().
UseSSL
)
{
HttpsServer
httpsServer
;
httpsServer
=
HttpsServer
.
create
(
getAddress
(),
0
);
SSLContext
sslContext
=
SSLContext
.
getInstance
(
"TLS"
);
try
(
FileInputStream
fis
=
new
FileInputStream
(
Grasscutter
.
getConfig
().
DispatchServerKeystorePath
))
{
char
[]
keystorePassword
=
Grasscutter
.
getConfig
().
DispatchServerKeystorePassword
.
toCharArray
();
KeyStore
ks
=
KeyStore
.
getInstance
(
"PKCS12"
);
...
...
@@ -151,11 +153,15 @@ public final class DispatchServer {
sslContext
.
init
(
kmf
.
getKeyManagers
(),
null
,
null
);
server
.
setHttpsConfigurator
(
new
HttpsConfigurator
(
sslContext
));
httpsServer
.
setHttpsConfigurator
(
new
HttpsConfigurator
(
sslContext
));
server
=
httpsServer
;
}
catch
(
Exception
e
)
{
Grasscutter
.
getLogger
().
error
(
"No SSL cert found!"
);
return
;
}
}
else
{
server
=
HttpServer
.
create
(
getAddress
(),
0
);
}
server
.
createContext
(
"/"
,
t
->
{
//Create a response form the request query parameters
...
...
@@ -396,7 +402,7 @@ public final class DispatchServer {
overseaLogServer
.
start
();
Grasscutter
.
getLogger
().
info
(
"Log server (overseauspider) started on port "
+
8888
);
HttpServer
uploadLogServer
=
HttpServer
.
create
(
new
InetSocketAddress
(
Grasscutter
.
getConfig
().
DispatchServerIp
,
80
),
0
);
HttpServer
uploadLogServer
=
HttpServer
.
create
(
new
InetSocketAddress
(
Grasscutter
.
getConfig
().
DispatchServerIp
,
Grasscutter
.
getConfig
().
UploadLogPort
),
0
);
uploadLogServer
.
createContext
(
// log-upload-os.mihoyo.com
"/crash/dataUpload"
,
new
DispatchHttpJsonHandler
(
"{\"code\":0}"
)
...
...
@@ -413,7 +419,7 @@ public final class DispatchServer {
os
.
close
();
});
uploadLogServer
.
start
();
Grasscutter
.
getLogger
().
info
(
"Log server (log-upload-os) started on port "
+
80
);
Grasscutter
.
getLogger
().
info
(
"Log server (log-upload-os) started on port "
+
Grasscutter
.
getConfig
().
UploadLogPort
);
}
private
Map
<
String
,
String
>
parseQueryString
(
String
qs
)
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment