mirror of
https://github.com/scottlamb/moonfire-nvr.git
synced 2025-11-28 21:18:11 -05:00
make GET /api/ return current permissions
This is useful for e.g. deciding whether or not to present the user admin UI in navigation. As part of this change, I adjusted the casing in Permissions, and then all the toml stuff for consistency. Noted in changelog.
This commit is contained in:
@@ -21,6 +21,7 @@ fn default_ui_dir() -> PathBuf {
|
||||
/// Top-level configuration file object.
|
||||
#[derive(Debug, Deserialize)]
|
||||
#[serde(deny_unknown_fields)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct ConfigFile {
|
||||
pub binds: Vec<BindConfig>,
|
||||
|
||||
@@ -42,6 +43,7 @@ pub struct ConfigFile {
|
||||
/// Per-bind configuration.
|
||||
#[derive(Debug, Deserialize)]
|
||||
#[serde(deny_unknown_fields)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct BindConfig {
|
||||
/// The address to bind to.
|
||||
#[serde(flatten)]
|
||||
@@ -70,8 +72,8 @@ pub struct BindConfig {
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
#[serde(rename_all = "lowercase")]
|
||||
#[serde(deny_unknown_fields)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub enum AddressConfig {
|
||||
/// IPv4 address such as `0.0.0.0:8080` or `127.0.0.1:8080`.
|
||||
Ipv4(std::net::SocketAddrV4),
|
||||
|
||||
@@ -367,7 +367,7 @@ async fn inner(
|
||||
ui_dir: Some(&config.ui_dir),
|
||||
allow_unauthenticated_permissions: b
|
||||
.allow_unauthenticated_permissions
|
||||
.as_ref()
|
||||
.clone()
|
||||
.map(db::Permissions::from),
|
||||
trust_forward_hdrs: b.trust_forward_headers,
|
||||
time_zone_name: time_zone_name.clone(),
|
||||
|
||||
Reference in New Issue
Block a user