Add NodeInfo support
This commit is contained in:
parent
791e55c7f5
commit
ef5b32a33c
1 changed files with 32 additions and 1 deletions
33
app.py
33
app.py
|
@ -447,8 +447,39 @@ def note_by_id(note_id):
|
|||
return render_template('note.html', me=ME, note=data, replies=replies)
|
||||
|
||||
|
||||
@app.route('/nodeinfo')
|
||||
def nodeinfo():
|
||||
return Response(
|
||||
headers={'Content-Type': 'application/json; profile=http://nodeinfo.diaspora.software/ns/schema/2.0#'},
|
||||
response=json.dumps({
|
||||
'version': '2.0',
|
||||
'software': {'name': 'microblogpub', 'version': f'Microblog.pub {VERSION}'},
|
||||
'protocols': ['activitypub'],
|
||||
'services': {'inbound': [], 'outbound': []},
|
||||
'openRegistrations': False,
|
||||
'usage': {'users': {'total': 1}, 'localPosts': DB.outbox.count()},
|
||||
'metadata': {
|
||||
'sourceCode': 'https://github.com/tsileo/microblog.pub',
|
||||
},
|
||||
}),
|
||||
)
|
||||
|
||||
|
||||
@app.route('/.well-known/nodeinfo')
|
||||
def wellknown_nodeinfo():
|
||||
return flask_jsonify(
|
||||
links=[
|
||||
{
|
||||
'rel': 'http://nodeinfo.diaspora.software/ns/schema/2.0',
|
||||
'href': f'{ID}/nodeinfo',
|
||||
}
|
||||
|
||||
],
|
||||
)
|
||||
|
||||
|
||||
@app.route('/.well-known/webfinger')
|
||||
def webfinger():
|
||||
def wellknown_webfinger():
|
||||
"""Enable WebFinger support, required for Mastodon interopability."""
|
||||
resource = request.args.get('resource')
|
||||
if resource not in ["acct:"+USERNAME+"@"+DOMAIN, ID]:
|
||||
|
|
Loading…
Reference in a new issue