forked from mirrors/relay
Add optional footer blurb
This commit is contained in:
parent
a0195d94aa
commit
9133dd7688
4 changed files with 22 additions and 0 deletions
1
.env
1
.env
|
@ -2,4 +2,5 @@ HOSTNAME=localhost:8079
|
||||||
PORT=8079
|
PORT=8079
|
||||||
RESTRICTED_MODE=true
|
RESTRICTED_MODE=true
|
||||||
API_TOKEN=somesecretpassword
|
API_TOKEN=somesecretpassword
|
||||||
|
FOOTER_BLURB="Contact <a href=\"https://masto.asonix.dog/@asonix\">@asonix</a> for inquiries"
|
||||||
# OPENTELEMETRY_URL=http://localhost:4317
|
# OPENTELEMETRY_URL=http://localhost:4317
|
||||||
|
|
|
@ -100,6 +100,7 @@ TELEGRAM_TOKEN=secret
|
||||||
TELEGRAM_ADMIN_HANDLE=your_handle
|
TELEGRAM_ADMIN_HANDLE=your_handle
|
||||||
TLS_KEY=/path/to/key
|
TLS_KEY=/path/to/key
|
||||||
TLS_CERT=/path/to/cert
|
TLS_CERT=/path/to/cert
|
||||||
|
FOOTER_BLURB="Contact <a href=\"https://masto.asonix.dog/@asonix\">@asonix</a>
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Descriptions
|
#### 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
|
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`
|
##### `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
|
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
|
### Subscribing
|
||||||
Mastodon admins can subscribe to this relay by adding the `/inbox` route to their relay settings.
|
Mastodon admins can subscribe to this relay by adding the `/inbox` route to their relay settings.
|
||||||
|
|
|
@ -37,6 +37,7 @@ pub(crate) struct ParsedConfig {
|
||||||
api_token: Option<String>,
|
api_token: Option<String>,
|
||||||
tls_key: Option<PathBuf>,
|
tls_key: Option<PathBuf>,
|
||||||
tls_cert: Option<PathBuf>,
|
tls_cert: Option<PathBuf>,
|
||||||
|
footer_blurb: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
|
@ -56,6 +57,7 @@ pub struct Config {
|
||||||
telegram_admin_handle: Option<String>,
|
telegram_admin_handle: Option<String>,
|
||||||
api_token: Option<String>,
|
api_token: Option<String>,
|
||||||
tls: Option<TlsConfig>,
|
tls: Option<TlsConfig>,
|
||||||
|
footer_blurb: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
|
@ -112,6 +114,7 @@ impl std::fmt::Debug for Config {
|
||||||
.field("api_token", &"[redacted]")
|
.field("api_token", &"[redacted]")
|
||||||
.field("tls_key", &"[redacted]")
|
.field("tls_key", &"[redacted]")
|
||||||
.field("tls_cert", &"[redacted]")
|
.field("tls_cert", &"[redacted]")
|
||||||
|
.field("footer_blurb", &self.footer_blurb)
|
||||||
.finish()
|
.finish()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -135,6 +138,7 @@ impl Config {
|
||||||
.set_default("api_token", None as Option<&str>)?
|
.set_default("api_token", None as Option<&str>)?
|
||||||
.set_default("tls_key", None as Option<&str>)?
|
.set_default("tls_key", None as Option<&str>)?
|
||||||
.set_default("tls_cert", None as Option<&str>)?
|
.set_default("tls_cert", None as Option<&str>)?
|
||||||
|
.set_default("footer_blurb", None as Option<&str>)?
|
||||||
.add_source(Environment::default())
|
.add_source(Environment::default())
|
||||||
.build()?;
|
.build()?;
|
||||||
|
|
||||||
|
@ -172,6 +176,7 @@ impl Config {
|
||||||
telegram_admin_handle: config.telegram_admin_handle,
|
telegram_admin_handle: config.telegram_admin_handle,
|
||||||
api_token: config.api_token,
|
api_token: config.api_token,
|
||||||
tls,
|
tls,
|
||||||
|
footer_blurb: config.footer_blurb,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -214,6 +219,16 @@ impl Config {
|
||||||
Ok(Some((certs, key)))
|
Ok(Some((certs, key)))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub(crate) fn footer_blurb(&self) -> Option<crate::templates::Html<&str>> {
|
||||||
|
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 {
|
pub(crate) fn sled_path(&self) -> &PathBuf {
|
||||||
&self.sled_path
|
&self.sled_path
|
||||||
}
|
}
|
||||||
|
|
|
@ -84,6 +84,9 @@ templates::{info, instance, statics::index_css},
|
||||||
</section>
|
</section>
|
||||||
</main>
|
</main>
|
||||||
<footer>
|
<footer>
|
||||||
|
@if let Some(blurb) = config.footer_blurb() {
|
||||||
|
<div>@blurb</div>
|
||||||
|
}
|
||||||
<p>
|
<p>
|
||||||
The source code for this project can be found at
|
The source code for this project can be found at
|
||||||
<a href="@config.source_code()">@config.source_code()</a>
|
<a href="@config.source_code()">@config.source_code()</a>
|
||||||
|
|
Loading…
Reference in a new issue