aboutsummaryrefslogtreecommitdiff
path: root/server/src/routes/api.rs
diff options
context:
space:
mode:
Diffstat (limited to 'server/src/routes/api.rs')
-rw-r--r--server/src/routes/api.rs38
1 files changed, 38 insertions, 0 deletions
diff --git a/server/src/routes/api.rs b/server/src/routes/api.rs
new file mode 100644
index 0000000..d83d8e3
--- /dev/null
+++ b/server/src/routes/api.rs
@@ -0,0 +1,38 @@
+/*
+ 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) 2026 metamuffin <metamuffin.org>
+*/
+
+use rocket::{get, response::Redirect};
+
+#[get("/api")]
+pub fn r_api_root() -> Redirect {
+ Redirect::moved("https://jellything.metamuffin.org/book/api.html#jellything-http-api")
+}
+
+#[get("/version")]
+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)
+// }
+// }