Enumerate pending follows, fix CSS

This commit is contained in:
Reid 'arrdem' McKenzie 2022-11-26 21:56:33 -07:00
parent 8cf17b942b
commit c8388e0856

View file

@ -25,17 +25,18 @@ def register_route(method, path):
@register_route("GET", "/")
async def home(request):
targets = "<ul>" + "\n".join(f"<li>{it}</li>" for it in request.app.database.hostnames) + "</ul>"
following = "<ul>" + ("\n".join(f"<li>{it}</li>" for it in request.app.database.hostnames)) + "</ul>"
following_count = len(request.app.database.hostnames)
requested = "<ul>" + ("\n".join(f"<li>{it}</li>" for it in request.app.database["follow-requests"])) + "</ul>"
requested_count = len(request.app.database["follow-requests"])
note = request.app.config.note
count = len(request.app.database.hostnames)
host = request.app.config.host
text = f"""\
<html><head>
<title>ActivityPub Relay at {host}</title>
<style>
p {{ color: #FFFFFF; font-family: monospace, arial; font-size: 100%; }}
body {{ background-color: #000000; }}
body {{ background-color: #000000; color: #FFFFFF; font-family: monospace, arial; font-size: 100%; }}
a {{ color: #26F; }}
a:visited {{ color: #46C; }}
a:hover {{ color: #8AF; }}
@ -45,7 +46,8 @@ a:hover {{ color: #8AF; }}
<p>This is an Activity Relay for fediverse instances.</p>
<p>{note}</p>
<p>To host your own relay, you may download the code at this address: <a href="https://git.arrdem.com/arrdem/source/src/branch/trunk/projects/activitypub_relay">https://git.arrdem.com/arrdem/source/src/branch/trunk/projects/activitypub_relay</a></p>
<br><p>List of {count} registered instances:<br>{targets}</p>
<br><p>This relay is peered with {following_count} registered instances:<br>{following}</p>
<br><p>Another {requested_count} peers await approval:<br>{requested}</p>
</body></html>"""
return Response.new(text, ctype="html")