From 03964d3542bbd699d9990b2e69961d80d8163b6e Mon Sep 17 00:00:00 2001 From: Max Hohlfeld Date: Tue, 10 Jun 2025 09:15:27 +0200 Subject: [PATCH] refactor: add hostname to customizations --- web/src/endpoints/imprint.rs | 2 ++ web/src/main.rs | 1 + web/src/utils/app_customization.rs | 1 + web/src/utils/test_helper/test_context.rs | 1 + web/templates/imprint.html | 5 ++++- 5 files changed, 9 insertions(+), 1 deletion(-) diff --git a/web/src/endpoints/imprint.rs b/web/src/endpoints/imprint.rs index 7a2c0a2f..555959e4 100644 --- a/web/src/endpoints/imprint.rs +++ b/web/src/endpoints/imprint.rs @@ -7,6 +7,7 @@ use crate::utils::{ApplicationError, Customization, TemplateResponse}; #[template(path = "imprint.html")] struct ImprintTemplate { webmaster_mail: String, + hostname: String, } #[actix_web::get("/imprint")] @@ -15,6 +16,7 @@ pub async fn get_imprint( ) -> Result { let template = ImprintTemplate { webmaster_mail: customization.webmaster_email.clone(), + hostname: customization.hostname.clone(), }; Ok(template.to_response()?) diff --git a/web/src/main.rs b/web/src/main.rs index 0df2ff4c..6235e549 100644 --- a/web/src/main.rs +++ b/web/src/main.rs @@ -52,6 +52,7 @@ async fn main() -> anyhow::Result<()> { let mailer = Mailer::new(&config)?; let customization = Customization { webmaster_email: config.webmaster_email.clone(), + hostname: config.hostname.clone() }; handle_command(args.command, &pool, &mailer).await?; diff --git a/web/src/utils/app_customization.rs b/web/src/utils/app_customization.rs index 59b435f9..f7a4d608 100644 --- a/web/src/utils/app_customization.rs +++ b/web/src/utils/app_customization.rs @@ -1,4 +1,5 @@ #[derive(Clone)] pub struct Customization { + pub hostname: String, pub webmaster_email: String, } diff --git a/web/src/utils/test_helper/test_context.rs b/web/src/utils/test_helper/test_context.rs index b13e9a5f..1cd1e97d 100644 --- a/web/src/utils/test_helper/test_context.rs +++ b/web/src/utils/test_helper/test_context.rs @@ -32,6 +32,7 @@ impl DbTestContext { > { let customization = Customization { webmaster_email: self.config.webmaster_email.clone(), + hostname: self.config.hostname.clone() }; init_service(create_app( diff --git a/web/templates/imprint.html b/web/templates/imprint.html index 9fade65f..5b6243aa 100644 --- a/web/templates/imprint.html +++ b/web/templates/imprint.html @@ -54,7 +54,7 @@

Copyright

+

Copyright 2025 Max Hohlfeld

+

Brass ist freie Software nach GNU AGPLv3 Lizenz.

{% endblock %}