import aiohttp.web import urllib.parse from . import app, CONFIG from .database import DATABASE host = CONFIG['ap']['host'] note = CONFIG['note'] inboxes = DATABASE.get('relay-list', []) async def default(request): targets = '
'.join([urllib.parse.urlsplit(target).hostname for target in inboxes]) return aiohttp.web.Response( status=200, content_type="text/html", charset="utf-8", text=""" ActivityPub Relay at {host}

This is an Activity Relay for fediverse instances.

{note}

For Mastodon instances, you may subscribe to this relay with the address: https://{host}/inbox

For Pleroma and other instances, you may subscribe to this relay with the address: https://{host}/actor

To host your own relay, you may download the code at this address: https://git.pleroma.social/pleroma/relay


List of {count} registered instances:
{targets}

""".format(host=host, note=note,targets=targets,count=len(inboxes))) app.router.add_get('/', default)