mirror of
https://github.com/scsibug/nostr-rs-relay.git
synced 2024-11-09 21:29:06 -05:00
234a8ba0ac
This adds a new configurable feature to restrict event publishing to only users with NIP-05 verified metadata. Domains can be whitelisted or blacklisted. Verification expiration and schedules are configurable. This upgrades the database to add a table for tracking verification records.
43 lines
1.4 KiB
Rust
43 lines
1.4 KiB
Rust
use crate::config;
|
|
/// Relay Info
|
|
use serde::{Deserialize, Serialize};
|
|
|
|
pub const CARGO_PKG_VERSION: Option<&'static str> = option_env!("CARGO_PKG_VERSION");
|
|
|
|
#[derive(Debug, Serialize, Deserialize)]
|
|
#[allow(unused)]
|
|
pub struct RelayInfo {
|
|
#[serde(skip_serializing_if = "Option::is_none")]
|
|
pub id: Option<String>,
|
|
#[serde(skip_serializing_if = "Option::is_none")]
|
|
pub name: Option<String>,
|
|
#[serde(skip_serializing_if = "Option::is_none")]
|
|
pub description: Option<String>,
|
|
#[serde(skip_serializing_if = "Option::is_none")]
|
|
pub pubkey: Option<String>,
|
|
#[serde(skip_serializing_if = "Option::is_none")]
|
|
pub contact: Option<String>,
|
|
#[serde(skip_serializing_if = "Option::is_none")]
|
|
pub supported_nips: Option<Vec<i64>>,
|
|
#[serde(skip_serializing_if = "Option::is_none")]
|
|
pub software: Option<String>,
|
|
#[serde(skip_serializing_if = "Option::is_none")]
|
|
pub version: Option<String>,
|
|
}
|
|
|
|
/// Convert an Info configuration into public Relay Info
|
|
impl From<config::Info> for RelayInfo {
|
|
fn from(i: config::Info) -> Self {
|
|
RelayInfo {
|
|
id: i.relay_url,
|
|
name: i.name,
|
|
description: i.description,
|
|
pubkey: i.pubkey,
|
|
contact: i.contact,
|
|
supported_nips: Some(vec![1, 2, 11]),
|
|
software: Some("https://git.sr.ht/~gheartsfield/nostr-rs-relay".to_owned()),
|
|
version: CARGO_PKG_VERSION.map(|x| x.to_owned()),
|
|
}
|
|
}
|
|
}
|