From c2a9393ef15b86357afd793912f88f64b857a104 Mon Sep 17 00:00:00 2001 From: Mylloon Date: Wed, 26 Apr 2023 16:21:57 +0200 Subject: [PATCH] ask for owner name --- src/config.rs | 3 +++ src/routes/blog.rs | 10 +++++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/config.rs b/src/config.rs index 7dc9756..0b7c2cd 100644 --- a/src/config.rs +++ b/src/config.rs @@ -21,6 +21,8 @@ pub struct FileConfig { pub onion: Option, /// App name pub app_name: Option, + /// Name of website owner + pub name: Option, } impl FileConfig { @@ -55,6 +57,7 @@ impl FileConfig { lang: test(a.lang, d.lang), onion: test(a.onion, d.onion), app_name: test(a.app_name, d.app_name), + name: test(a.name, d.name), } } } diff --git a/src/routes/blog.rs b/src/routes/blog.rs index 6bd38fb..28faf00 100644 --- a/src/routes/blog.rs +++ b/src/routes/blog.rs @@ -196,13 +196,18 @@ fn build_rss(config: Config, info: ConnectionInfo) -> String { } let link_to_site = format!("{}://{}", info.scheme(), info.host()); + let author = if let (Some(mail), Some(name)) = (config.fc.mail, config.fc.name) { + Some(format!("{mail} ({name})")) + } else { + None + }; let channel = Channel { title: "Blog d'Anri".into(), link: link_to_site.to_owned(), description: "Un fil qui parle d'informatique notamment".into(), language: Some("fr".into()), - managing_editor: config.fc.mail.to_owned(), - webmaster: config.fc.mail, + managing_editor: author.to_owned(), + webmaster: author, pub_date: Some(Local::now().to_rfc2822()), categories: ["blog", "blogging", "write", "writing"] .iter() @@ -215,7 +220,6 @@ fn build_rss(config: Config, info: ConnectionInfo) -> String { docs: Some("https://www.rssboard.org/rss-specification".into()), image: Some(Image { url: format!("{}/icons/favicon-32x32.png", link_to_site), - title: "Favicon".into(), link: link_to_site.to_owned(), ..Image::default() }),