diff options
Diffstat (limited to 'server/src/api.rs')
| -rw-r--r-- | server/src/api.rs | 50 |
1 files changed, 23 insertions, 27 deletions
diff --git a/server/src/api.rs b/server/src/api.rs index 00a8f1d..fe68b1a 100644 --- a/server/src/api.rs +++ b/server/src/api.rs @@ -4,13 +4,9 @@ Copyright (C) 2026 metamuffin <metamuffin.org> */ use super::ui::error::MyResult; -use crate::helper::{accept::AcceptJson, language::AcceptLanguage, A}; -use jellycommon::{user::CreateSessionParams, NodeID}; -use jellylogic::{login::login_logic, node::get_nodes_modified_since, session::Session}; -use jellyui::locale::get_translation_table; -use rocket::{get, post, response::Redirect, serde::json::Json, Either}; -use serde_json::{json, Value}; -use std::collections::HashMap; +use crate::helper::A; +use rocket::{get, post, response::Redirect, serde::json::Json}; +use serde_json::{Value, json}; #[get("/api")] pub fn r_api_root() -> Redirect { @@ -22,26 +18,26 @@ pub fn r_version() -> &'static str { env!("CARGO_PKG_VERSION") } -#[get("/translations")] -pub fn r_translations( - lang: AcceptLanguage, - aj: AcceptJson, -) -> Either<Json<&'static HashMap<&'static str, &'static str>>, String> { - let AcceptLanguage(lang) = lang; - let table = get_translation_table(&lang); - if *aj { - Either::Left(Json(table)) - } else { - let mut s = String::new(); - for (k, v) in table { - s += k; - s += "="; - s += v; - s += "\n"; - } - Either::Right(s) - } -} +// #[get("/translations")] +// pub fn r_translations( +// lang: AcceptLanguage, +// aj: AcceptJson, +// ) -> Either<Json<&'static HashMap<&'static str, &'static str>>, String> { +// let AcceptLanguage(lang) = lang; +// let table = get_translation_table(&lang); +// if *aj { +// Either::Left(Json(table)) +// } else { +// let mut s = String::new(); +// for (k, v) in table { +// s += k; +// s += "="; +// s += v; +// s += "\n"; +// } +// Either::Right(s) +// } +// } #[post("/api/create_session", data = "<data>")] pub fn r_api_account_login(data: Json<CreateSessionParams>) -> MyResult<Value> { |