INNER CODE UNIT · Python
admin_page
SPThole/CoexistAI · app.py:273
async def admin_page():
"""Serve the static admin UI and inject the ASCII banner at request time.
The static UI lives at ./static/admin.html so it's easier to edit and keep
app.py small.
"""
try:
static_path = os.path.join(os.path.dirname(__file__), 'static', 'admin.html')
with open(static_path, 'r', encoding='utf-8') as f:
html = f.read()
except Exception as e:
return HTMLResponse(content=f"<html><body>Error loading admin UI: {e}</body></html>", status_code=500)
# inject the ascii banner into the HTML, escaped for safety
try:
banner = get_ascii_banner() or ''
banner_html = _html.escape(banner)
html = html.replace('BANNER_PLACEHOLDER', banner_html)
except Exception: