[-] Remove SDGA 1.65 nonce dedup

This commit is contained in:
Azalea
2026-08-12 05:43:59 +00:00
parent 7ba95f0b90
commit 6285bd3fd4
2 changed files with 0 additions and 12 deletions
@@ -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
)