fix: jfc mastodon stop sending me deletions!!!!!!!
This commit is contained in:
parent
6edda7236e
commit
b338a7191f
2 changed files with 4 additions and 2 deletions
|
@ -53,7 +53,9 @@ pub async fn post(
|
||||||
Json(activity): Json<serde_json::Value>
|
Json(activity): Json<serde_json::Value>
|
||||||
) -> crate::Result<()> {
|
) -> crate::Result<()> {
|
||||||
if !matches!(auth, Identity::Remote(_)) {
|
if !matches!(auth, Identity::Remote(_)) {
|
||||||
|
if activity.activity_type() != Some(ActivityType::Delete) { // this is spammy af, ignore them!
|
||||||
tracing::warn!("refusing unauthorized activity: {}", pretty_json!(activity));
|
tracing::warn!("refusing unauthorized activity: {}", pretty_json!(activity));
|
||||||
|
}
|
||||||
match auth {
|
match auth {
|
||||||
Identity::Local(_user) => return Err(UpubError::forbidden()),
|
Identity::Local(_user) => return Err(UpubError::forbidden()),
|
||||||
Identity::Anonymous => return Err(UpubError::unauthorized()),
|
Identity::Anonymous => return Err(UpubError::unauthorized()),
|
||||||
|
|
|
@ -158,7 +158,7 @@ impl apb::server::Inbox for Context {
|
||||||
async fn delete(&self, activity: serde_json::Value) -> crate::Result<()> {
|
async fn delete(&self, activity: serde_json::Value) -> crate::Result<()> {
|
||||||
// TODO verify the signature before just deleting lmao
|
// TODO verify the signature before just deleting lmao
|
||||||
let oid = activity.object().id().ok_or(UpubError::bad_request())?;
|
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?
|
// 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::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");
|
model::activity::Entity::delete_by_id(&oid).exec(self.db()).await.info_failed("failed deleting from activities");
|
||||||
|
|
Loading…
Reference in a new issue