diff --git a/justfile b/justfile index 4ed77bf05d..ad64b24273 100644 --- a/justfile +++ b/justfile @@ -152,3 +152,6 @@ update-changelog: preview-examples: cargo run preview examples/* + +convert-logo-to-favicon: + convert -background none -resize 256x256 logo.svg static/favicon.png diff --git a/logo.svg b/logo.svg new file mode 100644 index 0000000000..18553c1215 --- /dev/null +++ b/logo.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/src/subcommand/server.rs b/src/subcommand/server.rs index 2071b5b078..121b3be9a7 100644 --- a/src/subcommand/server.rs +++ b/src/subcommand/server.rs @@ -136,7 +136,8 @@ impl Server { .route("/clock", get(Self::clock)) .route("/content/:inscription_id", get(Self::content)) .route("/faq", get(Self::faq)) - .route("/favicon.ico", get(Self::favicon)) + .route("/favicon.ico", get(Self::favicon_ico)) + .route("/favicon.svg", get(Self::favicon_svg)) .route("/input/:block/:transaction/:input", get(Self::input)) .route("/inscription/:inscription_id", get(Self::inscription)) .route("/inscriptions", get(Self::inscriptions)) @@ -541,10 +542,21 @@ impl Server { } } - async fn favicon() -> ServerResult { + async fn favicon_ico() -> ServerResult { Self::static_asset(Path("/favicon.png".to_string())).await } + async fn favicon_svg() -> Response { + ( + [( + header::CONTENT_SECURITY_POLICY, + HeaderValue::from_static("default-src 'unsafe-inline'"), + )], + Self::static_asset(Path("/favicon.svg".to_string())).await, + ) + .into_response() + } + async fn static_asset(Path(path): Path) -> ServerResult { let content = StaticAssets::get(if let Some(stripped) = path.strip_prefix('/') { stripped @@ -628,7 +640,7 @@ impl Server { ); headers.insert( header::CONTENT_SECURITY_POLICY, - "default-src 'unsafe-eval' 'unsafe-inline'".parse().unwrap(), + HeaderValue::from_static("default-src 'unsafe-eval' 'unsafe-inline'"), ); Some((headers, inscription.into_content()?)) diff --git a/static/favicon.png b/static/favicon.png index 67caba4687..fed6cd3759 100644 Binary files a/static/favicon.png and b/static/favicon.png differ diff --git a/static/favicon.svg b/static/favicon.svg new file mode 100644 index 0000000000..987a701c89 --- /dev/null +++ b/static/favicon.svg @@ -0,0 +1,18 @@ + + + + + + diff --git a/templates/page.html b/templates/page.html index db56da26ff..e8e7580382 100644 --- a/templates/page.html +++ b/templates/page.html @@ -8,8 +8,10 @@ %% } {{ self.content.title() }} - - + + + +