Implement instance blocks

This commit is contained in:
silverpill 2022-02-23 23:31:56 +00:00
parent 0727b739ed
commit ee7ae3cd4f
2 changed files with 6 additions and 0 deletions

View file

@ -438,6 +438,9 @@ pub async fn receive_activity(
})?;
let signer_id = signer.actor_id(&config.instance_url());
log::debug!("activity signed by {}", signer_id);
if config.blocked_instances.iter().any(|instance| signer.acct.contains(instance)) {
return Err(HttpError::ValidationError("instance is blocked".into()));
};
let activity: Activity = serde_json::from_value(activity_raw.clone())
.map_err(|_| ValidationError("invalid activity"))?;

View file

@ -124,6 +124,9 @@ pub struct Config {
#[serde(default = "default_post_character_limit")]
pub post_character_limit: usize,
#[serde(default)]
pub blocked_instances: Vec<String>,
// Blockchain integration
pub blockchain: Option<BlockchainConfig>,