From 89c69eae8e75d2b00794087d9ef74fd4856d0f88 Mon Sep 17 00:00:00 2001 From: DanConwayDev Date: Thu, 20 Nov 2025 21:36:09 +0000 Subject: replace actix with hyper --- src/http/landing.rs | 35 +++++------------------------------ 1 file changed, 5 insertions(+), 30 deletions(-) (limited to 'src/http/landing.rs') diff --git a/src/http/landing.rs b/src/http/landing.rs index 976ec50..55ffb26 100644 --- a/src/http/landing.rs +++ b/src/http/landing.rs @@ -1,40 +1,15 @@ /// Landing Page Handler /// -/// Serves the HTML landing page or upgrades to WebSocket for Nostr relay connections. -use actix_web::{web, HttpRequest, HttpResponse, Result}; -use nostr_relay_builder::LocalRelay; - +/// Generates HTML landing page for the Nostr relay. use crate::config::Config; -/// Handle landing page or WebSocket upgrade -pub async fn handle( - req: HttpRequest, - stream: web::Payload, - config: web::Data, - relay: web::Data, -) -> Result { - // Check if this is a WebSocket upgrade request - if let Some(upgrade) = req.headers().get("upgrade") { - if upgrade - .to_str() - .unwrap_or("") - .eq_ignore_ascii_case("websocket") - { - // Delegate to WebSocket handler - return crate::http::websocket::handle(req, stream, relay).await; - } - } - - // Otherwise, serve the landing page - let html = format!( +/// Generate the HTML landing page +pub fn get_html(config: &Config) -> String { + format!( include_str!("../../templates/landing.html"), relay_name = config.relay_name, relay_description = config.relay_description, domain = config.domain, bind_address = config.bind_address, - ); - - Ok(HttpResponse::Ok() - .content_type("text/html; charset=utf-8") - .body(html)) + ) } -- cgit v1.2.3