diff options
| author | DanConwayDev <DanConwayDev@protonmail.com> | 2026-01-09 19:58:41 +0000 |
|---|---|---|
| committer | DanConwayDev <DanConwayDev@protonmail.com> | 2026-01-09 19:58:41 +0000 |
| commit | b28a356cb41077ccee12a9c52f4ef2054e76cac6 (patch) | |
| tree | 2a0867f1ab0216e86efa062aef90b2b8077e6fb9 /src/nostr | |
| parent | 6dd9fcd5392891b0ddb7894e2c5cb40450eae00e (diff) | |
chore: cargo fmt
Diffstat (limited to 'src/nostr')
| -rw-r--r-- | src/nostr/builder.rs | 20 | ||||
| -rw-r--r-- | src/nostr/policy/state.rs | 8 |
2 files changed, 17 insertions, 11 deletions
diff --git a/src/nostr/builder.rs b/src/nostr/builder.rs index acaac71..c010854 100644 --- a/src/nostr/builder.rs +++ b/src/nostr/builder.rs | |||
| @@ -102,11 +102,11 @@ impl Nip34WritePolicy { | |||
| 102 | } | 102 | } |
| 103 | 103 | ||
| 104 | tracing::debug!("Accepted repository announcement: {}", event_id_str); | 104 | tracing::debug!("Accepted repository announcement: {}", event_id_str); |
| 105 | 105 | ||
| 106 | // Check purgatory for state events that might now be authorized | 106 | // Check purgatory for state events that might now be authorized |
| 107 | self.check_purgatory_state_events_for_identifier(&announcement.identifier) | 107 | self.check_purgatory_state_events_for_identifier(&announcement.identifier) |
| 108 | .await; | 108 | .await; |
| 109 | 109 | ||
| 110 | WritePolicyResult::Accept | 110 | WritePolicyResult::Accept |
| 111 | } | 111 | } |
| 112 | Err(e) => { | 112 | Err(e) => { |
| @@ -130,11 +130,11 @@ impl Nip34WritePolicy { | |||
| 130 | announcement.identifier | 130 | announcement.identifier |
| 131 | ); | 131 | ); |
| 132 | // Don't create bare repository for external announcements | 132 | // Don't create bare repository for external announcements |
| 133 | 133 | ||
| 134 | // Check purgatory for state events that might now be authorized | 134 | // Check purgatory for state events that might now be authorized |
| 135 | self.check_purgatory_state_events_for_identifier(&announcement.identifier) | 135 | self.check_purgatory_state_events_for_identifier(&announcement.identifier) |
| 136 | .await; | 136 | .await; |
| 137 | 137 | ||
| 138 | WritePolicyResult::Accept | 138 | WritePolicyResult::Accept |
| 139 | } | 139 | } |
| 140 | Err(e) => { | 140 | Err(e) => { |
| @@ -324,20 +324,24 @@ impl Nip34WritePolicy { | |||
| 324 | /// 4. Keeps unauthorized events in purgatory (will expire naturally) | 324 | /// 4. Keeps unauthorized events in purgatory (will expire naturally) |
| 325 | async fn check_purgatory_state_events_for_identifier(&self, identifier: &str) { | 325 | async fn check_purgatory_state_events_for_identifier(&self, identifier: &str) { |
| 326 | let state_events = self.ctx.purgatory.find_state(identifier); | 326 | let state_events = self.ctx.purgatory.find_state(identifier); |
| 327 | 327 | ||
| 328 | if state_events.is_empty() { | 328 | if state_events.is_empty() { |
| 329 | return; | 329 | return; |
| 330 | } | 330 | } |
| 331 | 331 | ||
| 332 | tracing::debug!( | 332 | tracing::debug!( |
| 333 | identifier = %identifier, | 333 | identifier = %identifier, |
| 334 | count = state_events.len(), | 334 | count = state_events.len(), |
| 335 | "Checking purgatory state events after announcement acceptance" | 335 | "Checking purgatory state events after announcement acceptance" |
| 336 | ); | 336 | ); |
| 337 | 337 | ||
| 338 | for entry in state_events { | 338 | for entry in state_events { |
| 339 | // Re-evaluate authorization with the new announcement | 339 | // Re-evaluate authorization with the new announcement |
| 340 | match self.state_policy.process_state_event(&entry.event, false).await { | 340 | match self |
| 341 | .state_policy | ||
| 342 | .process_state_event(&entry.event, false) | ||
| 343 | .await | ||
| 344 | { | ||
| 341 | Ok(WritePolicyResult::Accept) => { | 345 | Ok(WritePolicyResult::Accept) => { |
| 342 | tracing::info!( | 346 | tracing::info!( |
| 343 | event_id = %entry.event.id, | 347 | event_id = %entry.event.id, |
diff --git a/src/nostr/policy/state.rs b/src/nostr/policy/state.rs index d26b5ec..b850e7b 100644 --- a/src/nostr/policy/state.rs +++ b/src/nostr/policy/state.rs | |||
| @@ -93,9 +93,11 @@ impl StatePolicy { | |||
| 93 | }); | 93 | }); |
| 94 | } | 94 | } |
| 95 | 95 | ||
| 96 | let authorized_owners = | 96 | let authorized_owners = crate::git::authorization::pubkey_authorised_for_repo_owners( |
| 97 | crate::git::authorization::pubkey_authorised_for_repo_owners(&event.pubkey, &db_repo_data); | 97 | &event.pubkey, |
| 98 | 98 | &db_repo_data, | |
| 99 | ); | ||
| 100 | |||
| 99 | if authorized_owners.is_empty() { | 101 | if authorized_owners.is_empty() { |
| 100 | tracing::warn!( | 102 | tracing::warn!( |
| 101 | event_id = %event.id, | 103 | event_id = %event.id, |