1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
|
/*
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 <metamuffin.org>
*/
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<String>,
#[serde(default = "login_expire")]
pub login_expire: i64,
#[serde(default)]
pub default_permission_set: PermissionSet,
#[serde(default)]
pub transcoder: TranscoderConfig,
}
#[rustfmt::skip]
#[derive(Debug, Deserialize, Serialize, Default)]
pub struct TranscoderConfig {
#[serde(default)] pub offer_avc: bool,
#[serde(default)] pub offer_hevc: bool,
#[serde(default)] pub offer_vp8: bool,
#[serde(default)] pub offer_vp9: bool,
#[serde(default)] pub offer_av1: bool,
#[serde(default)] pub enable_rkmpp: bool,
#[serde(default)] pub enable_rkrga: bool,
#[serde(default)] pub use_svtav1: bool,
#[serde(default)] pub use_rav1e: bool,
pub svtav1_preset: Option<u8>, // 0..=13, high is fast
pub rav1e_preset: Option<u8>, // 0..=10
pub aom_preset: Option<u8>, // 0..=8, high is fast
pub x264_preset: Option<String>,
}
#[derive(Serialize, Deserialize, Debug, Default)]
pub struct SecretsConfig {
#[serde(default)]
pub federation: HashMap<String, FederationAccount>,
#[serde(default)]
pub api: ApiSecrets,
#[serde(default)]
pub cookie_key: Option<String>,
#[serde(default)]
pub session_key: Option<String>,
#[serde(default)]
pub admin_password: Option<String>,
}
#[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<String>,
pub tvdb: Option<String>,
pub imdb: Option<String>,
pub omdb: Option<String>,
pub fanart_tv: Option<String>,
pub trakt: Option<String>,
}
fn login_expire() -> i64 {
60 * 60 * 24
}
fn max_in_memory_cache_size() -> usize {
200_000_000
}
fn return_true() -> bool {
true
}
|