mirror of
https://github.com/MewoLab/AquaDX.git
synced 2025-12-14 11:56:15 +08:00
[+] Login Alert for net and mai2
This commit is contained in:
@@ -19,10 +19,6 @@ import org.springframework.web.bind.annotation.RestController
|
||||
class BotProps {
|
||||
var enabled: Boolean = false
|
||||
var secret: String = ""
|
||||
|
||||
companion object {
|
||||
const val MINATO_CARD_EXT: Int = Int.MAX_VALUE - 2;
|
||||
}
|
||||
}
|
||||
|
||||
@RestController
|
||||
|
||||
@@ -8,6 +8,7 @@ import icu.samnyan.aqua.net.utils.PathProps
|
||||
import icu.samnyan.aqua.net.utils.SUCCESS
|
||||
import icu.samnyan.aqua.sega.general.dao.CardRepository
|
||||
import icu.samnyan.aqua.sega.general.model.Card
|
||||
import icu.samnyan.aqua.sega.general.model.CardStatus
|
||||
import icu.samnyan.aqua.sega.general.service.CardService
|
||||
import jakarta.servlet.http.HttpServletRequest
|
||||
import org.slf4j.LoggerFactory
|
||||
@@ -111,6 +112,8 @@ class UserRegistrar(
|
||||
?: (400 - "User not found")
|
||||
if (!hasher.matches(password, user.pwHash)) 400 - "Invalid password"
|
||||
|
||||
if (user.ghostCard.status == CardStatus.MIGRATED_TO_MINATO) 400 - "Placeholder"
|
||||
|
||||
// Check if email is verified
|
||||
if (!user.emailConfirmed && emailProps.enable) {
|
||||
// Check if last confirmation email was sent within a minute
|
||||
|
||||
@@ -125,10 +125,6 @@ class AimeDB(
|
||||
}
|
||||
|
||||
fun getCard(accessCode: String) = us.cardRepo.findByLuid(accessCode)()?.maybeGhost()?.let { card ->
|
||||
// If it's migrated to Minato, return the Minato card for 24 hours
|
||||
if (card.status == CardStatus.MIGRATED_TO_MINATO && card.accessTime.plusDays(1).isAfter(utcNow()))
|
||||
return BotProps.MINATO_CARD_EXT.long
|
||||
|
||||
// Update card access time and return the extId
|
||||
us.cardRepo.save(card.apply { accessTime = LocalDateTime.now() }).extId
|
||||
} ?: -1
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
package icu.samnyan.aqua.sega.maimai2
|
||||
|
||||
import ext.*
|
||||
import icu.samnyan.aqua.sega.general.model.CardStatus
|
||||
import icu.samnyan.aqua.sega.maimai2.model.UserRivalMusic
|
||||
import icu.samnyan.aqua.sega.maimai2.model.UserRivalMusicDetail
|
||||
import icu.samnyan.aqua.sega.maimai2.model.userdata.Mai2UserKaleidx
|
||||
@@ -55,12 +56,6 @@ fun Maimai2ServletController.initApis() {
|
||||
) }
|
||||
|
||||
"CreateToken" static { """{"Bearer":"meow"}""" }
|
||||
"UserLogin" static { mapOf(
|
||||
"returnCode" to 1, "loginCount" to 1,
|
||||
"lastLoginDate" to "2020-01-01 00:00:00.0",
|
||||
"consecutiveLoginCount" to 0, "loginId" to 1,
|
||||
"Bearer" to "meow", "bearer" to "meow"
|
||||
) }
|
||||
|
||||
"CMUpsertUserPrintlog" static { """{"returnCode":1,"orderId":"0","serialId":"FAKECARDIMAG12345678"}""" }
|
||||
|
||||
@@ -91,7 +86,7 @@ fun Maimai2ServletController.initApis() {
|
||||
val d = db.userData.findByCardExtId(uid)() ?: (404 - "User not found")
|
||||
val option = db.userOption.findSingleByUser_Card_ExtId(uid)()
|
||||
|
||||
mapOf(
|
||||
val res = mutableMapOf(
|
||||
"userId" to uid,
|
||||
"userName" to d.userName,
|
||||
"isLogin" to false,
|
||||
@@ -114,6 +109,32 @@ fun Maimai2ServletController.initApis() {
|
||||
"isInherit" to false,
|
||||
"banState" to d.banState
|
||||
)
|
||||
|
||||
if (d.card?.status == CardStatus.MIGRATED_TO_MINATO) {
|
||||
res["userName"] = "Migrated"
|
||||
res["dispRate"] = 1
|
||||
res["playerRating"] = 66564
|
||||
res["totalAwake"] = 7114
|
||||
}
|
||||
|
||||
res
|
||||
}
|
||||
|
||||
"UserLogin" {
|
||||
val d = db.userData.findByCardExtId(uid)() ?: (404 - "User not found")
|
||||
|
||||
val res = mutableMapOf(
|
||||
"returnCode" to 1, "loginCount" to 1,
|
||||
"lastLoginDate" to "2020-01-01 00:00:00.0",
|
||||
"consecutiveLoginCount" to 0, "loginId" to 1,
|
||||
"Bearer" to "meow", "bearer" to "meow"
|
||||
)
|
||||
|
||||
if (d.card?.status == CardStatus.MIGRATED_TO_MINATO) {
|
||||
res["returnCode"] = 0
|
||||
}
|
||||
|
||||
res
|
||||
}
|
||||
|
||||
"GetUserShopStock" {
|
||||
|
||||
Reference in New Issue
Block a user