[+] Anonce

This commit is contained in:
Azalea
2026-08-05 16:31:50 -04:00
parent 85544d3cee
commit fb6cc313f4
2 changed files with 11 additions and 0 deletions

View File

@@ -28,12 +28,21 @@ class UpsertUserAllHandler(
) : BaseHandler {
fun String.isValidUsername() = isNotBlank() && length <= 8
// For preventing duplicates: {loginDateTime: processed time}
val processed = mutableMapOf<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
if (processed.containsKey(userId)) return SUCCESS
processed[userId] = System.currentTimeMillis()
cleanupProcessed()
// If user is guest, just return OK response.
if ((userId and 281474976710657L) == 281474976710657L) return SUCCESS

View File

@@ -7,6 +7,8 @@ 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
)