diff options
-rw-r--r-- | remuxer/src/lib.rs | 7 | ||||
-rw-r--r-- | server/src/config.rs | 4 | ||||
-rw-r--r-- | server/src/routes/mod.rs | 3 | ||||
-rw-r--r-- | server/src/routes/ui/home.rs | 13 |
4 files changed, 18 insertions, 9 deletions
diff --git a/remuxer/src/lib.rs b/remuxer/src/lib.rs index 12acae3..7ee6ded 100644 --- a/remuxer/src/lib.rs +++ b/remuxer/src/lib.rs @@ -11,7 +11,7 @@ use jellymatroska::{ Master, MatroskaTag, }; use log::{debug, info, trace, warn}; -use std::{collections::VecDeque, fs::File, io::Write, path::PathBuf, sync::Arc}; +use std::{collections::VecDeque, fs::File, io::Write, path::PathBuf}; #[derive(Debug, Clone)] pub struct RemuxerContext {} @@ -99,7 +99,7 @@ impl RemuxerContext { output.write_tag(&MatroskaTag::Tracks(Master::Collected(tracks_header)))?; struct ReaderD<'a> { - info: SourceTrack, + _info: SourceTrack, peek: Option<AbsoluteBlock>, stream: SegmentExtractIter<'a>, mapped: u64, @@ -126,7 +126,7 @@ impl RemuxerContext { mapped: i.mapped, peek: Some(stream.next()?), stream, - info: i.info.clone(), + _info: i.info.clone(), }); } @@ -220,6 +220,7 @@ impl SegmentExtractIter<'_> { } } // TODO duration + drop(duration); let block = Block::parse(&block.unwrap())?; if block.track == self.extract { trace!("block: track={} tso={}", block.track, block.timestamp_off); diff --git a/server/src/config.rs b/server/src/config.rs index 86f7068..0534f22 100644 --- a/server/src/config.rs +++ b/server/src/config.rs @@ -5,6 +5,10 @@ use serde::{Deserialize, Serialize}; #[derive(Debug, Deserialize, Serialize, Default)] pub struct GlobalConfig { pub brand: String, + pub slogan: String, + pub icon: PathBuf, + pub asset_dir: PathBuf, + pub database_path: PathBuf, pub library_path: PathBuf, pub admin_username: String, diff --git a/server/src/routes/mod.rs b/server/src/routes/mod.rs index b791c5a..e7db40f 100644 --- a/server/src/routes/mod.rs +++ b/server/src/routes/mod.rs @@ -1,6 +1,6 @@ use crate::{database::Database, library::Library, CONF}; use jellyremuxer::RemuxerContext; -use rocket::{catchers, config::SecretKey, routes, Build, Config, Rocket}; +use rocket::{catchers, config::SecretKey, fs::FileServer, routes, Build, Config, Rocket}; use stream::r_stream; use ui::{ account::{ @@ -39,6 +39,7 @@ pub fn build_rocket( .manage(library) .manage(database) .register("/", catchers![r_catch]) + .mount("/assets", FileServer::from(&CONF.asset_dir)) .mount( "/", routes![ diff --git a/server/src/routes/ui/home.rs b/server/src/routes/ui/home.rs index b9e9289..165fbb7 100644 --- a/server/src/routes/ui/home.rs +++ b/server/src/routes/ui/home.rs @@ -1,12 +1,14 @@ use super::account::session::Session; use super::layout::LayoutPage; +use crate::routes::ui::error::MyResult; use crate::routes::ui::layout::DynLayoutPage; use crate::CONF; use crate::{library::Library, routes::ui::node::NodePage}; use rocket::{get, State}; +use tokio::fs::read_to_string; #[get("/")] -pub async fn r_home(_sess: Session, library: &State<Library>) -> DynLayoutPage { +pub fn r_home(_sess: Session, library: &State<Library>) -> DynLayoutPage { LayoutPage { title: "Home".to_string(), content: markup::new! { @@ -17,11 +19,12 @@ pub async fn r_home(_sess: Session, library: &State<Library>) -> DynLayoutPage { } #[get("/", rank = 2)] -pub async fn r_home_unpriv() -> DynLayoutPage<'static> { - LayoutPage { +pub async fn r_home_unpriv() -> MyResult<DynLayoutPage<'static>> { + let front = read_to_string(CONF.asset_dir.join("front.htm")).await?; + Ok(LayoutPage { title: "Home".to_string(), content: markup::new! { - h1 { @CONF.brand } + @markup::raw(&front) }, - } + }) } |