mirror of
https://github.com/MewoLab/AquaDX.git
synced 2026-09-22 22:38:14 +03:00
[-] Remove SDGA 1.65 nonce dedup
This commit is contained in:
@@ -28,22 +28,12 @@ class UpsertUserAllHandler(
|
||||
) : BaseHandler {
|
||||
fun String.isValidUsername() = isNotBlank() && length <= 8
|
||||
|
||||
// For preventing duplicates: {nonce: processed time}
|
||||
val processed = mutableMapOf<Pair<Long, Long>, Long>()
|
||||
fun cleanupProcessed() = processed.entries.removeIf { System.currentTimeMillis() - it.value > 5 * 60 * 1000 }
|
||||
|
||||
@Throws(JacksonException::class)
|
||||
override fun handle(request: Map<String, Any>): Any? {
|
||||
val upsertUserAll = mapper.convert(request, Mai2UpsertUserAll::class.java)
|
||||
val userId = upsertUserAll.userId
|
||||
val req = upsertUserAll.upsertUserAll
|
||||
|
||||
// Check if the request has been processed before
|
||||
val nonce = Pair(userId, upsertUserAll.loginDateTime)
|
||||
if (processed.containsKey(nonce)) return SUCCESS
|
||||
processed[nonce] = System.currentTimeMillis()
|
||||
cleanupProcessed()
|
||||
|
||||
// If user is guest, just return OK response.
|
||||
if ((userId and 281474976710657L) == 281474976710657L) return SUCCESS
|
||||
|
||||
|
||||
@@ -7,8 +7,6 @@ class Mai2UpsertUserAll(
|
||||
var userId: Long,
|
||||
var upsertUserAll: Mai2UserAll,
|
||||
|
||||
var loginDateTime: Long = 0, // Nonce, sort of
|
||||
|
||||
var userPlaylogList: List<Mai2UserPlaylog>? = null, // SDGA 1.65 / SDGB 1.53
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user