From c07954f44f4c03cc17d4a83b144667cbcbb226cf Mon Sep 17 00:00:00 2001 From: DanConwayDev Date: Tue, 2 Dec 2025 17:33:39 +0000 Subject: nip11 add icon --- src/http/mod.rs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'src/http/mod.rs') diff --git a/src/http/mod.rs b/src/http/mod.rs index c47c374..5cf8dbe 100644 --- a/src/http/mod.rs +++ b/src/http/mod.rs @@ -32,6 +32,9 @@ const CORS_ALLOW_ORIGIN: &str = "*"; const CORS_ALLOW_METHODS: &str = "GET, POST"; const CORS_ALLOW_HEADERS: &str = "Content-Type"; +/// Embedded icon image (Grasp logo) +const ICON_PNG: &[u8] = include_bytes!("../../static/icon.png"); + /// Extract npub and identifier from a repository URL path (no git subpath required) /// /// Parses paths like `//.git` (for repository webpage/404) @@ -359,6 +362,20 @@ impl Service> for HttpService { } } + // Serve static icon at /icon.png + if path == "/icon.png" { + return Box::pin(async move { + Ok( + add_cors_headers(Response::builder().header("server", "ngit-grasp")) + .status(200) + .header("content-type", "image/png") + .header("cache-control", "public, max-age=86400") + .body(Full::new(Bytes::from_static(ICON_PNG))) + .unwrap(), + ) + }); + } + // Only serve landing page for root path "/", 404 for everything else let config = self.config.clone(); Box::pin(async move { -- cgit v1.2.3