[+] Return matching api

pull/100/head
Azalea 2025-01-03 16:31:58 -05:00
parent 256b48a0ad
commit d5a1a26091
1 changed files with 14 additions and 16 deletions

View File

@ -1,6 +1,7 @@
package icu.samnyan.aqua.sega.chusan package icu.samnyan.aqua.sega.chusan
import ext.* import ext.*
import icu.samnyan.aqua.sega.allnet.TokenChecker
import icu.samnyan.aqua.sega.chusan.model.request.UserCMissionResp import icu.samnyan.aqua.sega.chusan.model.request.UserCMissionResp
import icu.samnyan.aqua.sega.chusan.model.response.data.UserEmoney import icu.samnyan.aqua.sega.chusan.model.response.data.UserEmoney
import icu.samnyan.aqua.sega.chusan.model.userdata.UserCharge import icu.samnyan.aqua.sega.chusan.model.userdata.UserCharge
@ -193,19 +194,16 @@ fun ChusanController.chusanInit() {
// Special thanks to skogaby // Special thanks to skogaby
// Hardcode so that the reboot time always started 3 hours ago and ended 2 hours ago // Hardcode so that the reboot time always started 3 hours ago and ended 2 hours ago
val fmt = DateTimeFormatter.ofPattern("uuuu-MM-dd HH:mm:ss") val fmt = DateTimeFormatter.ofPattern("uuuu-MM-dd HH:mm:ss")
// Get the request url as te address
val addr = (req.getHeader("wrapper original url") ?: req.requestURL.toString())
.removeSuffix("GetGameSettingApi").removeSuffix("ChuniServlet/")
val now = jstNow() val now = jstNow()
val matching = if (!props.externalMatching.isNullOrBlank() && !props.proxiedMatching) mapOf( // Set the matching & reflector to the one set in the game options, or the external matching server
"matchingUri" to props.externalMatching, val opts = TokenChecker.getCurrentSession()?.user?.gameOptions
"matchingUriX" to props.externalMatching, val matching = opts?.chusanMatchingServer?.ifBlank { null } ?:
) else mapOf( props.externalMatching?.ifBlank { null } ?:
"matchingUri" to addr, (req.getHeader("wrapper original url") ?: req.requestURL.toString())
"matchingUriX" to addr .removeSuffix("GetGameSettingApi").removeSuffix("ChuniServlet/")
) val reflector = opts?.chusanMatchingReflector?.ifBlank { null } ?:
props.reflectorUrl
mapOf( mapOf(
"gameSetting" to mapOf( "gameSetting" to mapOf(
@ -223,11 +221,11 @@ fun ChusanController.chusanInit() {
"matchEndTime" to now.plusHours(7).format(fmt), "matchEndTime" to now.plusHours(7).format(fmt),
"matchTimeLimit" to 10, "matchTimeLimit" to 10,
"matchErrorLimit" to 10, "matchErrorLimit" to 10,
"matchingUri" to addr, "matchingUri" to matching.ensureEndingSlash(),
"matchingUriX" to addr, "matchingUriX" to matching.ensureEndingSlash(),
"udpHolePunchUri" to props.reflectorUrl, "udpHolePunchUri" to reflector?.ensureEndingSlash(),
"reflectorUri" to props.reflectorUrl, "reflectorUri" to reflector?.ensureEndingSlash(),
) + matching, ),
"isDumpUpload" to false, "isDumpUpload" to false,
"isAou" to false "isAou" to false
) )