refactor: add hostname to customizations

This commit is contained in:
Max Hohlfeld 2025-06-10 09:15:27 +02:00
parent 2774c6e48a
commit 03964d3542
5 changed files with 9 additions and 1 deletions

View File

@ -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<impl Responder, ApplicationError> {
let template = ImprintTemplate {
webmaster_mail: customization.webmaster_email.clone(),
hostname: customization.hostname.clone(),
};
Ok(template.to_response()?)

View File

@ -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?;

View File

@ -1,4 +1,5 @@
#[derive(Clone)]
pub struct Customization {
pub hostname: String,
pub webmaster_email: String,
}

View File

@ -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(

View File

@ -54,7 +54,7 @@
</p>
<ul>
<li>Vor- und Nachname z.B. <code>Max Mustermann</code></li>
<li>E-Mail Adresse z.B. <code>max.mustermann@brasiwa-leipzig.de</code></li>
<li>E-Mail Adresse z.B. <code>max.mustermann@{{ hostname }}</code></li>
<li>Funktion für Brandsicherheitswachen z.B. <code>Wachhabender</code></li>
<li>Brandsicherheitswachbereich z.B. <code>Bereich Ost</code></li>
<li>Zeitpunkt deines letzten Logins z.B. <code>2021-06-11 09:40:47</code></li>
@ -72,6 +72,9 @@
</ul>
<h1>Copyright</h1>
<p>Copyright 2025 Max Hohlfeld</p>
<p>Brass ist freie Software nach <a href="https://www.gnu.org/licenses/agpl-3.0.en.html#license-text"
target="_blank">GNU AGPLv3</a> Lizenz.</p>
</section>
{% endblock %}