/* This file is part of jellything (https://codeberg.org/metamuffin/jellything) which is licensed under the GNU Affero General Public License (version 3); see /COPYING. Copyright (C) 2025 metamuffin */ use crate::user::PermissionSet; use serde::{Deserialize, Serialize}; use std::{collections::HashMap, path::PathBuf}; #[derive(Debug, Deserialize, Serialize, Default)] pub struct GlobalConfig { pub hostname: String, pub brand: String, pub slogan: String, #[serde(default = "return_true")] pub tls: bool, pub asset_path: PathBuf, pub database_path: PathBuf, pub cache_path: PathBuf, pub media_path: PathBuf, pub secrets_path: PathBuf, #[serde(default = "max_in_memory_cache_size")] pub max_in_memory_cache_size: usize, #[serde(default)] pub admin_username: Option, #[serde(default = "login_expire")] pub login_expire: i64, #[serde(default)] pub default_permission_set: PermissionSet, #[serde(default)] pub encoders: EncoderPreferences, } #[derive(Debug, Deserialize, Serialize, Default)] pub struct EncoderPreferences { pub avc: Option, pub hevc: Option, pub vp8: Option, pub vp9: Option, pub av1: Option, } #[derive(Debug, Deserialize, Serialize)] #[serde(rename_all = "snake_case")] pub enum EncoderClass { Aom, Svt, X26n, Vpx, Vaapi, Rkmpp, } #[derive(Serialize, Deserialize, Debug, Default)] pub struct SecretsConfig { #[serde(default)] pub federation: HashMap, #[serde(default)] pub api: ApiSecrets, #[serde(default)] pub cookie_key: Option, #[serde(default)] pub session_key: Option, #[serde(default)] pub admin_password: Option, } #[derive(Serialize, Deserialize, Debug)] pub struct FederationAccount { pub username: String, pub password: String, #[serde(default = "return_true")] pub tls: bool, } #[derive(Serialize, Deserialize, Debug, Default)] pub struct ApiSecrets { pub tmdb: Option, pub tvdb: Option, pub imdb: Option, pub omdb: Option, pub fanart_tv: Option, pub trakt: Option, } fn login_expire() -> i64 { 60 * 60 * 24 } fn max_in_memory_cache_size() -> usize { 50_000_000 } fn return_true() -> bool { true }