Make config username + password fields private

This commit is contained in:
Neshura 2023-12-30 00:22:21 +01:00
parent 9cca302018
commit ecc05a2812
Signed by: Neshura
GPG key ID: B6983AAA6B9A7A6C

View file

@ -1,11 +1,12 @@
use lemmy_api_common::sensitive::Sensitive;
use serde_derive::{Deserialize, Serialize}; use serde_derive::{Deserialize, Serialize};
use crate::config::PostBody::Description; use crate::config::PostBody::Description;
#[derive(Serialize, Deserialize, Clone, Debug)] #[derive(Serialize, Deserialize, Clone, Debug)]
pub(crate) struct Config { pub(crate) struct Config {
pub(crate) instance: String, pub(crate) instance: String,
pub(crate) username: String, username: String,
pub(crate) password: String, password: String,
pub(crate) status_post_url: Option<String>, pub(crate) status_post_url: Option<String>,
pub(crate) config_reload_seconds: u32, pub(crate) config_reload_seconds: u32,
pub(crate) protected_communities: Vec<String>, pub(crate) protected_communities: Vec<String>,
@ -38,6 +39,14 @@ impl Config {
}); });
cfg cfg
} }
pub(crate) fn get_username(&self) -> Sensitive<String> {
Sensitive::new(self.username.clone())
}
pub(crate) fn get_password(&self) -> Sensitive<String> {
Sensitive::new(self.password.clone())
}
} }
impl Default for Config { impl Default for Config {