update vk auth
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user