move branding options to another field
This commit is contained in:
parent
7c3aab8515
commit
6a95446ebe
|
@ -37,6 +37,11 @@ file_del_timeout=1800
|
||||||
# to upload plain text files
|
# to upload plain text files
|
||||||
# type_blacklist=[ "text/plain" ]
|
# type_blacklist=[ "text/plain" ]
|
||||||
|
|
||||||
|
|
||||||
|
# Branding settings:
|
||||||
|
# instance name, logo, motto, etc
|
||||||
|
[brand]
|
||||||
|
|
||||||
# Name of the instance.
|
# Name of the instance.
|
||||||
# Change it to fit your website's image
|
# Change it to fit your website's image
|
||||||
instance_name="blek! File"
|
instance_name="blek! File"
|
||||||
|
|
|
@ -32,14 +32,6 @@ pub struct FilesPolicy {
|
||||||
/// Backlisted file types
|
/// Backlisted file types
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
type_blacklist: Option<Vec<String>>,
|
type_blacklist: Option<Vec<String>>,
|
||||||
|
|
||||||
/// Instance name
|
|
||||||
#[serde(default)]
|
|
||||||
instance_name: String,
|
|
||||||
|
|
||||||
/// Instance URL (not the bind URL). Must be Some(...)
|
|
||||||
#[serde(default)]
|
|
||||||
instance_url: Option<String>
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for FilesPolicy {
|
impl Default for FilesPolicy {
|
||||||
|
@ -52,14 +44,38 @@ impl Default for FilesPolicy {
|
||||||
file_del_timeout: 1800,
|
file_del_timeout: 1800,
|
||||||
type_whitelist: None,
|
type_whitelist: None,
|
||||||
type_blacklist: None,
|
type_blacklist: None,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||||
|
pub struct Branding {
|
||||||
|
/// Instance name
|
||||||
|
#[serde(default)]
|
||||||
|
instance_name: String,
|
||||||
|
|
||||||
|
/// Instance URL (not the bind URL). Must be Some(...)
|
||||||
|
#[serde(default)]
|
||||||
|
instance_url: Option<String>
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Default for Branding {
|
||||||
|
fn default() -> Self {
|
||||||
|
Branding {
|
||||||
instance_name: "blek! File".into(),
|
instance_name: "blek! File".into(),
|
||||||
instance_url: None
|
instance_url: None,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl FilesPolicy {
|
impl FilesPolicy {
|
||||||
pub fn validate(self: &Self) -> Result<(), String> {
|
pub fn validate(self: &Self) -> Result<(), String> {
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Branding {
|
||||||
|
fn validate(self: &Self) -> Result<(), String> {
|
||||||
if self.instance_url.is_none() {
|
if self.instance_url.is_none() {
|
||||||
return Err("Instance url must not be empty!".into());
|
return Err("Instance url must not be empty!".into());
|
||||||
}
|
}
|
||||||
|
@ -69,13 +85,16 @@ impl FilesPolicy {
|
||||||
|
|
||||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||||
pub struct Config {
|
pub struct Config {
|
||||||
files: FilesPolicy
|
files: FilesPolicy,
|
||||||
|
brand: Branding
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Config {
|
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()?;
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue