robespierre_models/
core.rs

1/// Data about a revolt instance obtained by
2/// making a `GET /` on the api.
3#[derive(serde::Deserialize, Clone)]
4#[serde(deny_unknown_fields)]
5pub struct RevoltConfiguration {
6    pub revolt: String,
7    pub features: RevoltInstanceFeatures,
8    pub ws: String,
9    pub app: String,
10    pub vapid: String,
11}
12
13/// Data about Autumn (file server microservice).
14#[derive(serde::Deserialize, Clone)]
15#[serde(transparent)]
16#[serde(deny_unknown_fields)]
17pub struct Autumn(EnabledUrl);
18
19impl Autumn {
20    /// Is Autumn enabled?
21    pub fn is_enabled(&self) -> bool {
22        self.0.enabled
23    }
24
25    /// Get the url
26    pub fn url(&self) -> &String {
27        &self.0.url
28    }
29}
30
31/// Data about January (image proxy and embed generator).
32#[derive(serde::Deserialize, Clone)]
33#[serde(transparent)]
34#[serde(deny_unknown_fields)]
35pub struct January(EnabledUrl);
36
37impl January {
38    /// Is January enabled?
39    pub fn is_enabled(&self) -> bool {
40        self.0.enabled
41    }
42
43    /// Get the url
44    pub fn url(&self) -> &String {
45        &self.0.url
46    }
47}
48
49/// Data about Voso (legacy voice server).
50#[derive(serde::Deserialize, Clone)]
51#[serde(transparent)]
52#[serde(deny_unknown_fields)]
53pub struct Voso(EnabledUrlWs);
54
55impl Voso {
56    /// Is voso enabled?
57    pub fn is_enabled(&self) -> bool {
58        self.0.enabled
59    }
60
61    /// Get the url
62    pub fn url(&self) -> &String {
63        &self.0.url
64    }
65
66    /// Get the ws url.
67    pub fn ws_url(&self) -> &String {
68        &self.0.ws
69    }
70}
71
72#[derive(serde::Deserialize, Clone)]
73#[serde(deny_unknown_fields)]
74struct EnabledUrl {
75    enabled: bool,
76    url: String,
77}
78
79#[derive(serde::Deserialize, Clone)]
80#[serde(deny_unknown_fields)]
81struct EnabledUrlWs {
82    enabled: bool,
83    url: String,
84    ws: String,
85}
86
87/// Features
88
89#[derive(serde::Deserialize, Clone)]
90#[serde(deny_unknown_fields)]
91pub struct RevoltInstanceFeatures {
92    // pub registration: bool,
93    pub captcha: CaptchaInfo,
94    /// Uses email verification?
95    pub email: bool,
96    /// Is invite only?
97    pub invite_only: bool,
98    /// Autumn (file server microservice).
99    pub autumn: Autumn,
100    /// January (image proxy and embed generator)
101    pub january: January,
102    /// Voso (legacy voice server).
103    pub voso: Voso,
104}
105
106/// Captcha feature
107#[derive(serde::Deserialize, Clone)]
108#[serde(deny_unknown_fields)]
109pub struct CaptchaInfo {
110    /// Whether it is enabled or not
111    pub enabled: bool,
112    /// The captcha key
113    pub key: String,
114}