fix: now supports video / gif baners

This commit is contained in:
2026-06-12 12:15:31 +03:00
parent c3390a5887
commit 2770ae1ccc
2 changed files with 11 additions and 4 deletions

View File

@@ -523,6 +523,10 @@ class Limoka(loader.Module):
async def _validate_url(self, url: str) -> Optional[str]:
if not url or url in self._invalid_banners:
return None
def _is_supported_media(content_type: str) -> bool:
return content_type.startswith("image/") or content_type.startswith("video/mp4")
try:
async with aiohttp.ClientSession() as session:
async with session.head(
@@ -532,7 +536,7 @@ class Limoka(loader.Module):
self._invalid_banners.add(url)
return None
ct = response.headers.get("Content-Type", "").lower()
if not ct.startswith("image/"):
if not _is_supported_media(ct):
self._invalid_banners.add(url)
return None
return url