2018-10-30 22:35:04 +00:00
|
|
|
import aiohttp.web
|
2018-11-01 21:49:48 +00:00
|
|
|
import urllib.parse
|
2018-10-30 22:35:04 +00:00
|
|
|
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-11-01 21:49:48 +00:00
|
|
|
|
|
|
|
inboxes = DATABASE.get('relay-list', [])
|
2018-10-30 22:35:04 +00:00
|
|
|
|
|
|
|
async def default(request):
|
2018-12-10 22:14:43 +00:00
|
|
|
targets = '<br>'.join([urllib.parse.urlsplit(target).hostname for target in inboxes])
|
2018-10-30 22:35:04 +00:00
|
|
|
return aiohttp.web.Response(
|
|
|
|
status=200,
|
|
|
|
content_type="text/html",
|
|
|
|
charset="utf-8",
|
2019-01-17 23:04:07 +00:00
|
|
|
text="""
|
2018-10-30 22:35:04 +00:00
|
|
|
<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>
|
2021-08-12 20:13:10 +00:00
|
|
|
<p>For Mastodon and Misskey instances, you may subscribe to this relay with the address: <a href="https://{host}/inbox">https://{host}/inbox</a></p>
|
2018-10-30 22:35:04 +00:00
|
|
|
<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>
|
2021-12-14 23:33:38 +00:00
|
|
|
<p>To host your own relay, you may download the code at this address: <a href="https://git.nogafam.es/nobigtech/pleroma-relay">https://git.nogafam.es/nobigtech/pleroma-relay</a></p>
|
2018-11-01 21:49:48 +00:00
|
|
|
<br><p>List of {count} registered instances:<br>{targets}</p>
|
2018-10-30 22:35:04 +00:00
|
|
|
</body></html>
|
|
|
|
|
2018-11-01 21:49:48 +00:00
|
|
|
""".format(host=host, note=note,targets=targets,count=len(inboxes)))
|
2018-10-30 22:35:04 +00:00
|
|
|
|
|
|
|
app.router.add_get('/', default)
|