haruki需要替换台服的host

This commit is contained in:
2026-10-26 23:27:46 +08:00
parent 070020a296
commit 0851713876
9 changed files with 90 additions and 64 deletions
@@ -1,16 +1,8 @@
package net.bluemangoo.indpjsk.data
object PredefinedProfiles {
import net.bluemangoo.indpjsk.upload.Uploader
/**
* 两个数据接口的正则(Host 已去掉,Rust 侧是拿 path + query 去匹配的):
*
* 1. Suite(个人信息 / 卡牌 / 仓库主数据)
* Path 模板: /api/suite/user/{uid}
*
* 2. MySekai(烤森房间 / 地图全量数据)
* Path 模板: /api/user/{uid}/mysekai?isForceAllReloadOnlyMysekai=True
*/
object PredefinedProfiles {
private const val SUITE_PATH = "/api/suite/user/(\\d+)(\\?isLogin=true)?\$"
private const val MYSEKAI_PATH =
"/api/user/(\\d+)/mysekai\\?isForceAllReloadOnlyMysekai=True"
@@ -20,7 +12,10 @@ object PredefinedProfiles {
name = "Suite",
hosts = hosts,
path = SUITE_PATH,
fileName = "suite"
fileName = "suite",
postAction = { result ->
Uploader.tryUpload(result)
}
)
private fun mysekaiStep(hosts: List<String>) = CaptureProfileStep(
@@ -28,7 +23,10 @@ object PredefinedProfiles {
name = "烤森",
hosts = hosts,
path = MYSEKAI_PATH,
fileName = "mysekai"
fileName = "mysekai",
postAction = { result ->
Uploader.tryUpload(result)
}
)
private fun mysekaiBirthday(hosts: List<String>) = CaptureProfileStep(
@@ -36,7 +34,10 @@ object PredefinedProfiles {
name = "烤森生日双叶",
hosts = hosts,
path = "/api/user/(\\d+)/mysekai/birthday-party/(\\d+)/delivery",
fileName = "mysekai_birthday"
fileName = "mysekai_birthday",
postAction = { result ->
Uploader.tryUpload(result)
}
)
private val CN_HOSTS = listOf("mkcn-prod-public-60001-1.dailygn.com")
@@ -51,6 +52,15 @@ object PredefinedProfiles {
"mkkorea-obt-prod01-https.bytedgame.com"
)
fun rewriteTwUrl(result: CaptureResult): CaptureResult {
val originalUrl = result.url
val rewrittenUrl = originalUrl.replace(
"mk-zian-obt-https.bytedgame.com",
"mk-zian-obt-cdn.bytedgame.com"
)
return result.copy(url = rewrittenUrl)
}
val all: List<CaptureProfile> = listOf(
// 国服不支持烤森
CaptureProfile(
@@ -71,7 +81,22 @@ object PredefinedProfiles {
CaptureProfile(
id = "tw",
name = "台服",
steps = listOf(suiteStep(TW_HOSTS), mysekaiStep(TW_HOSTS), mysekaiBirthday(TW_HOSTS))
steps = listOf(suiteStep(TW_HOSTS).apply {
postAction = { result ->
val rewrittenResult = rewriteTwUrl(result)
Uploader.tryUpload(rewrittenResult)
}
}, mysekaiStep(TW_HOSTS).apply {
postAction = { result ->
val rewrittenResult = rewriteTwUrl(result)
Uploader.tryUpload(rewrittenResult)
}
}, mysekaiBirthday(TW_HOSTS).apply {
postAction = { result ->
val rewrittenResult = rewriteTwUrl(result)
Uploader.tryUpload(rewrittenResult)
}
})
),
CaptureProfile(
id = "kr",