mirror of
https://github.com/scsibug/nostr-rs-relay.git
synced 2024-12-22 08:25:52 -05:00
feat: restricted_writes
Signed-off-by: Greg Heartsfield <scsibug@imap.cc>
This commit is contained in:
parent
4ff77ab537
commit
7120de4ff8
|
@ -75,6 +75,11 @@ description = "A newly created nostr-rs-relay.\n\nCustomize this with your own i
|
|||
# `proto/nauthz.proto`.
|
||||
# event_admission_server = "http://[::1]:50051"
|
||||
|
||||
# If the event admission server denies writes
|
||||
# in any case (excluding spam filtering).
|
||||
# This is reflected in the relay information document.
|
||||
# restricts_write = true
|
||||
|
||||
[network]
|
||||
# Bind to this network address
|
||||
address = "0.0.0.0"
|
||||
|
|
|
@ -32,6 +32,7 @@ pub struct Database {
|
|||
#[allow(unused)]
|
||||
pub struct Grpc {
|
||||
pub event_admission_server: Option<String>,
|
||||
pub restricts_write: bool,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
|
@ -287,6 +288,7 @@ impl Default for Settings {
|
|||
},
|
||||
grpc: Grpc {
|
||||
event_admission_server: None,
|
||||
restricts_write: false,
|
||||
},
|
||||
network: Network {
|
||||
port: 8080,
|
||||
|
|
|
@ -13,6 +13,9 @@ pub const UNIT: &str = "msats";
|
|||
pub struct Limitation {
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
payment_required: Option<bool>,
|
||||
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
restricted_writes: Option<bool>,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug)]
|
||||
|
@ -75,6 +78,12 @@ impl From<Settings> for RelayInfo {
|
|||
|
||||
let limitations = Limitation {
|
||||
payment_required: Some(p.enabled),
|
||||
restricted_writes: Some(
|
||||
p.enabled
|
||||
|| c.verified_users.is_enabled()
|
||||
|| c.authorization.pubkey_whitelist.is_some()
|
||||
|| c.grpc.restricts_write,
|
||||
),
|
||||
};
|
||||
|
||||
let (payment_url, fees) = if p.enabled {
|
||||
|
|
Loading…
Reference in New Issue
Block a user