Also update the nodeinfo endpoint

This commit is contained in:
Thomas Sileo 2018-07-07 13:08:16 +02:00
parent 285d2fa890
commit 354a9ad13f

7
app.py
View file

@ -762,6 +762,11 @@ def note_by_id(note_id):
@app.route("/nodeinfo") @app.route("/nodeinfo")
def nodeinfo(): def nodeinfo():
q = {
"box": Box.OUTBOX.value,
"meta.deleted": False, # TODO(tsileo): retrieve deleted and expose tombstone
'type': {'$in': [ActivityType.CREATE.value, ActivityType.ANNOUNCE.value]},
}
return Response( return Response(
headers={ headers={
"Content-Type": "application/json; profile=http://nodeinfo.diaspora.software/ns/schema/2.0#" "Content-Type": "application/json; profile=http://nodeinfo.diaspora.software/ns/schema/2.0#"
@ -778,7 +783,7 @@ def nodeinfo():
"openRegistrations": False, "openRegistrations": False,
"usage": { "usage": {
"users": {"total": 1}, "users": {"total": 1},
"localPosts": DB.activities.count({"box": Box.OUTBOX.value}), "localPosts": DB.activities.count(q),
}, },
"metadata": { "metadata": {
"sourceCode": "https://github.com/tsileo/microblog.pub", "sourceCode": "https://github.com/tsileo/microblog.pub",