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
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
mod custom;

#[derive(Debug, serde::Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct Config {
    pub instance: InstanceSummary,
    pub search: Search,
    pub plugin: Plugins,
    pub theme: Themes,
    pub email: Enabled,
    pub contact_form: Enabled,
    pub server_version: String,
    pub server_commit: String,
    pub signup: Signup,
    pub transcoding: Transcoding,
    pub live: Live,
    pub import: Import,
    pub auto_blacklist: AutoBlacklist,
    pub avatar: Avatar,
    pub video: Video,
    pub video_caption: VideoCaption,
    pub user: User,
    pub trending: Trending,
    pub tracker: Enabled,
    pub broadcast_message: BroadcastMessage,
}

#[derive(Debug, serde::Deserialize)]
pub struct Enabled {
    pub enabled: bool,
}

#[derive(Debug, serde::Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct InstanceSummary {
    pub name: String,
    pub short_description: String,
    #[serde(rename = "isNSFW")]
    pub is_nsfw: bool,
    #[serde(rename = "defaultNSFWPolicy")]
    pub default_nsfw_poliy: String,
    pub default_client_route: String,
    pub customizations: Customizations,
}

#[derive(Debug, serde::Deserialize)]
pub struct Customizations {
    pub javascript: String,
    pub css: String,
}

#[derive(Debug, serde::Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct Search {
    pub remote_uri: RemoteUri,
    pub search_index: SearchIndex,
}

#[derive(Debug, serde::Deserialize)]
pub struct RemoteUri {
    pub users: bool,
    pub anonymous: bool,
}

#[derive(Debug, serde::Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct SearchIndex {
    pub enabled: bool,
    pub url: String,
    pub disable_local_search: bool,
    pub is_default_search: bool,
}

#[derive(Debug, serde::Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct Plugins {
    pub registered: Vec<Plugin>,
    pub registered_external_auths: Vec<RegisteredExternalAuthConfig>,
    pub registered_id_and_pass_auths: Vec<RegisteredIdAndPassAuthConfig>,
}

#[derive(Debug, serde::Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct Plugin {
    pub name: String,
    pub version: String,
    pub description: String,
    pub client_scripts: std::collections::HashMap<String, ClientScript>,
}

#[derive(Debug, serde::Deserialize)]
pub struct ClientScript {
    pub script: String,
    pub scopes: Vec<String>,
}

#[derive(Debug, serde::Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct RegisteredExternalAuthConfig {
    #[serde(rename = "npmName")]
    pub npm_name: String,
    pub name: String,
    pub version: String,
    pub auth_name: String,
    pub auth_display_name: String,
}

#[derive(Debug, serde::Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct RegisteredIdAndPassAuthConfig {
    #[serde(rename = "npmName")]
    pub npm_name: String,
    pub name: String,
    pub version: String,
    pub auth_name: String,
    pub weight: String,
}

#[derive(Debug, serde::Deserialize)]
pub struct Themes {
    pub registered: Vec<Theme>,
    pub default: String,
}

#[derive(Debug, serde::Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct Theme {
    pub name: String,
    pub version: String,
    pub css: Vec<String>,
    pub client_scripts: ClientScript,
}

#[derive(Debug, serde::Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct Signup {
    pub allowed: bool,
    #[serde(rename = "allowedForCurrentIP")]
    pub allowed_for_current_ip: bool,
    pub requires_email_verification: bool,
}

#[derive(Debug, serde::Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct Transcoding {
    pub hls: Enabled,
    pub webtorrent: Enabled,
    pub enabled_resolutions: Vec<u32>,
    pub profile: String,
    pub available_profiles: Vec<String>,
}

#[derive(Debug, serde::Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct Live {
    pub enabled: bool,
    pub allow_replay: bool,
    pub max_duration: i32,
    pub max_instance_lives: i32,
    pub max_user_lives: i32,
    pub transcoding: LiveTranscoding,
    pub rtmp: Rtmp,
}

#[derive(Debug, serde::Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct LiveTranscoding {
    pub enabled: bool,
    pub enabled_resolutions: Vec<u32>,
    pub profile: String,
    pub available_profiles: Vec<String>,
}

#[derive(Debug, serde::Deserialize)]
pub struct Rtmp {
    pub port: u32,
}

#[derive(Debug, serde::Deserialize)]
pub struct Import {
    pub videos: Videos,
}

#[derive(Debug, serde::Deserialize)]
pub struct Videos {
    pub http: Enabled,
    pub torrent: Enabled,
}

#[derive(Debug, serde::Deserialize)]
pub struct AutoBlacklist {
    pub videos: AutoBlacklistVideos,
}

#[derive(Debug, serde::Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct AutoBlacklistVideos {
    pub of_users: Enabled,
}

#[derive(Debug, serde::Deserialize)]
pub struct Avatar {
    pub file: File,
}

#[derive(Debug, serde::Deserialize)]
pub struct File {
    #[serde(default)]
    pub size: Size,
    pub extensions: Vec<String>,
}

#[derive(Debug, Default, serde::Deserialize)]
pub struct Size {
    pub max: u64,
}

#[derive(Debug, serde::Deserialize)]
pub struct Video {
    pub image: File,
    pub file: File,
}

#[derive(Debug, serde::Deserialize)]
pub struct VideoCaption {
    pub file: File,
}

#[derive(Debug, serde::Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct User {
    pub video_quota: i64,
    pub video_quota_daily: i64,
}

#[derive(Debug, serde::Deserialize)]
pub struct Trending {
    pub videos: TrendingVideo,
}

#[derive(Debug, serde::Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct TrendingVideo {
    pub interval_days: u32,
    pub algorithms: Algorithms,
}

#[derive(Debug, serde::Deserialize)]
pub struct Algorithms {
    pub enabled: Vec<String>,
    pub default: String,
}

#[derive(Debug, serde::Deserialize)]
pub struct BroadcastMessage {
    pub enabled: bool,
    pub message: String,
    pub level: String,
    pub dismissable: bool,
}

#[derive(Debug, serde::Deserialize)]
pub struct About {
    pub instance: Instance,
}

#[derive(Debug, serde::Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct Instance {
    pub name: String,
    pub short_description: String,
    pub description: String,
    pub terms: String,
    pub code_of_conduct: String,
    pub hardware_information: String,
    pub creation_reason: String,
    pub moderation_information: String,
    pub administrator: String,
    pub maintenance_lifetime: String,
    pub business_model: String,
    pub languages: Vec<String>,
    pub categories: Vec<String>,
}

#[derive(Debug, serde::Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct Custom {
    pub instance: Instance,
    pub theme: custom::Theme,
    pub services: std::collections::HashMap<String, custom::Service>,
    pub cache: custom::Cache,
    pub signup: custom::Signup,
    pub admin: custom::Admin,
    pub contact_form: Enabled,
    pub user: User,
    pub transcoding: custom::Transcoding,
    pub live: custom::Live,
    pub import: custom::Import,
    pub trending: custom::Trending,
    pub auto_blacklist: AutoBlacklist,
    pub followers: custom::Followers,
    pub followings: custom::Followings,
    pub broadcast_message: BroadcastMessage,
    pub search: Search,
}