fix and update

This commit is contained in:
lendry
2026-06-29 22:51:25 +03:00
parent 885b07d76b
commit 57cb58347b
30 changed files with 799 additions and 187 deletions

View File

@@ -1,15 +1,7 @@
import { fetchMediaBlobWithRetry } from '@/lib/resilient-media-fetch';
export async function fetchAuthenticatedMediaBlob(accessUrl: string, token: string, mimeType?: string) {
const response = await fetch(accessUrl, {
headers: { Authorization: `Bearer ${token}` }
});
if (!response.ok) {
throw new Error('Не удалось загрузить файл');
}
const raw = await response.blob();
if (mimeType && (!raw.type || raw.type === 'application/octet-stream')) {
return new Blob([await raw.arrayBuffer()], { type: mimeType });
}
return raw;
return fetchMediaBlobWithRetry(accessUrl, token, { mimeType, label: 'файл чата' });
}
export function createBlobObjectUrl(blob: Blob) {