Ryan Barrett 2023-02-07 13:51:15 -08:00
rodzic b5a0386cd0
commit c68e06654b
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 6BE31FDF4776E9D4
1 zmienionych plików z 61 dodań i 0 usunięć

Wyświetl plik

@ -2,6 +2,7 @@
import calendar
import datetime
import logging
import os
import re
import urllib.parse
@ -247,6 +248,66 @@ def stats():
)
@app.get('/.well-known/nodeinfo')
@flask_util.cached(cache, datetime.timedelta(days=1))
def nodeinfo_jrd():
"""
https://nodeinfo.diaspora.software/protocol.html
"""
return {
'links': [{
'rel': 'http://nodeinfo.diaspora.software/ns/schema/2.1',
'href': common.host_url('nodeinfo.json'),
}],
}, {
'Content-Type': 'application/jrd+json',
}
@app.get('/nodeinfo.json')
@flask_util.cached(cache, datetime.timedelta(days=1))
def nodeinfo():
"""
https://nodeinfo.diaspora.software/schema.html
"""
return {
'version': '2.1',
'software': {
'name': 'bridgy-fed',
'version': os.getenv('GAE_VERSION'),
'repository': 'https://github.com/snarfed/bridgy-fed',
'homepage': 'https://fed.brid.gy/',
},
'protocols': [
'activitypub',
'bluesky',
'webmention',
],
'services': {
'outbound': [],
'inbound': [],
},
'usage': {
'users': {
'total': KindStat.query(KindStat.kind_name == 'MagicKey').get().count,
# 'activeMonth':
# 'activeHalfyear':
},
'localPosts': Object.query(Object.source_protocol == 'webmention',
Object.type.IN(['note', 'article']),
).count(),
'localComments': Object.query(Object.source_protocol == 'webmention',
Object.type == 'comment',
).count(),
},
'openRegistrations': True,
'metadata': {},
}, {
# https://nodeinfo.diaspora.software/protocol.html
'Content-Type': 'application/json; profile="http://nodeinfo.diaspora.software/ns/schema/2.1#"',
}
@app.get('/log')
@flask_util.cached(cache, logs.CACHE_TIME)
def log():