mirror of
https://github.com/mikedilger/chorus.git
synced 2026-05-03 06:51:42 +00:00
Support NIP-40 Expiration timestamp
This commit is contained in:
parent
d8b17b0402
commit
dbca0ddb4e
@ -488,6 +488,12 @@ pub fn screen_outgoing_event(
|
|||||||
return event_flags.tags_current_user || event_flags.author_is_current_user;
|
return event_flags.tags_current_user || event_flags.author_is_current_user;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Forbid (and delete) if it has an expired expiration tag
|
||||||
|
if matches!(event.is_expired(), Ok(true)) {
|
||||||
|
let _ = GLOBALS.store.get().unwrap().delete_event(event.id());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// Allow if an open relay
|
// Allow if an open relay
|
||||||
if GLOBALS.config.read().open_relay {
|
if GLOBALS.config.read().open_relay {
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@ -35,20 +35,20 @@ pub async fn serve_nip11(peer: HashedPeer) -> Result<Response<Body>, Error> {
|
|||||||
fn build_rid(config: &Config) -> String {
|
fn build_rid(config: &Config) -> String {
|
||||||
let mut rid: String = String::with_capacity(255);
|
let mut rid: String = String::with_capacity(255);
|
||||||
|
|
||||||
const SUPPORTED_NIPS: [u8; 7] = [
|
const SUPPORTED_NIPS: [u8; 8] = [
|
||||||
1, // nostr
|
1, // nostr
|
||||||
4, // DMs
|
4, // DMs
|
||||||
9, // Event Deletion
|
9, // Event Deletion
|
||||||
11, // relay information document
|
11, // relay information document
|
||||||
|
40, // Expiration Timestamp
|
||||||
42, // AUTH
|
42, // AUTH
|
||||||
59, // GiftWrap
|
59, // GiftWrap
|
||||||
65, // Relay List Metadata
|
65, // Relay List Metadata
|
||||||
];
|
];
|
||||||
const _UNSUPPORTED_NIPS: [u8; 8] = [
|
const _UNSUPPORTED_NIPS: [u8; 7] = [
|
||||||
26, // Delegated Event Signing
|
26, // Delegated Event Signing
|
||||||
28, // Public Chat
|
28, // Public Chat
|
||||||
29, // Relay-based Groups
|
29, // Relay-based Groups
|
||||||
40, // Expiration Timestamp
|
|
||||||
45, // Counting results
|
45, // Counting results
|
||||||
50, // SEARCH
|
50, // SEARCH
|
||||||
94, // File Metadata
|
94, // File Metadata
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user