aboutsummaryrefslogtreecommitdiff
path: root/server
diff options
context:
space:
mode:
authormetamuffin <metamuffin@disroot.org>2023-01-22 18:06:53 +0100
committermetamuffin <metamuffin@disroot.org>2023-01-22 18:06:53 +0100
commit34cb7d576b1aec8b53cf1f6398480cf8d3fa24c7 (patch)
treeb752d8587b984d36def9962118b0afc2f2953066 /server
parenta8402e7f17e978b839a605d4715ca51b4a76f1f3 (diff)
downloadjellything-34cb7d576b1aec8b53cf1f6398480cf8d3fa24c7.tar
jellything-34cb7d576b1aec8b53cf1f6398480cf8d3fa24c7.tar.bz2
jellything-34cb7d576b1aec8b53cf1f6398480cf8d3fa24c7.tar.zst
front page stuff
Diffstat (limited to 'server')
-rw-r--r--server/src/config.rs4
-rw-r--r--server/src/routes/mod.rs3
-rw-r--r--server/src/routes/ui/home.rs13
3 files changed, 14 insertions, 6 deletions
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)
},
- }
+ })
}