Skip to content

Commit f1dd9f8

Browse files
committed
👽️(wayzer/map/resourceHelper) 更新后端API
1 parent fadcc5d commit f1dd9f8

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

scripts/wayzer/map/resourceHelper.kts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,13 +83,13 @@ MapRegistry.register(this, object : MapProvider() {
8383
override suspend fun findById(id: Int, reply: ((PlaceHoldString) -> Unit)?): MapInfo? {
8484
if (id !in 10000..99999) return null
8585
try {
86-
val info = httpGet("$webRoot/maps/thread/$id/latest")
86+
val info = httpGet("$webRoot/maps/$id.json")
8787
.let { Jval.read(it.toString(Charsets.UTF_8)) }
8888
val mode = info.getString("mode", "unknown")
8989
return MapInfo(
9090
this, id,
9191
Gamemode.all.find { it.name.equals(mode, ignoreCase = true) } ?: Gamemode.survival,
92-
meta = info.get("tags").toStringMap() + ("hash" to info.getString("hash")),
92+
meta = info.get("tags").toStringMap(),
9393
)
9494
} catch (e: Exception) {
9595
logger.log(Level.WARNING, "Fail to findById($id)", e)
@@ -98,8 +98,7 @@ MapRegistry.register(this, object : MapProvider() {
9898
}
9999

100100
override suspend fun lazyGetMap(info: MapInfo): mindustry.maps.Map {
101-
val hash = info.meta["hash"] ?: info.meta["latest"] ?: error("Not set hash or latest")
102-
val bs = runBlocking { httpGet("$webRoot/maps/$hash.msav", retry = 3) }
101+
val bs = runBlocking { httpGet("$webRoot/maps/${info.id}.msav", retry = 3) }
103102
val fi = object : Fi("BYTES.msav") {
104103
override fun read(): InputStream {
105104
return ByteArrayInputStream(bs)

0 commit comments

Comments
 (0)