config param: allow_scrape_if_negentropy

This commit is contained in:
Mike Dilger 2025-01-21 11:45:53 +13:00
parent 2295f4b9fc
commit 0f94767f80
No known key found for this signature in database
GPG Key ID: 47581A78D4329BA4
4 changed files with 19 additions and 1 deletions

View File

@ -197,6 +197,13 @@ allow_scrape_if_limited_to = 100
allow_scrape_if_max_seconds = 7200
# Within negentropy synchronization, allow scraping
#
# The default is true
#
allow_scrape_if_negentropy = true
# This is an integer indicating the maximum number of subscriptions a connection can have open
# at a given time.
#

View File

@ -168,6 +168,12 @@ See `allow_scraping` to learn the definition of a scrape.
The default is 7200.
### allow_scrape_if_negentropy
Within negentropy synchronization, allow scraping.
The default is true
### max_subscriptions
This is an integer indicating the maximum number of subscriptions a connection can have open at a given time.

View File

@ -29,6 +29,7 @@ pub struct FriendlyConfig {
pub allow_scraping: bool,
pub allow_scrape_if_limited_to: u32,
pub allow_scrape_if_max_seconds: u64,
pub allow_scrape_if_negentropy: bool,
pub max_subscriptions: usize,
pub serve_ephemeral: bool,
pub serve_relay_lists: bool,
@ -69,6 +70,7 @@ impl Default for FriendlyConfig {
allow_scraping: false,
allow_scrape_if_limited_to: 100,
allow_scrape_if_max_seconds: 7200,
allow_scrape_if_negentropy: true,
max_subscriptions: 128,
serve_ephemeral: true,
serve_relay_lists: true,
@ -111,6 +113,7 @@ impl FriendlyConfig {
allow_scraping,
allow_scrape_if_limited_to,
allow_scrape_if_max_seconds,
allow_scrape_if_negentropy,
max_subscriptions,
serve_ephemeral,
serve_relay_lists,
@ -175,6 +178,7 @@ impl FriendlyConfig {
allow_scraping,
allow_scrape_if_limited_to,
allow_scrape_if_max_seconds,
allow_scrape_if_negentropy,
max_subscriptions,
serve_ephemeral,
serve_relay_lists,
@ -218,6 +222,7 @@ pub struct Config {
pub allow_scraping: bool,
pub allow_scrape_if_limited_to: u32,
pub allow_scrape_if_max_seconds: u64,
pub allow_scrape_if_negentropy: bool,
pub max_subscriptions: usize,
pub serve_ephemeral: bool,
pub serve_relay_lists: bool,

View File

@ -539,7 +539,7 @@ impl WebSocketService {
let config = &*GLOBALS.config.read();
GLOBALS.store.get().unwrap().find_events(
&filter,
config.allow_scraping,
config.allow_scraping || config.allow_scrape_if_negentropy,
config.allow_scrape_if_limited_to,
config.allow_scrape_if_max_seconds,
screen,