feat: Add public album routes and enhance authorization checks for media and albums
This commit is contained in:
@@ -15,7 +15,6 @@ pub struct DatabaseConfig {
|
||||
pub url: String,
|
||||
}
|
||||
|
||||
|
||||
#[derive(Deserialize, Clone, Debug)]
|
||||
#[serde(rename_all = "lowercase")]
|
||||
pub enum ThumbnailFormat {
|
||||
@@ -53,8 +52,12 @@ pub struct Config {
|
||||
pub thumbnail_config: Option<ThumbnailConfig>,
|
||||
}
|
||||
|
||||
fn default_max_upload_size() -> u32 { 100 }
|
||||
fn default_storage_quota() -> u64 { 10 }
|
||||
fn default_max_upload_size() -> u32 {
|
||||
100
|
||||
}
|
||||
fn default_storage_quota() -> u64 {
|
||||
10
|
||||
}
|
||||
fn default_allowed_sort_columns() -> Vec<String> {
|
||||
vec!["created_at".to_string(), "original_filename".to_string()]
|
||||
}
|
||||
@@ -78,20 +81,19 @@ pub fn load_config() -> CoreResult<AppConfig> {
|
||||
println!("Loaded config from {}", env_path.display());
|
||||
|
||||
let config = config::Config::builder()
|
||||
.add_source(config::Environment::default()
|
||||
.with_list_parse_key("allowed_sort_columns")
|
||||
.list_separator(",")
|
||||
.try_parsing(true)
|
||||
.separator("__")
|
||||
)
|
||||
.add_source(
|
||||
config::Environment::default()
|
||||
.with_list_parse_key("allowed_sort_columns")
|
||||
.list_separator(",")
|
||||
.try_parsing(true)
|
||||
.separator("__"),
|
||||
)
|
||||
.build()
|
||||
.map_err(|e| CoreError::Config(format!("Failed to build config: {}", e)))?;
|
||||
|
||||
|
||||
let config: Config = config
|
||||
.try_deserialize()
|
||||
.map_err(|e| CoreError::Config(format!("Failed to deserialize config: {}", e)))?;
|
||||
println!("Built config from environment variables. Contents: {:?}", config);
|
||||
|
||||
|
||||
Ok(AppConfig {
|
||||
database: DatabaseConfig {
|
||||
@@ -107,4 +109,4 @@ pub fn load_config() -> CoreResult<AppConfig> {
|
||||
allowed_sort_columns: Some(config.allowed_sort_columns),
|
||||
thumbnail_config: config.thumbnail_config,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user