diff --git a/.env b/.env index e8adc6f..b28a8c6 100644 --- a/.env +++ b/.env @@ -2,4 +2,5 @@ HOSTNAME=localhost:8079 PORT=8079 RESTRICTED_MODE=true API_TOKEN=somesecretpassword +FOOTER_BLURB="Contact @asonix for inquiries" # OPENTELEMETRY_URL=http://localhost:4317 diff --git a/README.md b/README.md index ed0957b..273f3bc 100644 --- a/README.md +++ b/README.md @@ -100,6 +100,7 @@ TELEGRAM_TOKEN=secret TELEGRAM_ADMIN_HANDLE=your_handle TLS_KEY=/path/to/key TLS_CERT=/path/to/cert +FOOTER_BLURB="Contact @asonix ``` #### Descriptions @@ -137,6 +138,8 @@ The handle of the telegram user allowed to administer the relay. There is no def Optional - This is specified if you are running the relay directly on the internet and have a TLS key to provide HTTPS for your relay ##### `TLS_CERT` Optional - This is specified if you are running the relay directly on the internet and have a TLS certificate chain to provide HTTPS for your relay +##### `FOOTER_BLURB` +Optional - Add custom notes in the footer of the page ### Subscribing Mastodon admins can subscribe to this relay by adding the `/inbox` route to their relay settings. diff --git a/src/config.rs b/src/config.rs index a03ea3d..b1da0cc 100644 --- a/src/config.rs +++ b/src/config.rs @@ -37,6 +37,7 @@ pub(crate) struct ParsedConfig { api_token: Option, tls_key: Option, tls_cert: Option, + footer_blurb: Option, } #[derive(Clone)] @@ -56,6 +57,7 @@ pub struct Config { telegram_admin_handle: Option, api_token: Option, tls: Option, + footer_blurb: Option, } #[derive(Clone)] @@ -112,6 +114,7 @@ impl std::fmt::Debug for Config { .field("api_token", &"[redacted]") .field("tls_key", &"[redacted]") .field("tls_cert", &"[redacted]") + .field("footer_blurb", &self.footer_blurb) .finish() } } @@ -135,6 +138,7 @@ impl Config { .set_default("api_token", None as Option<&str>)? .set_default("tls_key", None as Option<&str>)? .set_default("tls_cert", None as Option<&str>)? + .set_default("footer_blurb", None as Option<&str>)? .add_source(Environment::default()) .build()?; @@ -172,6 +176,7 @@ impl Config { telegram_admin_handle: config.telegram_admin_handle, api_token: config.api_token, tls, + footer_blurb: config.footer_blurb, }) } @@ -214,6 +219,16 @@ impl Config { Ok(Some((certs, key))) } + pub(crate) fn footer_blurb(&self) -> Option> { + if let Some(blurb) = &self.footer_blurb { + if !blurb.is_empty() { + return Some(crate::templates::Html(blurb)); + } + } + + None + } + pub(crate) fn sled_path(&self) -> &PathBuf { &self.sled_path } diff --git a/templates/index.rs.html b/templates/index.rs.html index 20c0390..fe5161b 100644 --- a/templates/index.rs.html +++ b/templates/index.rs.html @@ -84,6 +84,9 @@ templates::{info, instance, statics::index_css},