mirror of
https://git.sr.ht/~tsileo/microblog.pub
synced 2024-11-15 03:04:28 +00:00
Improve the trash
This commit is contained in:
parent
756765733e
commit
ba9f945b7b
1 changed files with 22 additions and 4 deletions
20
app.py
20
app.py
|
@ -1831,11 +1831,29 @@ def inbox():
|
|||
except Exception:
|
||||
logger.exception(f"failed to fetch remote for payload {data!r}")
|
||||
|
||||
if "type" in data:
|
||||
# Friendica does not returns a 410, but a 302 that redirect to an HTML page
|
||||
if ap._has_type(data["type"], ActivityType.DELETE):
|
||||
logger.info(f"received a Delete for an unknown actor {data!r}, drop it")
|
||||
logger.info(
|
||||
f"received a Delete for an unknown actor {data!r}, drop it"
|
||||
)
|
||||
return Response(status=201)
|
||||
|
||||
if "id" in data:
|
||||
if DB.trash.find_one({"activity.id": data["id"]}):
|
||||
# It's already stored in trash, returns early
|
||||
return Response(
|
||||
status=422,
|
||||
headers={"Content-Type": "application/json"},
|
||||
response=json.dumps(
|
||||
{
|
||||
"error": "failed to verify request (using HTTP signatures or fetching the IRI)"
|
||||
}
|
||||
),
|
||||
)
|
||||
|
||||
# Now we can store this activity in the trash for later analysis
|
||||
|
||||
# Track/store the payload for analysis
|
||||
ip, geoip = _get_ip()
|
||||
|
||||
|
|
Loading…
Reference in a new issue