Merge branch 'list_reged_instances' into 'master'

expose the list of registered targets to default page

See merge request pleroma/relay!2
This commit is contained in:
kaniini 2018-11-01 10:04:33 +00:00
commit 388bd8d946
1 changed files with 5 additions and 1 deletions

View File

@ -1,8 +1,11 @@
import aiohttp.web import aiohttp.web
import re
from . import app, CONFIG from . import app, CONFIG
from .database import DATABASE
host = CONFIG['ap']['host'] host = CONFIG['ap']['host']
note = CONFIG['note'] note = CONFIG['note']
targets = '<br>'.join([re.search('https://(.*)/inbox',target).group(1) for target in DATABASE.get('relay-list', [])])
async def default(request): async def default(request):
return aiohttp.web.Response( return aiohttp.web.Response(
@ -23,8 +26,9 @@ async def default(request):
<p>For Mastodon instances, you may subscribe to this relay with the address: <a href="https://{host}/inbox">https://{host}/inbox</a></p> <p>For Mastodon instances, you may subscribe to this relay with the address: <a href="https://{host}/inbox">https://{host}/inbox</a></p>
<p>For Pleroma and other instances, you may subscribe to this relay with the address: <a href="https://{host}/actor">https://{host}/actor</a></p> <p>For Pleroma and other instances, you may subscribe to this relay with the address: <a href="https://{host}/actor">https://{host}/actor</a></p>
<p>To host your own relay, you may download the code at this address: <a href="https://git.pleroma.social/pleroma/relay">https://git.pleroma.social/pleroma/relay</a></p> <p>To host your own relay, you may download the code at this address: <a href="https://git.pleroma.social/pleroma/relay">https://git.pleroma.social/pleroma/relay</a></p>
<br><p>List of registered instances:<br>{targets}</p>
</body></html> </body></html>
""".format(host=host, note=note)) """.format(host=host, note=note,targets=targets))
app.router.add_get('/', default) app.router.add_get('/', default)