diff options
Diffstat (limited to 'src/http')
| -rw-r--r-- | src/http/mod.rs | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/http/mod.rs b/src/http/mod.rs index 5cf8dbe..4665281 100644 --- a/src/http/mod.rs +++ b/src/http/mod.rs | |||
| @@ -7,7 +7,6 @@ pub mod nip11; | |||
| 7 | use std::future::Future; | 7 | use std::future::Future; |
| 8 | use std::net::SocketAddr; | 8 | use std::net::SocketAddr; |
| 9 | use std::pin::Pin; | 9 | use std::pin::Pin; |
| 10 | use std::sync::Arc; | ||
| 11 | 10 | ||
| 12 | use base64::Engine; | 11 | use base64::Engine; |
| 13 | use http_body_util::{BodyExt, Full}; | 12 | use http_body_util::{BodyExt, Full}; |
| @@ -17,7 +16,6 @@ use hyper::server::conn::http1; | |||
| 17 | use hyper::service::Service; | 16 | use hyper::service::Service; |
| 18 | use hyper::{Method, Request, Response}; | 17 | use hyper::{Method, Request, Response}; |
| 19 | use hyper_util::rt::TokioIo; | 18 | use hyper_util::rt::TokioIo; |
| 20 | use nostr_relay_builder::prelude::MemoryDatabase; | ||
| 21 | use nostr_relay_builder::LocalRelay; | 19 | use nostr_relay_builder::LocalRelay; |
| 22 | use nostr_sdk::hashes::sha1::Hash as Sha1Hash; | 20 | use nostr_sdk::hashes::sha1::Hash as Sha1Hash; |
| 23 | use nostr_sdk::hashes::{Hash, HashEngine}; | 21 | use nostr_sdk::hashes::{Hash, HashEngine}; |
| @@ -26,6 +24,7 @@ use tokio::net::TcpListener; | |||
| 26 | 24 | ||
| 27 | use crate::config::Config; | 25 | use crate::config::Config; |
| 28 | use crate::git; | 26 | use crate::git; |
| 27 | use crate::nostr::builder::SharedDatabase; | ||
| 29 | 28 | ||
| 30 | /// CORS headers required by GRASP-01 specification (lines 40-47) | 29 | /// CORS headers required by GRASP-01 specification (lines 40-47) |
| 31 | const CORS_ALLOW_ORIGIN: &str = "*"; | 30 | const CORS_ALLOW_ORIGIN: &str = "*"; |
| @@ -90,7 +89,7 @@ struct HttpService { | |||
| 90 | config: Config, | 89 | config: Config, |
| 91 | remote: SocketAddr, | 90 | remote: SocketAddr, |
| 92 | /// Database reference for direct queries (e.g., push authorization) | 91 | /// Database reference for direct queries (e.g., push authorization) |
| 93 | database: Arc<MemoryDatabase>, | 92 | database: SharedDatabase, |
| 94 | } | 93 | } |
| 95 | 94 | ||
| 96 | impl HttpService { | 95 | impl HttpService { |
| @@ -98,7 +97,7 @@ impl HttpService { | |||
| 98 | relay: LocalRelay, | 97 | relay: LocalRelay, |
| 99 | config: Config, | 98 | config: Config, |
| 100 | remote: SocketAddr, | 99 | remote: SocketAddr, |
| 101 | database: Arc<MemoryDatabase>, | 100 | database: SharedDatabase, |
| 102 | ) -> Self { | 101 | ) -> Self { |
| 103 | Self { | 102 | Self { |
| 104 | relay, | 103 | relay, |
| @@ -423,7 +422,7 @@ fn derive_accept_key(request_key: &[u8]) -> String { | |||
| 423 | pub async fn run_server( | 422 | pub async fn run_server( |
| 424 | config: Config, | 423 | config: Config, |
| 425 | relay: LocalRelay, | 424 | relay: LocalRelay, |
| 426 | database: Arc<MemoryDatabase>, | 425 | database: SharedDatabase, |
| 427 | ) -> anyhow::Result<()> { | 426 | ) -> anyhow::Result<()> { |
| 428 | let bind_addr: SocketAddr = config.bind_address.parse()?; | 427 | let bind_addr: SocketAddr = config.bind_address.parse()?; |
| 429 | 428 | ||