[Add] Markdown viewer & Document loading

Todo: Track accepted Version & Hash of accepted document
This commit is contained in:
Alex Emmet 2026-02-02 23:29:57 +01:00
commit 53a057c6e1
8 changed files with 591 additions and 32 deletions

39
src/terms/terms_getter.rs Normal file
View file

@ -0,0 +1,39 @@
#[derive(Clone)]
pub enum Type {
EULA,
TOS,
PP,
}
impl Type {
pub fn to_str(&self) -> &str {
match self {
Self::EULA => "eula",
Self::TOS => "tos",
Self::PP => "pp",
}
}
pub fn to_string(&self) -> String {
match self {
Self::EULA => "End User License Agreement".to_string(),
Self::TOS => "Terms of Service".to_string(),
Self::PP => "Privacy Policy".to_string(),
}
}
}
pub fn get_link(terms_type: Type) -> String {
format!("https://legal.tensamin.net/{}/", terms_type.to_str())
}
pub async fn get_terms(terms_type: Type) -> Option<String> {
let body = reqwest::get(format!(
"https://legal.tensamin.net/api/text/{}/",
terms_type.to_str()
))
.await
.ok()?
.text()
.await
.ok()?;
Some(body)
}