Compare commits
No commits in common. "33af28da8a5cc9144695fc1fea30ea4fd11ac123" and "56cf9061f082de0b1cc52e4871227041efed8b88" have entirely different histories.
33af28da8a
...
56cf9061f0
|
@ -93,14 +93,3 @@ upload=false
|
||||||
# Whether curlapi is enabled
|
# Whether curlapi is enabled
|
||||||
# curl {url}/curlapi/help for more info
|
# curl {url}/curlapi/help for more info
|
||||||
curlapi=true
|
curlapi=true
|
||||||
|
|
||||||
# Resources section
|
|
||||||
|
|
||||||
# Define your resources like this:
|
|
||||||
# [resources."org.name.logo"]
|
|
||||||
|
|
||||||
# Make sure that this path exists within the fileD filesystem
|
|
||||||
# path="/some/place"
|
|
||||||
|
|
||||||
# https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types
|
|
||||||
# mime="image/webp"
|
|
|
@ -5,4 +5,4 @@ cd /opt/code
|
||||||
cargo check
|
cargo check
|
||||||
cargo build
|
cargo build
|
||||||
|
|
||||||
cargo watch -w src -w templates -w static -w config -x run
|
cargo watch -w src -w templates -w static -x run
|
||||||
|
|
|
@ -19,10 +19,6 @@ impl ResourceCollection {
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get<T: Into<String>>(self: &Self, key: T) -> Option<&Resource> {
|
|
||||||
self.0.get(&key.into())
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||||
|
|
|
@ -148,14 +148,11 @@ impl FilesPolicy {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Branding {
|
impl Branding {
|
||||||
fn validate(self: &Self, conf: &Config) -> Result<(), String> {
|
fn validate(self: &Self) -> Result<(), String> {
|
||||||
if let Some(logo_id) = self.custom_logo.clone() {
|
if let Some(logo_path) = self.custom_logo.clone() {
|
||||||
if let Some(ref resources) = conf.resources {
|
let logo_path = Path::new(&logo_path);
|
||||||
if resources.get(&logo_id).is_none() {
|
if ! logo_path.is_file() {
|
||||||
return Err(format!("Brand logo is set to a non existant resource ({logo_id})"));
|
return Err("Config parameter branding.custom_logo is not a file. It must be a valid path that should be accessible from fileD's filesystem".into())
|
||||||
}
|
|
||||||
} else {
|
|
||||||
return Err("Brand logo specified but no resources found".into())
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
|
@ -180,11 +177,11 @@ impl Config {
|
||||||
|
|
||||||
pub fn validate(self: &Self) -> Result<(), String> {
|
pub fn validate(self: &Self) -> Result<(), String> {
|
||||||
self.files.validate()?;
|
self.files.validate()?;
|
||||||
|
self.brand.validate()?;
|
||||||
self.api .validate()?;
|
self.api .validate()?;
|
||||||
if let Some(resources) = self.resources.clone() {
|
if let Some(resources) = self.resources.clone() {
|
||||||
resources.validate()?;
|
resources.validate()?;
|
||||||
}
|
}
|
||||||
self.brand.validate(self)?;
|
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue