39 lines
1.5 KiB
Rust
39 lines
1.5 KiB
Rust
/*
|
|
* Yggdrasil: Minecraft authentication server
|
|
* Copyright (C) 2023 0xf8.dev@proton.me
|
|
*
|
|
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
|
*
|
|
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
use serde_json::{json, Value};
|
|
use serde::{Deserialize, Serialize};
|
|
|
|
|
|
#[derive(Deserialize, Serialize, Debug, Clone)]
|
|
pub struct ProfileAttributes {
|
|
pub can_chat: bool,
|
|
pub can_play_multiplayer: bool,
|
|
pub can_play_realms: bool,
|
|
pub use_filter: bool,
|
|
}
|
|
|
|
impl ProfileAttributes {
|
|
pub fn to_json(&self) -> Value {
|
|
json!({
|
|
"privileges": {
|
|
"onlineChat": { "enabled": self.can_chat },
|
|
"multiplayerServer": { "enabled": self.can_play_multiplayer },
|
|
"multiplayerRealms": { "enabled": self.can_play_realms },
|
|
"telemetry": { "enabled": false },
|
|
},
|
|
"profanityFilterPreferences": {
|
|
"profanityFilterOn": self.use_filter
|
|
}
|
|
})
|
|
}
|
|
}
|