Files
ad/molodetz/routers/admin/index.py
T
retoor 9fb4d65787 Member invites, gallery resync, content and operator docs
- Invite flow: admin issue/revoke on join requests, public single-use
  claim links (hash-only tokens, 7-day expiry, no state reveal), claim
  creates the Member account and marks the request accepted
- Gallery: admin status page plus resync endpoint; sync refreshes
  thumbnails whose content changed; tools/gallery contract and checker
- Docs: public content page, admin-only operator runbook, api.md
  invite/gallery sections, all routes in the live API docs, docs
  reachability gate test
- Screenshots cover the new pages; version 1.0.18
2026-10-06 02:56:08 +02:00

27 lines
955 B
Python

# retoor <retoor@molodetz.nl>
from fastapi import APIRouter, Request
from molodetz.constants import SOFT_DELETE_TABLES
from molodetz.database import all_posts, count_deleted, count_media, count_open_join_requests, count_users
from molodetz.responses import respond
from molodetz.routers.admin._shared import admin_seo
from molodetz.schemas.admin import AdminIndexOut
from molodetz.utils.auth import require_admin
router = APIRouter()
@router.get("")
async def admin_index(request: Request):
require_admin(request)
ctx = {
"post_count": len(all_posts()),
"open_joins": count_open_join_requests(),
"user_count": count_users(),
"deleted_count": sum(count_deleted(name) for name in SOFT_DELETE_TABLES),
"flyer_count": count_media("flyer"),
"meme_count": count_media("meme"),
"seo": admin_seo(request, "Admin"),
}
return respond(request, "admin/index.html", ctx, model=AdminIndexOut)