Implement instance blocks
This commit is contained in:
parent
0727b739ed
commit
ee7ae3cd4f
2 changed files with 6 additions and 0 deletions
|
@ -438,6 +438,9 @@ pub async fn receive_activity(
|
||||||
})?;
|
})?;
|
||||||
let signer_id = signer.actor_id(&config.instance_url());
|
let signer_id = signer.actor_id(&config.instance_url());
|
||||||
log::debug!("activity signed by {}", signer_id);
|
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())
|
let activity: Activity = serde_json::from_value(activity_raw.clone())
|
||||||
.map_err(|_| ValidationError("invalid activity"))?;
|
.map_err(|_| ValidationError("invalid activity"))?;
|
||||||
|
|
|
@ -124,6 +124,9 @@ pub struct Config {
|
||||||
#[serde(default = "default_post_character_limit")]
|
#[serde(default = "default_post_character_limit")]
|
||||||
pub post_character_limit: usize,
|
pub post_character_limit: usize,
|
||||||
|
|
||||||
|
#[serde(default)]
|
||||||
|
pub blocked_instances: Vec<String>,
|
||||||
|
|
||||||
// Blockchain integration
|
// Blockchain integration
|
||||||
pub blockchain: Option<BlockchainConfig>,
|
pub blockchain: Option<BlockchainConfig>,
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue