diff options
| author | DanConwayDev <DanConwayDev@protonmail.com> | 2025-11-19 17:01:36 +0000 |
|---|---|---|
| committer | DanConwayDev <DanConwayDev@protonmail.com> | 2025-11-19 17:01:36 +0000 |
| commit | bf7f4d5381203d5c27b2811d62c5b1781533aa2b (patch) | |
| tree | 26903bbf535d83abd7242370d8b6932eb80e3389 /src/http/landing.rs | |
| parent | fa065ad128882755f2a988d6203b59a2ab5e38ff (diff) | |
fix some clippy fmt warnings
Diffstat (limited to 'src/http/landing.rs')
| -rw-r--r-- | src/http/landing.rs | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/http/landing.rs b/src/http/landing.rs index 35e49e5..976ec50 100644 --- a/src/http/landing.rs +++ b/src/http/landing.rs | |||
| @@ -1,7 +1,6 @@ | |||
| 1 | /// Landing Page Handler | 1 | /// Landing Page Handler |
| 2 | /// | 2 | /// |
| 3 | /// Serves the HTML landing page or upgrades to WebSocket for Nostr relay connections. | 3 | /// Serves the HTML landing page or upgrades to WebSocket for Nostr relay connections. |
| 4 | |||
| 5 | use actix_web::{web, HttpRequest, HttpResponse, Result}; | 4 | use actix_web::{web, HttpRequest, HttpResponse, Result}; |
| 6 | use nostr_relay_builder::LocalRelay; | 5 | use nostr_relay_builder::LocalRelay; |
| 7 | 6 | ||
| @@ -16,12 +15,16 @@ pub async fn handle( | |||
| 16 | ) -> Result<HttpResponse> { | 15 | ) -> Result<HttpResponse> { |
| 17 | // Check if this is a WebSocket upgrade request | 16 | // Check if this is a WebSocket upgrade request |
| 18 | if let Some(upgrade) = req.headers().get("upgrade") { | 17 | if let Some(upgrade) = req.headers().get("upgrade") { |
| 19 | if upgrade.to_str().unwrap_or("").eq_ignore_ascii_case("websocket") { | 18 | if upgrade |
| 19 | .to_str() | ||
| 20 | .unwrap_or("") | ||
| 21 | .eq_ignore_ascii_case("websocket") | ||
| 22 | { | ||
| 20 | // Delegate to WebSocket handler | 23 | // Delegate to WebSocket handler |
| 21 | return crate::http::websocket::handle(req, stream, relay).await; | 24 | return crate::http::websocket::handle(req, stream, relay).await; |
| 22 | } | 25 | } |
| 23 | } | 26 | } |
| 24 | 27 | ||
| 25 | // Otherwise, serve the landing page | 28 | // Otherwise, serve the landing page |
| 26 | let html = format!( | 29 | let html = format!( |
| 27 | include_str!("../../templates/landing.html"), | 30 | include_str!("../../templates/landing.html"), |
| @@ -30,8 +33,8 @@ pub async fn handle( | |||
| 30 | domain = config.domain, | 33 | domain = config.domain, |
| 31 | bind_address = config.bind_address, | 34 | bind_address = config.bind_address, |
| 32 | ); | 35 | ); |
| 33 | 36 | ||
| 34 | Ok(HttpResponse::Ok() | 37 | Ok(HttpResponse::Ok() |
| 35 | .content_type("text/html; charset=utf-8") | 38 | .content_type("text/html; charset=utf-8") |
| 36 | .body(html)) | 39 | .body(html)) |
| 37 | } \ No newline at end of file | 40 | } |