forked from Cookies_Github_mirror/AquaDX
[O] Hash user ids
This commit is contained in:
@@ -64,6 +64,7 @@ class FutariLobby(paths: PathProps) {
|
||||
recruits[d.ip] = RecruitRecord(d.RecruitInfo)
|
||||
|
||||
if (!exists) log(d, "StartRecruit")
|
||||
d.RecruitInfo.MechaInfo.UserIDs = d.RecruitInfo.MechaInfo.UserIDs.map { it.str.hashToUInt().toLong() }
|
||||
}
|
||||
|
||||
@API("recruit/finish")
|
||||
|
||||
@@ -11,7 +11,7 @@ data class MechaInfo(
|
||||
val IpAddress: UInt,
|
||||
val MusicID: Int,
|
||||
val Entrys: List<Bool>,
|
||||
val UserIDs: List<Long>,
|
||||
var UserIDs: List<Long>,
|
||||
val UserNames: List<String>,
|
||||
val IconIDs: List<Int>,
|
||||
val FumenDifs: List<Int>,
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package icu.samnyan.aqua.sega.maimai2.worldslink
|
||||
|
||||
import ext.logger
|
||||
import ext.md5
|
||||
import ext.millis
|
||||
import ext.thread
|
||||
import java.io.BufferedReader
|
||||
@@ -10,7 +11,6 @@ import java.io.OutputStreamWriter
|
||||
import java.net.ServerSocket
|
||||
import java.net.Socket
|
||||
import java.net.SocketTimeoutException
|
||||
import java.security.MessageDigest
|
||||
import java.util.concurrent.ConcurrentHashMap
|
||||
import java.util.concurrent.locks.ReentrantLock
|
||||
import kotlin.collections.set
|
||||
@@ -110,14 +110,14 @@ fun ActiveClient.handle(msg: Msg) {
|
||||
}
|
||||
}
|
||||
|
||||
fun hashStringToUInt(input: String) = MessageDigest.getInstance("MD5").digest(input.toByteArray()).let {
|
||||
fun String.hashToUInt() = md5().let {
|
||||
((it[0].toUInt() and 0xFFu) shl 24) or
|
||||
((it[1].toUInt() and 0xFFu) shl 16) or
|
||||
((it[2].toUInt() and 0xFFu) shl 8) or
|
||||
(it[3].toUInt() and 0xFFu)
|
||||
}
|
||||
|
||||
fun keychipToStubIp(keychip: String) = hashStringToUInt(keychip)
|
||||
fun keychipToStubIp(keychip: String) = keychip.hashToUInt()
|
||||
|
||||
// Keychip ID to Socket
|
||||
val clients = ConcurrentHashMap<UInt, ActiveClient>()
|
||||
|
||||
@@ -71,7 +71,7 @@ class WaccaServer {
|
||||
""""maintNoticeTime":0,"maintNotPlayableTime":0,"maintStartTime":0,"params":$paramsJson}"""
|
||||
|
||||
return ResponseEntity.ok().headers(
|
||||
"X-Wacca-Hash" to resp.md5(),
|
||||
"X-Wacca-Hash" to resp.md5().hexStr,
|
||||
"Content-Type" to "application/json; charset=utf-8"
|
||||
).body(resp)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user