mirror of
https://git.pleroma.social/pleroma/relay.git
synced 2024-11-24 15:31:08 +00:00
add basic webfinger support, good enough for now
This commit is contained in:
parent
2d16ed3cde
commit
af263031e8
|
@ -20,3 +20,5 @@ app = aiohttp.web.Application()
|
|||
|
||||
from . import database
|
||||
from . import actor
|
||||
from . import webfinger
|
||||
|
||||
|
|
24
viera/webfinger.py
Normal file
24
viera/webfinger.py
Normal file
|
@ -0,0 +1,24 @@
|
|||
import aiohttp.web
|
||||
from . import app
|
||||
|
||||
|
||||
async def webfinger(request):
|
||||
subject = request.query['resource']
|
||||
|
||||
if subject != 'acct:viera@{}'.format(request.host):
|
||||
return aiohttp.web.json_response({'error': 'user not found'}, status=404)
|
||||
|
||||
actor_uri = "https://{}/actor".format(request.host)
|
||||
data = {
|
||||
"aliases": [actor_uri],
|
||||
"links": [
|
||||
{"href": actor_uri, "rel": "self", "type": "application/activity+json"},
|
||||
{"href": actor_uri, "rel": "self", "type": "application/ld+json; profile=\"https://www.w3.org/ns/activitystreams\""}
|
||||
],
|
||||
"subject": subject
|
||||
}
|
||||
|
||||
return aiohttp.web.json_response(data)
|
||||
|
||||
|
||||
app.router.add_get('/.well-known/webfinger', webfinger)
|
Loading…
Reference in a new issue