This commit is contained in:
JMARyA 2023-01-28 07:53:01 +01:00
parent f2b24d33e1
commit 6d55f0ff92
Signed by: jmarya
GPG key ID: 901B2ADDF27C2263
2 changed files with 6 additions and 10 deletions

View file

@ -17,10 +17,10 @@ fn read_json_file(f: &str) -> Option<Value> {
}
impl Config {
pub fn new() -> Config {
pub fn new() -> Self {
let v = read_json_file("./config/config.json").expect("could not read config file");
let c = read_json_file("./config/colors.json");
Config { root: v, color: c }
Self { root: v, color: c }
}
pub fn name(&self) -> Option<String> {

View file

@ -132,7 +132,7 @@ fn build_information_block(conf: &web::Data<config::Config>) -> String {
}
fn build_contact_block(conf: &web::Data<config::Config>) -> String {
if let Some(email) = conf.email() {
conf.email().map_or_else(String::new, |email| {
let pgp_key_message = if std::path::Path::new("./config/pub.key").exists() {
html! {
a href="/public_key" { "My PGP Key" };
@ -158,13 +158,11 @@ fn build_contact_block(conf: &web::Data<config::Config>) -> String {
}
}
.into_string()
} else {
String::new()
}
})
}
fn build_donation_block(conf: &web::Data<config::Config>) -> String {
if let Some(xmr_addr) = conf.xmr_address() {
conf.xmr_address().map_or_else(String::new, |xmr_addr| {
html! {
div class="container" style="margin-top: 20px" {
h1 {
@ -179,9 +177,7 @@ fn build_donation_block(conf: &web::Data<config::Config>) -> String {
}
}
.into_string()
} else {
String::new()
}
})
}
#[get("/")]