feat(ui): show country flag emoji next to country codes

This commit is contained in:
2026-07-05 21:40:46 +08:00
parent 9692ff8ade
commit 7a62ff0818
3 changed files with 11 additions and 2 deletions

View File

@@ -23,6 +23,15 @@ router = APIRouter(tags=["web"])
templates = Jinja2Templates(directory=str(Path(__file__).resolve().parent.parent / "templates"))
def _country_flag(code: str) -> str:
if not code or len(code) != 2:
return code or ""
return chr(0x1F1E6 + ord(code[0].upper()) - ord("A")) + chr(0x1F1E6 + ord(code[1].upper()) - ord("A"))
templates.env.filters["flag"] = _country_flag
def _redirect(url: str) -> RedirectResponse:
return RedirectResponse(url, status_code=303)