1
0
Fork 0
forked from alemi/upub

fix: jfc mastodon stop sending me deletions!!!!!!!

This commit is contained in:
əlemi 2024-04-19 16:15:05 +02:00
parent 6edda7236e
commit b338a7191f
Signed by: alemi
GPG key ID: A4895B84D311642C
2 changed files with 4 additions and 2 deletions

View file

@ -53,7 +53,9 @@ pub async fn post(
Json(activity): Json<serde_json::Value>
) -> crate::Result<()> {
if !matches!(auth, Identity::Remote(_)) {
tracing::warn!("refusing unauthorized activity: {}", pretty_json!(activity));
if activity.activity_type() != Some(ActivityType::Delete) { // this is spammy af, ignore them!
tracing::warn!("refusing unauthorized activity: {}", pretty_json!(activity));
}
match auth {
Identity::Local(_user) => return Err(UpubError::forbidden()),
Identity::Anonymous => return Err(UpubError::unauthorized()),

View file

@ -158,7 +158,7 @@ impl apb::server::Inbox for Context {
async fn delete(&self, activity: serde_json::Value) -> crate::Result<()> {
// TODO verify the signature before just deleting lmao
let oid = activity.object().id().ok_or(UpubError::bad_request())?;
tracing::info!("deleting '{oid}'");
tracing::debug!("deleting '{oid}'"); // this is so spammy wtf!
// TODO maybe we should keep the tombstone?
model::user::Entity::delete_by_id(&oid).exec(self.db()).await.info_failed("failed deleting from users");
model::activity::Entity::delete_by_id(&oid).exec(self.db()).await.info_failed("failed deleting from activities");