New web ui

This commit is contained in:
nyan404 committed 2026-08-17 02:31:18 +03:00
1 parent a360fd9c63
commit caee27c3ea
11 files changed
+248 -16

No files matched your search

+6
View File
@@ -55,6 +55,12 @@ class ImageHostClient:
body = response.read()
content_type = response.headers.get_content_type() or "image/jpeg"
file_name = f"vk-{photo.get('owner_id', 'photo')}-{photo.get('id', 'upload')}.jpg"
return self.upload_bytes(body, file_name, content_type)
def upload_bytes(self, body: bytes, file_name: str, content_type: str = "image/jpeg") -> str | None:
"""Загружает произвольный файл на image-host и возвращает прямую ссылку."""
if not self.api_url or not body:
return None
initiate = self._request_json(
"/api/uploads/initiate",
{