mirror of
https://git.sr.ht/~tsileo/microblog.pub
synced 2024-11-15 03:04:28 +00:00
Tweak the trash
This commit is contained in:
parent
160136acdf
commit
31d356ea49
1 changed files with 14 additions and 15 deletions
15
app.py
15
app.py
|
@ -1756,11 +1756,7 @@ def inbox():
|
||||||
return Response(
|
return Response(
|
||||||
status=422,
|
status=422,
|
||||||
headers={"Content-Type": "application/json"},
|
headers={"Content-Type": "application/json"},
|
||||||
response=json.dumps(
|
response=json.dumps({"error": "failed to decode request as JSON"}),
|
||||||
{
|
|
||||||
"error": "failed to decode request as JSON"
|
|
||||||
}
|
|
||||||
),
|
|
||||||
)
|
)
|
||||||
|
|
||||||
print(f"req_headers={request.headers}")
|
print(f"req_headers={request.headers}")
|
||||||
|
@ -1789,20 +1785,23 @@ def inbox():
|
||||||
|
|
||||||
return Response(status=201)
|
return Response(status=201)
|
||||||
except Exception:
|
except Exception:
|
||||||
logger.exception(f'failed to fetch remote for payload {data!r}')
|
logger.exception(f"failed to fetch remote for payload {data!r}")
|
||||||
|
|
||||||
# Track/store the payload for analysis
|
# Track/store the payload for analysis
|
||||||
ip, geoip = _get_ip()
|
ip, geoip = _get_ip()
|
||||||
|
|
||||||
DB.trash.insert({
|
DB.trash.insert(
|
||||||
|
{
|
||||||
"activity": data,
|
"activity": data,
|
||||||
"meta": {
|
"meta": {
|
||||||
"ts": datetime.now().timestamp(),
|
"ts": datetime.now().timestamp(),
|
||||||
"ip_address": ip,
|
"ip_address": ip,
|
||||||
"geoip": geoip,
|
"geoip": geoip,
|
||||||
"tb": traceback.format_exc(),
|
"tb": traceback.format_exc(),
|
||||||
|
"headers": dict(request.headers),
|
||||||
},
|
},
|
||||||
})
|
}
|
||||||
|
)
|
||||||
|
|
||||||
return Response(
|
return Response(
|
||||||
status=422,
|
status=422,
|
||||||
|
|
Loading…
Reference in a new issue