mirror of
https://github.com/hykilpikonna/AquaDX.git
synced 2026-08-10 19:17:03 -05:00
[+] Anonce
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user