[O] Don't expose all fields

pull/22/head
Azalea 2024-03-06 00:35:44 -05:00
parent 94c1974d2f
commit 2a10471e0b
3 changed files with 12 additions and 3 deletions

View File

@ -76,6 +76,16 @@ class AquaNetUser(
var keychipSessions: MutableList<KeychipSession> = mutableListOf(), var keychipSessions: MutableList<KeychipSession> = mutableListOf(),
) : Serializable { ) : Serializable {
val computedName get() = displayName.ifEmpty { username } val computedName get() = displayName.ifEmpty { username }
val publicFields get() = mapOf(
"username" to username,
"displayName" to displayName,
"country" to country,
"regTime" to regTime,
"profileLocation" to profileLocation,
"profileBio" to profileBio,
"profilePicture" to profilePicture,
)
} }
@Repository("AquaNetUserRepository") @Repository("AquaNetUserRepository")

View File

@ -2,7 +2,6 @@ package icu.samnyan.aqua.net.games
import ext.API import ext.API
import ext.RP import ext.RP
import icu.samnyan.aqua.net.db.AquaNetUser
import icu.samnyan.aqua.net.utils.IGenericGamePlaylog import icu.samnyan.aqua.net.utils.IGenericGamePlaylog
data class TrendOut(val date: String, val rating: Int, val plays: Int) data class TrendOut(val date: String, val rating: Int, val plays: Int)
@ -13,7 +12,7 @@ data class GenericGameSummary(
val name: String, val name: String,
val iconId: Int, val iconId: Int,
val aquaUser: AquaNetUser?, val aquaUser: Map<String, Any?>?,
val serverRank: Long, val serverRank: Long,
val accuracy: Double, val accuracy: Double,

View File

@ -105,7 +105,7 @@ fun genericUserSummary(
return GenericGameSummary( return GenericGameSummary(
name = user.userName, name = user.userName,
iconId = user.iconId, iconId = user.iconId,
aquaUser = card.aquaUser, aquaUser = card.aquaUser?.publicFields,
serverRank = userDataRepo.getRanking(user.playerRating), serverRank = userDataRepo.getRanking(user.playerRating),
accuracy = plays.acc(), accuracy = plays.acc(),
rating = user.playerRating, rating = user.playerRating,