[+] Hide allnet port

pull/96/head
Azalea 2024-12-12 17:06:32 -05:00
parent 5ed89754b3
commit 1a06033964
2 changed files with 5 additions and 3 deletions

View File

@ -13,6 +13,7 @@ billing.server.port=8443
## Please notice most games won't work with localhost or 127.0.0.1
#allnet.server.host=
#allnet.server.port=
allnet.server.hide-port=true
## This is for some games that use shop name for in-game functions.
## Specify the place name here if you need it. By default it is empty.
allnet.server.place-name=AquaDX

View File

@ -23,6 +23,7 @@ import java.util.*
class AllNetProps {
var host: String = ""
var port: Int? = null
var hidePort: Boolean = true
val keychipSesExpire: Long = 172800000 // milliseconds
var checkKeychip: Boolean = false
var keychipPermissiveForTesting: Boolean = false
@ -173,13 +174,13 @@ class AllNet(
}
private fun switchUri(localAddr: Str, localPort: Str, gameId: Str, ver: Str, session: Str?): Str {
val addr = props.host.ifBlank { localAddr }
val port = props.port?.toString() ?: localPort
val addr = props.host.ifBlank { localAddr } +
if (props.hidePort) "" else ":${props.port?.toString() ?: localPort}"
// If keychip authentication is enabled, the game URLs will be set to /gs/{token}/{game}/...
val base = if (session != null) "gs/$session" else "g"
return "http://$addr:$port/$base/" + when (gameId) {
return "http://$addr/$base/" + when (gameId) {
"SDBT" -> "chu2/$ver/$session/"
"SDHD" -> "chu3/$ver/"
"SDGS" -> "chu3/$ver/" // International (c3exp)