2018-10-30 22:35:04 +00:00
|
|
|
import aiohttp.web
|
|
|
|
from . import app, CONFIG
|
2018-10-31 18:42:42 +00:00
|
|
|
from .database import DATABASE
|
2018-10-30 22:35:04 +00:00
|
|
|
|
|
|
|
host = CONFIG['ap']['host']
|
2018-10-30 22:43:16 +00:00
|
|
|
note = CONFIG['note']
|
2018-10-31 18:42:42 +00:00
|
|
|
targets = '<br>'.join([target for target in DATABASE.get('relay-list', [])])
|
2018-10-30 22:35:04 +00:00
|
|
|
|
|
|
|
async def default(request):
|
|
|
|
return aiohttp.web.Response(
|
|
|
|
status=200,
|
|
|
|
content_type="text/html",
|
|
|
|
charset="utf-8",
|
|
|
|
text="""
|
|
|
|
<html><head>
|
|
|
|
<title>ActivityPub Relay at {host}</title>
|
|
|
|
<style>
|
|
|
|
p {{ color: #FFFFFF; font-family: monospace, arial; font-size: 100%; }}
|
|
|
|
body {{ background-color: #000000; }}
|
|
|
|
</style>
|
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<p>This is an Activity Relay for fediverse instances.</p>
|
|
|
|
<p>{note}</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>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>
|
2018-10-31 18:42:42 +00:00
|
|
|
<br><p>List of registered instances:<br>{targets}</p>
|
2018-10-30 22:35:04 +00:00
|
|
|
</body></html>
|
|
|
|
|
2018-10-31 18:42:42 +00:00
|
|
|
""".format(host=host, note=note,targets=targets))
|
2018-10-30 22:35:04 +00:00
|
|
|
|
|
|
|
app.router.add_get('/', default)
|