aboutsummaryrefslogtreecommitdiff
path: root/server/src/ui/mod.rs
diff options
context:
space:
mode:
Diffstat (limited to 'server/src/ui/mod.rs')
-rw-r--r--server/src/ui/mod.rs79
1 files changed, 36 insertions, 43 deletions
diff --git a/server/src/ui/mod.rs b/server/src/ui/mod.rs
index 92b93fe..55fad6a 100644
--- a/server/src/ui/mod.rs
+++ b/server/src/ui/mod.rs
@@ -4,58 +4,51 @@
Copyright (C) 2026 metamuffin <metamuffin.org>
*/
use error::MyResult;
-use home::rocket_uri_macro_r_home;
-use rocket::{
- Either,
- futures::FutureExt,
- get,
- response::{Redirect, content::RawHtml},
-};
-use std::{future::Future, pin::Pin};
-use tokio::{
- fs::{File, read_to_string},
- io::AsyncRead,
-};
+use rocket::{futures::FutureExt, get};
+use std::{future::Future, pin::Pin, sync::Arc};
+use tokio::{fs::File, io::AsyncRead};
+
+use crate::State;
pub mod account;
-pub mod admin;
+// pub mod admin;
pub mod assets;
pub mod error;
-pub mod home;
-pub mod items;
+// pub mod home;
+// pub mod items;
pub mod node;
-pub mod player;
-pub mod search;
-pub mod stats;
+// pub mod player;
+// pub mod search;
+// pub mod stats;
pub mod style;
-#[get("/")]
-pub async fn r_index(
- lang: AcceptLanguage,
- sess: Option<A<Session>>,
-) -> MyResult<Either<Redirect, RawHtml<String>>> {
- let AcceptLanguage(lang) = lang;
- if sess.is_some() {
- Ok(Either::Left(Redirect::temporary(rocket::uri!(r_home()))))
- } else {
- let front = read_to_string(CONF.asset_path.join("front.htm")).await?;
- Ok(Either::Right(RawHtml(render_page(
- &CustomPage {
- title: "Jellything".to_string(),
- body: front,
- },
- RenderInfo {
- importing: false,
- session: None,
- lang,
- },
- ))))
- }
-}
+// #[get("/")]
+// pub async fn r_index(
+// lang: AcceptLanguage,
+// sess: Option<A<Session>>,
+// ) -> MyResult<Either<Redirect, RawHtml<String>>> {
+// let AcceptLanguage(lang) = lang;
+// if sess.is_some() {
+// Ok(Either::Left(Redirect::temporary(rocket::uri!(r_home()))))
+// } else {
+// let front = read_to_string(CONF.asset_path.join("front.htm")).await?;
+// Ok(Either::Right(RawHtml(render_page(
+// &CustomPage {
+// title: "Jellything".to_string(),
+// body: front,
+// },
+// RenderInfo {
+// importing: false,
+// session: None,
+// lang,
+// },
+// ))))
+// }
+// }
#[get("/favicon.ico")]
-pub async fn r_favicon() -> MyResult<File> {
- Ok(File::open(CONF.asset_path.join("favicon.ico")).await?)
+pub async fn r_favicon(s: &rocket::State<Arc<State>>) -> MyResult<File> {
+ Ok(File::open(s.config.asset_path.join("favicon.ico")).await?)
}
pub struct Defer(Pin<Box<dyn Future<Output = String> + Send>>);