From 42f7a95ce67506344b694535ff193745452c6e29 Mon Sep 17 00:00:00 2001 From: metamuffin Date: Sat, 20 Jan 2024 15:43:57 +0100 Subject: custom logo support --- server/src/routes/ui/layout.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'server/src') diff --git a/server/src/routes/ui/layout.rs b/server/src/routes/ui/layout.rs index d4d443c..faf5527 100644 --- a/server/src/routes/ui/layout.rs +++ b/server/src/routes/ui/layout.rs @@ -25,7 +25,9 @@ use rocket::{ response::{self, Responder}, Request, Response, }; -use std::io::Cursor; +use std::{io::Cursor, sync::LazyLock}; + +static LOGO_ENABLED: LazyLock = LazyLock::new(|| CONF.asset_path.join("logo.svg").exists()); markup::define! { Layout<'a, Main: Render>(title: String, main: Main, class: &'a str, session: Option) { @@ -39,7 +41,7 @@ markup::define! { } body[class=class] { nav { - h1 { a[href="/"] { @CONF.brand } } " " + h1 { a[href="/"] { @if *LOGO_ENABLED { img.logo[src="/assets/logo.svg"]; } else { @CONF.brand } } } " " @if let Some(_) = session { a.library[href=uri!(r_library_node("library"))] { "My Library" } " " a.library[href=uri!(r_all_items())] { "All Items" } " " -- cgit v1.2.3-70-g09d2