diff options
| author | DanConwayDev <DanConwayDev@protonmail.com> | 2025-11-28 10:31:46 +0000 |
|---|---|---|
| committer | DanConwayDev <DanConwayDev@protonmail.com> | 2025-11-28 10:31:46 +0000 |
| commit | 744094c61d6e65892bcdb5a29b90b845ce87559f (patch) | |
| tree | 61c53f0ab93901b2b3d5378f7d13c3ac2b6dea98 /src/nostr/builder.rs | |
| parent | 4da51a8adb94f2979c0a911157f26596c1ee2cb5 (diff) | |
fix maintainer recursion
Diffstat (limited to 'src/nostr/builder.rs')
| -rw-r--r-- | src/nostr/builder.rs | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/src/nostr/builder.rs b/src/nostr/builder.rs index 285e6f3..7aa2b97 100644 --- a/src/nostr/builder.rs +++ b/src/nostr/builder.rs | |||
| @@ -717,8 +717,20 @@ impl WritePolicy for Nip34WritePolicy { | |||
| 717 | } | 717 | } |
| 718 | } | 718 | } |
| 719 | 719 | ||
| 720 | /// Result of creating a relay - includes both the relay and database | ||
| 721 | pub struct RelayWithDatabase { | ||
| 722 | /// The local relay instance | ||
| 723 | pub relay: LocalRelay, | ||
| 724 | /// The database Arc that can be used for direct queries | ||
| 725 | pub database: Arc<MemoryDatabase>, | ||
| 726 | } | ||
| 727 | |||
| 720 | /// Create a configured LocalRelay with full GRASP-01 validation | 728 | /// Create a configured LocalRelay with full GRASP-01 validation |
| 721 | pub fn create_relay(config: &Config) -> Result<LocalRelay> { | 729 | /// |
| 730 | /// Returns a `RelayWithDatabase` struct containing: | ||
| 731 | /// - The `LocalRelay` for handling WebSocket connections | ||
| 732 | /// - The `Arc<MemoryDatabase>` for direct database queries (e.g., push authorization) | ||
| 733 | pub fn create_relay(config: &Config) -> Result<RelayWithDatabase> { | ||
| 722 | tracing::info!("Configuring nostr relay with GRASP-01 validation..."); | 734 | tracing::info!("Configuring nostr relay with GRASP-01 validation..."); |
| 723 | 735 | ||
| 724 | // Determine database path | 736 | // Determine database path |
| @@ -770,5 +782,8 @@ pub fn create_relay(config: &Config) -> Result<LocalRelay> { | |||
| 770 | config.domain | 782 | config.domain |
| 771 | ); | 783 | ); |
| 772 | 784 | ||
| 773 | Ok(LocalRelay::new(builder)) | 785 | Ok(RelayWithDatabase { |
| 786 | relay: LocalRelay::new(builder), | ||
| 787 | database, | ||
| 788 | }) | ||
| 774 | } \ No newline at end of file | 789 | } \ No newline at end of file |