well-known/host-meta

This commit is contained in:
rimu 2024-02-14 10:16:49 +13:00
parent 2337c22afa
commit 77a0ee9b5d

View file

@ -2,7 +2,7 @@ from flask_login import current_user
from app import db, constants, cache, celery
from app.activitypub import bp
from flask import request, current_app, abort, jsonify, json, g, url_for, redirect
from flask import request, current_app, abort, jsonify, json, g, url_for, redirect, make_response
from app.activitypub.signature import HttpSignature, post_request
from app.community.routes import show_community
@ -79,6 +79,14 @@ def nodeinfo():
return jsonify(nodeinfo_data)
@bp.route('/.well-known/host-meta')
@cache.cached(timeout=600)
def host_meta():
resp = make_response(f'<?xml version="1.0" encoding="UTF-8"?>\n<XRD xmlns="http://docs.oasis-open.org/ns/xri/xrd-1.0">\n<Link rel="lrdd" template="https://{current_app.config["SERVER_NAME"]}/.well-known/webfinger?resource={uri}"/>\n</XRD>')
resp.content_type = 'application/xrd+xml; charset=utf-8'
return resp
@bp.route('/nodeinfo/2.0')
@bp.route('/nodeinfo/2.0.json')
@cache.cached(timeout=600)