mirror of
https://github.com/mikedilger/chorus.git
synced 2026-05-03 06:51:42 +00:00
Config settings for serve_ephemeral and serve_relay_lists
This commit is contained in:
parent
86c74f9e40
commit
a09aa5a002
@ -2,6 +2,7 @@ FriendlyConfig(
|
|||||||
data_directory: "/opt/chorus/var/chorus",
|
data_directory: "/opt/chorus/var/chorus",
|
||||||
ip_address: "127.0.0.1",
|
ip_address: "127.0.0.1",
|
||||||
port: 443,
|
port: 443,
|
||||||
|
hostname: "localhost",
|
||||||
use_tls: true,
|
use_tls: true,
|
||||||
certchain_pem_path: "/opt/chorus/etc/tls/fullchain.pem",
|
certchain_pem_path: "/opt/chorus/etc/tls/fullchain.pem",
|
||||||
key_pem_path: "/opt/chorus/etc/tls/privkey.pem",
|
key_pem_path: "/opt/chorus/etc/tls/privkey.pem",
|
||||||
@ -13,4 +14,7 @@ FriendlyConfig(
|
|||||||
],
|
],
|
||||||
verify_events: true,
|
verify_events: true,
|
||||||
allow_scraping: false,
|
allow_scraping: false,
|
||||||
|
max_subscriptions: 32,
|
||||||
|
serve_ephemeral: true,
|
||||||
|
serve_relay_lists: true,
|
||||||
)
|
)
|
||||||
@ -130,3 +130,15 @@ If you set this too low, clients will be incentivised to resubmit updated subscr
|
|||||||
It is strongly recommended to not go below 16.
|
It is strongly recommended to not go below 16.
|
||||||
|
|
||||||
Default is 32.
|
Default is 32.
|
||||||
|
|
||||||
|
### serve_ephemeral
|
||||||
|
|
||||||
|
Accept and serve all ephemeral events to everybody.
|
||||||
|
|
||||||
|
Default is true.
|
||||||
|
|
||||||
|
### serve_relay_lists
|
||||||
|
|
||||||
|
Accept and serve kind 10002 events to everybody.
|
||||||
|
|
||||||
|
Default is true.
|
||||||
|
|||||||
@ -19,4 +19,6 @@ FriendlyConfig(
|
|||||||
// your entire relay
|
// your entire relay
|
||||||
allow_scraping: true,
|
allow_scraping: true,
|
||||||
max_subscriptions: 32,
|
max_subscriptions: 32,
|
||||||
|
serve_ephemeral: true,
|
||||||
|
serve_relay_lists: true,
|
||||||
)
|
)
|
||||||
@ -20,6 +20,8 @@ pub struct FriendlyConfig {
|
|||||||
pub verify_events: bool,
|
pub verify_events: bool,
|
||||||
pub allow_scraping: bool,
|
pub allow_scraping: bool,
|
||||||
pub max_subscriptions: usize,
|
pub max_subscriptions: usize,
|
||||||
|
pub serve_ephemeral: bool,
|
||||||
|
pub serve_relay_lists: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for FriendlyConfig {
|
impl Default for FriendlyConfig {
|
||||||
@ -40,6 +42,8 @@ impl Default for FriendlyConfig {
|
|||||||
verify_events: true,
|
verify_events: true,
|
||||||
allow_scraping: false,
|
allow_scraping: false,
|
||||||
max_subscriptions: 32,
|
max_subscriptions: 32,
|
||||||
|
serve_ephemeral: true,
|
||||||
|
serve_relay_lists: true,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -62,6 +66,8 @@ impl FriendlyConfig {
|
|||||||
verify_events,
|
verify_events,
|
||||||
allow_scraping,
|
allow_scraping,
|
||||||
max_subscriptions,
|
max_subscriptions,
|
||||||
|
serve_ephemeral,
|
||||||
|
serve_relay_lists,
|
||||||
} = self;
|
} = self;
|
||||||
|
|
||||||
let mut public_key: Option<Pubkey> = None;
|
let mut public_key: Option<Pubkey> = None;
|
||||||
@ -93,6 +99,8 @@ impl FriendlyConfig {
|
|||||||
verify_events,
|
verify_events,
|
||||||
allow_scraping,
|
allow_scraping,
|
||||||
max_subscriptions,
|
max_subscriptions,
|
||||||
|
serve_ephemeral,
|
||||||
|
serve_relay_lists,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -115,4 +123,6 @@ pub struct Config {
|
|||||||
pub verify_events: bool,
|
pub verify_events: bool,
|
||||||
pub allow_scraping: bool,
|
pub allow_scraping: bool,
|
||||||
pub max_subscriptions: usize,
|
pub max_subscriptions: usize,
|
||||||
|
pub serve_ephemeral: bool,
|
||||||
|
pub serve_relay_lists: bool,
|
||||||
}
|
}
|
||||||
|
|||||||
@ -366,12 +366,12 @@ async fn screen_incoming_event(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Accept relay lists from anybody
|
// Accept relay lists from anybody
|
||||||
if event.kind() == Kind(10002) {
|
if event.kind() == Kind(10002) && GLOBALS.config.get().unwrap().serve_relay_lists {
|
||||||
return Ok(true);
|
return Ok(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Allow if event kind ephemeral
|
// Allow if event kind ephemeral
|
||||||
if event.kind().is_ephemeral() {
|
if event.kind().is_ephemeral() && GLOBALS.config.get().unwrap().serve_ephemeral {
|
||||||
return Ok(true);
|
return Ok(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -408,12 +408,12 @@ pub fn screen_outgoing_event(
|
|||||||
authorized_user: bool,
|
authorized_user: bool,
|
||||||
) -> bool {
|
) -> bool {
|
||||||
// Allow Relay Lists
|
// Allow Relay Lists
|
||||||
if event.kind() == Kind(10002) {
|
if event.kind() == Kind(10002) && GLOBALS.config.get().unwrap().serve_relay_lists {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Allow if event kind ephemeral
|
// Allow if event kind ephemeral
|
||||||
if event.kind().is_ephemeral() {
|
if event.kind().is_ephemeral() && GLOBALS.config.get().unwrap().serve_ephemeral {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user