update vk auth

This commit is contained in:
smanylov
2026-01-07 19:14:37 +07:00
parent fe5fd79d85
commit d3bbc593a6
4 changed files with 29 additions and 72 deletions
+2 -53
View File
@@ -43,57 +43,6 @@ export default function UploadSectionFile({ fileType, allowedExtensions, maxFile
const isCancelledRef = useRef(false);
const t = useTranslations('Global');
let SUPPORTED_FORMATS: string[] = [];
switch (fileType) {
case 'image':
SUPPORTED_FORMATS = [
'image/jpeg',
'image/jpg',
'image/png',
'image/gif',
'image/bmp',
'image/webp',
'image/svg+xml',
'image/tiff',
'image/x-icon'
];
break;
case 'video':
SUPPORTED_FORMATS = [
'video/mp4',
'video/mpeg',
'video/ogg',
'video/webm',
'video/quicktime',
'video/x-msvideo',
'video/x-matroska',
'video/x-flv',
'video/3gpp',
'video/3gpp2'
];
break;
case 'audio':
SUPPORTED_FORMATS = [
'audio/mpeg',
'audio/wav',
'audio/wave',
'audio/x-wav',
'audio/x-pn-wav',
'audio/ogg',
'audio/webm',
'audio/aac',
'audio/mp4',
'audio/x-m4a',
'audio/flac',
'audio/x-flac',
'audio/opus'
];
break;
default:
break;
};
const acceptString = useMemo(() => {
if (!allowedExtensions || !Array.isArray(allowedExtensions)) {
@@ -103,7 +52,7 @@ export default function UploadSectionFile({ fileType, allowedExtensions, maxFile
}, [allowedExtensions]);
const validateFile = (file: File): { isValid: boolean; errorMessage?: string } => {
if (!SUPPORTED_FORMATS.includes(file.type as string)) {
if (!allowedExtensions.includes(file.type as string)) {
const extension = file.name.split('.').pop()?.toLowerCase();
if (!extension || !allowedExtensions.includes(extension as string)) {
return {
@@ -169,7 +118,7 @@ export default function UploadSectionFile({ fileType, allowedExtensions, maxFile
if (fileType === "image") {
try {
dimensions = await getImageDimensions(file) as { width: number, height: number };
if (dimensions.width < 150 || dimensions.height < 150 ||
if (dimensions.width < 100 || dimensions.height < 100 ||
dimensions.width > 10000 || dimensions.height > 10000) {
setError(`${t('image-size')}: ${dimensions.width}x${dimensions.height}. ${t('acceptable-range')}: 100x100 - 10000x10000 ${t('pixels')}.`);
return;