This commit is contained in:
Mikan
2026-06-21 07:52:25 +03:00
parent e98559a587
commit 7cbe8da103
25 changed files with 1091 additions and 284 deletions

View File

@@ -68,14 +68,36 @@ async def public_settings(db: AsyncSession = Depends(get_db)) -> dict:
favicon_url = await get_setting(db, "ui.favicon_url")
logo_url = await get_setting(db, "ui.logo_url")
og_image_url = await get_setting(db, "ui.og_image_url")
header_title = await get_setting(db, "ui.header_title")
return {
"page_title": page_title or "AI-RPG",
"favicon_url": favicon_url or "/icon.png",
"logo_url": logo_url or "/icon.png",
"og_image_url": og_image_url or "",
"header_title": header_title or page_title or "AI-RPG",
}
@router.get("/names/{language}")
async def get_name_bank(
language: str,
db: AsyncSession = Depends(get_db),
) -> dict:
"""Return a random character name for the given language.
No auth required — used by the world builder form's "random name" button.
"""
import random
key = f"character_names.{language}"
names = await get_setting(db, key)
if not names or not isinstance(names, list):
# Fallback to English
names = await get_setting(db, "character_names.en") or ["Hero"]
pick = random.choice(names) if names else "Hero"
return {"name": pick, "language": language, "count": len(names)}
@router.get("/i18n/{lang}")
async def i18n(lang: str) -> dict:
"""Return translation JSON for the given language."""