import asyncio
from pathlib import Path
import os
import inject
import markdown
from litestar import (
Controller,
get,
post,
MediaType,
Litestar,
)
from litestar.enums import RequestEncodingType
from litestar.datastructures import UploadFile
from litestar.params import Body
from litestar.exceptions import HTTPException
from litestar.contrib.jinja import JinjaTemplateEngine
from litestar.template.config import TemplateConfig
from litestar.response import Template
from litestar.static_files import create_static_files_router
from server.infra import logger
from server.config import get_app_config
from server.infra.cache import LocalCacheRepository
from server.infra.db import AsyncDB
from server.modules.descriptions import CharactersService, Breed, CharactersRepository
from server.modules.recognizer import RecognizerService, RecognizerRepository
class SeoController(Controller):
@get("/sitemap.xml", media_type=MediaType.XML)
async def sitemaps(self) -> bytes:
breeds: list[Breed] = await characters_service.get_characters()
lastmod = "2025-10-04T19:01:03+00:00"
beers_url = ""
for b in breeds:
beers_url += f"""
https://xn-----6kcp3cadbabfh8a0a.xn--p1ai/dogs-characteristics/{b.alias}
{lastmod}
"""
return f"""
https://xn-----6kcp3cadbabfh8a0a.xn--p1ai/
{lastmod}
https://xn-----6kcp3cadbabfh8a0a.xn--p1ai/cats
{lastmod}
https://xn-----6kcp3cadbabfh8a0a.xn--p1ai/donate
{lastmod}
https://xn-----6kcp3cadbabfh8a0a.xn--p1ai/dogs-characteristics
{lastmod}
{beers_url}
""".encode()
@get("/robots.txt", media_type=MediaType.TEXT)
async def robots(self) -> str:
return """
User-agent: *
Allow: /
Sitemap: https://xn-----6kcp3cadbabfh8a0a.xn--p1ai/sitemap.xml
"""