mirror of
https://github.com/scsibug/nostr-rs-relay.git
synced 2024-11-21 16:59:06 -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`.
|
# `proto/nauthz.proto`.
|
||||||
# event_admission_server = "http://[::1]:50051"
|
# 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]
|
[network]
|
||||||
# Bind to this network address
|
# Bind to this network address
|
||||||
address = "0.0.0.0"
|
address = "0.0.0.0"
|
||||||
|
|
|
@ -32,6 +32,7 @@ pub struct Database {
|
||||||
#[allow(unused)]
|
#[allow(unused)]
|
||||||
pub struct Grpc {
|
pub struct Grpc {
|
||||||
pub event_admission_server: Option<String>,
|
pub event_admission_server: Option<String>,
|
||||||
|
pub restricts_write: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||||
|
@ -287,6 +288,7 @@ impl Default for Settings {
|
||||||
},
|
},
|
||||||
grpc: Grpc {
|
grpc: Grpc {
|
||||||
event_admission_server: None,
|
event_admission_server: None,
|
||||||
|
restricts_write: false,
|
||||||
},
|
},
|
||||||
network: Network {
|
network: Network {
|
||||||
port: 8080,
|
port: 8080,
|
||||||
|
|
|
@ -13,6 +13,9 @@ pub const UNIT: &str = "msats";
|
||||||
pub struct Limitation {
|
pub struct Limitation {
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
payment_required: Option<bool>,
|
payment_required: Option<bool>,
|
||||||
|
|
||||||
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
|
restricted_writes: Option<bool>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Debug)]
|
#[derive(Serialize, Deserialize, Debug)]
|
||||||
|
@ -75,6 +78,12 @@ impl From<Settings> for RelayInfo {
|
||||||
|
|
||||||
let limitations = Limitation {
|
let limitations = Limitation {
|
||||||
payment_required: Some(p.enabled),
|
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 {
|
let (payment_url, fees) = if p.enabled {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user