🔧 allow hiding the audit log on the relay
parent
734602244d
commit
2ccd5167d9
|
@ -143,6 +143,7 @@ pub mod file {
|
|||
pub scraper_keys: Option <Vec <ScraperKey>>,
|
||||
|
||||
pub news_url: Option <String>,
|
||||
pub hide_audit_log: Option <bool>,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -156,6 +157,7 @@ pub struct Config {
|
|||
pub servers: HashMap <String, file::Server>,
|
||||
pub scraper_keys: HashMap <String, ScraperKey>,
|
||||
pub news_url: Option <String>,
|
||||
pub hide_audit_log: bool,
|
||||
}
|
||||
|
||||
impl Default for Config {
|
||||
|
@ -167,6 +169,7 @@ impl Default for Config {
|
|||
servers: Default::default (),
|
||||
scraper_keys: Default::default (),
|
||||
news_url: None,
|
||||
hide_audit_log: false,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -195,6 +198,7 @@ impl TryFrom <file::Config> for Config {
|
|||
servers,
|
||||
scraper_keys,
|
||||
news_url: f.news_url,
|
||||
hide_audit_log: f.hide_audit_log.unwrap_or (false),
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
|
@ -433,6 +433,13 @@ async fn handle_audit_log (
|
|||
handlebars: Arc <Handlebars <'static>>
|
||||
) -> Result <Response <Body>, RequestError>
|
||||
{
|
||||
{
|
||||
let cfg = state.config.read ().await;
|
||||
if cfg.hide_audit_log {
|
||||
return Ok (error_reply (StatusCode::FORBIDDEN, "Forbidden")?);
|
||||
}
|
||||
}
|
||||
|
||||
let page = handle_audit_log_internal (state).await;
|
||||
|
||||
let s = handlebars.render ("audit_log", &page)?;
|
||||
|
|
Loading…
Reference in New Issue