From b15665eb1f518ef16bc6deb87ed49dc439969b42 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tristan=20Mah=C3=A9?= Date: Wed, 31 Oct 2018 11:42:42 -0700 Subject: [PATCH 1/2] expose the list of registered targets to default page --- relay/default.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/relay/default.py b/relay/default.py index cc08e06..de2dc1e 100644 --- a/relay/default.py +++ b/relay/default.py @@ -1,8 +1,10 @@ import aiohttp.web from . import app, CONFIG +from .database import DATABASE host = CONFIG['ap']['host'] note = CONFIG['note'] +targets = '
'.join([target for target in DATABASE.get('relay-list', [])]) async def default(request): return aiohttp.web.Response( @@ -23,8 +25,9 @@ async def default(request):

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 registered instances:
{targets}

-""".format(host=host, note=note)) +""".format(host=host, note=note,targets=targets)) app.router.add_get('/', default) From 12af824b56159d24ffe5cd22eb9fe46be52bb25d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tristan=20Mah=C3=A9?= Date: Wed, 31 Oct 2018 11:58:10 -0700 Subject: [PATCH 2/2] format instance name instead of inbox url --- relay/default.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/relay/default.py b/relay/default.py index de2dc1e..172c9d3 100644 --- a/relay/default.py +++ b/relay/default.py @@ -1,10 +1,11 @@ import aiohttp.web +import re from . import app, CONFIG from .database import DATABASE host = CONFIG['ap']['host'] note = CONFIG['note'] -targets = '
'.join([target for target in DATABASE.get('relay-list', [])]) +targets = '
'.join([re.search('https://(.*)/inbox',target).group(1) for target in DATABASE.get('relay-list', [])]) async def default(request): return aiohttp.web.Response(