diff --git a/src/app/[locale]/pages/marking-audio/page.tsx b/src/app/[locale]/pages/marking-audio/page.tsx
index 3683a77..f6b07a7 100644
--- a/src/app/[locale]/pages/marking-audio/page.tsx
+++ b/src/app/[locale]/pages/marking-audio/page.tsx
@@ -2,18 +2,17 @@ import ProtectionSummary from '@/app/ui/marking-page/protection-summary';
import FilesTable from '@/app/ui/dashboard/files-table';
import PageTitle from '@/app/ui/page-title';
import UploadSectionFile from '@/app/components/upload-section-file';
+import { getAllowedFilesExtensions } from '@/app/actions/file-upload';
-const ALLOWED_EXTENSIONS: string[] = ['jpg', 'jpeg', 'png', 'gif', 'bmp'];
-const FILE_TYPE = "AUDIO"
-const MAX_SIZE = 1048576000;
-
-export default function Page() {
+export default async function Page() {
+ const FILE_TYPE = "audio";
+ const { file_extension, max_file_size } = await getAllowedFilesExtensions(FILE_TYPE);
return (
-
+
{/*
*/}
{/*
*/}
diff --git a/src/app/[locale]/pages/marking-video/page.tsx b/src/app/[locale]/pages/marking-video/page.tsx
index c78b7ad..48bb4fd 100644
--- a/src/app/[locale]/pages/marking-video/page.tsx
+++ b/src/app/[locale]/pages/marking-video/page.tsx
@@ -1,20 +1,18 @@
import ProtectionSummary from '@/app/ui/marking-page/protection-summary';
-import UploadSectionVideo from '@/app/ui/marking-page/upload-section-video';
import FilesTable from '@/app/ui/dashboard/files-table';
import PageTitle from '@/app/ui/page-title';
import UploadSectionFile from '@/app/components/upload-section-file';
+import { getAllowedFilesExtensions } from '@/app/actions/file-upload';
-const ALLOWED_EXTENSIONS: string[] = ['mp4', 'avi', 'webm', 'mkv', 'flv', 'wmv', 'mov'];
-const FILE_TYPE = "VIDEO"
-const MAX_SIZE = 1048576000;
-
-export default function Page() {
+export default async function Page() {
+ const FILE_TYPE = "video";
+ const { file_extension, max_file_size } = await getAllowedFilesExtensions(FILE_TYPE);
return (
diff --git a/src/app/actions/file-upload.ts b/src/app/actions/file-upload.ts
index 6f4985d..4ac7d6a 100644
--- a/src/app/actions/file-upload.ts
+++ b/src/app/actions/file-upload.ts
@@ -187,10 +187,9 @@ export async function getAllowedFilesExtensions(type: string) {
if (response.ok) {
let parsed = await response.json();
- console.log(parsed);
if (parsed.message_desc === 'Operation successful') {
- return parsed.message_body.file_extension;
+ return parsed.message_body;
} else {
console.log('error cancel getAllowedFilesExtensions');
throw parsed;
diff --git a/src/app/components/upload-section-file.tsx b/src/app/components/upload-section-file.tsx
index 2ce6b26..2c4ab4f 100644
--- a/src/app/components/upload-section-file.tsx
+++ b/src/app/components/upload-section-file.tsx
@@ -43,7 +43,7 @@ export default function UploadSectionFile({ fileType, allowedExtensions, maxFile
let SUPPORTED_FORMATS: string[] = [];
switch (fileType) {
- case 'IMAGE':
+ case 'image':
SUPPORTED_FORMATS = [
'image/jpeg',
'image/jpg',
@@ -56,7 +56,7 @@ export default function UploadSectionFile({ fileType, allowedExtensions, maxFile
'image/x-icon'
];
break;
- case 'VIDEO':
+ case 'video':
SUPPORTED_FORMATS = [
'video/mp4',
'video/mpeg',
@@ -70,7 +70,7 @@ export default function UploadSectionFile({ fileType, allowedExtensions, maxFile
'video/3gpp2'
];
break;
- case 'AUDIO':
+ case 'audio':
SUPPORTED_FORMATS = [
'audio/mpeg',
'audio/wav',
@@ -159,7 +159,7 @@ export default function UploadSectionFile({ fileType, allowedExtensions, maxFile
try {
let dimensions = undefined;
- if (fileType === "IMAGE") {
+ if (fileType === "image") {
dimensions = await getImageDimensions(file) as { width: number, height: number };
if (dimensions.width < 150 || dimensions.height < 150 ||
dimensions.width > 10000 || dimensions.height > 10000) {
@@ -389,7 +389,7 @@ export default function UploadSectionFile({ fileType, allowedExtensions, maxFile
{t('select-files-to-protect')}
- {fileType === "IMAGE" && (
+ {fileType === "image" && (
Разрешение изображение: 100x100 - 10000x10000
@@ -439,7 +439,7 @@ export default function UploadSectionFile({ fileType, allowedExtensions, maxFile
- {fileType === 'IMAGE' && (
+ {fileType === 'image' && (