From 68c5a1b1dc703dec27f974dd86f43a616c68d48d Mon Sep 17 00:00:00 2001 From: M Gilang Januar Date: Tue, 7 Jun 2022 08:27:18 +0700 Subject: [PATCH 1/3] fix duplicate files shows --- api/src/api/v1/Files.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/api/src/api/v1/Files.ts b/api/src/api/v1/Files.ts index a06f5cd33..bb6aa2b1b 100644 --- a/api/src/api/v1/Files.ts +++ b/api/src/api/v1/Files.ts @@ -127,6 +127,14 @@ export class Files { { NOT: { name: { endsWith: '11' } } }, { NOT: { name: { endsWith: '111' } } }, { NOT: { name: { endsWith: '1111' } } }, + { NOT: { name: { endsWith: '21' } } }, + { NOT: { name: { endsWith: '31' } } }, + { NOT: { name: { endsWith: '41' } } }, + { NOT: { name: { endsWith: '51' } } }, + { NOT: { name: { endsWith: '61' } } }, + { NOT: { name: { endsWith: '71' } } }, + { NOT: { name: { endsWith: '81' } } }, + { NOT: { name: { endsWith: '91' } } }, ] }, { From e5b1c01e3d41c359f6b538cb8a8997147f3931cd Mon Sep 17 00:00:00 2001 From: M Gilang Januar Date: Tue, 7 Jun 2022 09:04:50 +0700 Subject: [PATCH 2/3] add details on error message --- Dockerfile | 3 ++- web/src/pages/Login.tsx | 27 ++++++++++++++++--- web/src/pages/Settings.tsx | 9 ++++++- web/src/pages/admin/index.tsx | 27 ++++++++++++++++--- .../pages/dashboard/components/Messaging.tsx | 9 ++++++- web/src/pages/dashboard/components/Upload.tsx | 20 +++++++++++--- web/src/pages/dashboard/index.tsx | 9 ++++++- 7 files changed, 91 insertions(+), 13 deletions(-) diff --git a/Dockerfile b/Dockerfile index ea21a9cb3..f8681c636 100644 --- a/Dockerfile +++ b/Dockerfile @@ -9,6 +9,7 @@ COPY package.json . COPY api/package.json api/package.json COPY web/package.json web/package.json COPY docker/.env . -RUN yarn install +RUN yarn cache clean +RUN yarn install --network-timeout 1000000 COPY . . RUN yarn workspaces run build diff --git a/web/src/pages/Login.tsx b/web/src/pages/Login.tsx index 9779d89e0..010988a8b 100644 --- a/web/src/pages/Login.tsx +++ b/web/src/pages/Login.tsx @@ -99,7 +99,14 @@ const Login: React.FC = ({ me }) => { setLoadingSendCode(false) notification.error({ message: 'Error', - description: error?.response?.data?.error || error.message || 'Something error' + description: <> + + {error?.response?.data?.error || error.message || 'Something error'} + + + {JSON.stringify(error?.response?.data || error?.data || error, null, 2)} + + }) if (error?.status === 400 || error?.response?.status === 400) { await fetch() @@ -194,7 +201,14 @@ const Login: React.FC = ({ me }) => { } return notification.error({ message: 'Error', - description: error?.response?.data?.error || error.message || 'Something error' + description: <> + + {error?.response?.data?.error || error.message || 'Something error'} + + + {JSON.stringify(error?.response?.data || error?.data || error, null, 2)} + + }) } } @@ -324,7 +338,14 @@ const Login: React.FC = ({ me }) => { setLoadingLogin(false) return notification.error({ message: 'Error', - description: error.response?.data?.error || 'Something error' + description: <> + + {error?.response?.data?.error || error.message || 'Something error'} + + + {JSON.stringify(error?.response?.data || error?.data || error, null, 2)} + + }) } } diff --git a/web/src/pages/Settings.tsx b/web/src/pages/Settings.tsx index 3dce7dce9..c7bafe716 100644 --- a/web/src/pages/Settings.tsx +++ b/web/src/pages/Settings.tsx @@ -155,7 +155,14 @@ const Settings: React.FC = ({ me, mutate, error }) => { return window.location.replace('/') } catch (error: any) { setLoadingRemove(false) - return notification.error({ message: 'Error', description: error.response?.data.error }) + return notification.error({ message: 'Error', description: <> + + {error?.response?.data?.error || error.message || 'Something error'} + + + {JSON.stringify(error?.response?.data || error?.data || error, null, 2)} + + }) } } diff --git a/web/src/pages/admin/index.tsx b/web/src/pages/admin/index.tsx index 5fff60454..de639198e 100644 --- a/web/src/pages/admin/index.tsx +++ b/web/src/pages/admin/index.tsx @@ -74,7 +74,14 @@ const Admin: FC = ({ me, errorMe }) => { } catch (error: any) { return notification.error({ message: error?.response?.status || 'Something error', - ...error?.response?.data ? { description: error.response.data.error } : {} + ...error?.response?.data ? { description: <> + + {error?.response?.data?.error || error.message || 'Something error'} + + + {JSON.stringify(error?.response?.data || error?.data || error, null, 2)} + + } : {} }) } } @@ -198,7 +205,14 @@ const Admin: FC = ({ me, errorMe }) => { }).catch(error => { notification.error({ message: error?.response?.status || 'Something error', - ...error?.response?.data ? { description: error.response.data.error } : {} + ...error?.response?.data ? { description: <> + + {error?.response?.data?.error || error.message || 'Something error'} + + + {JSON.stringify(error?.response?.data || error?.data || error, null, 2)} + + } : {} }) }) }} /> @@ -210,7 +224,14 @@ const Admin: FC = ({ me, errorMe }) => { }).catch(error => { notification.error({ message: error?.response?.status || 'Something error', - ...error?.response?.data ? { description: error.response.data.error } : {} + ...error?.response?.data ? { description: <> + + {error?.response?.data?.error || error.message || 'Something error'} + + + {JSON.stringify(error?.response?.data || error?.data || error, null, 2)} + + } : {} }) }) }}> diff --git a/web/src/pages/dashboard/components/Messaging.tsx b/web/src/pages/dashboard/components/Messaging.tsx index c6aefa8f0..1920bfa7f 100644 --- a/web/src/pages/dashboard/components/Messaging.tsx +++ b/web/src/pages/dashboard/components/Messaging.tsx @@ -392,7 +392,14 @@ const Messaging: React.FC = ({ me, collapsed, parent, setCollapsed }) => setLoadingSend(false) return notification.error({ message: 'Error', - description: error?.response.data?.error || 'Something error, please try again.' + description: <> + + {error?.response?.data?.error || error.message || 'Something error'} + + + {JSON.stringify(error?.response?.data || error?.data || error, null, 2)} + + }) } return setLoadingSend(false) diff --git a/web/src/pages/dashboard/components/Upload.tsx b/web/src/pages/dashboard/components/Upload.tsx index a30c15253..81b7bcc8e 100644 --- a/web/src/pages/dashboard/components/Upload.tsx +++ b/web/src/pages/dashboard/components/Upload.tsx @@ -1,5 +1,5 @@ import { CloudUploadOutlined } from '@ant-design/icons' -import { notification, Upload as BaseUpload } from 'antd' +import { notification, Typography, Upload as BaseUpload } from 'antd' import mime from 'mime-types' import React, { useEffect, useRef } from 'react' import { Api } from 'teledrive-client' @@ -37,7 +37,14 @@ const Upload: React.FC = ({ dataFileList: [fileList, setFileList], parent await new Promise(res => setTimeout(res, 3000 * ++retry)) await cb?.() if (retry === RETRY_COUNT) { - notification.error({ message: 'Failed to upload file', description: error.message }) + notification.error({ message: 'Failed to upload file', description: <> + + {error?.response?.data?.error || error.message || 'Something error'} + + + {JSON.stringify(error?.response?.data || error?.data || error, null, 2)} + + }) throw error } } @@ -275,7 +282,14 @@ const Upload: React.FC = ({ dataFileList: [fileList, setFileList], parent notification.error({ key: 'fileUploadError', message: error?.response?.status || 'Something error', - ...error?.response?.data ? { description: error.response.data.error } : {} + ...error?.response?.data ? { description: <> + + {error?.response?.data?.error || error.message || 'Something error'} + + + {JSON.stringify(error?.response?.data || error?.data || error, null, 2)} + + } : {} }) // filesWantToUpload.current = filesWantToUpload.current?.map(f => f.uid === file.uid ? { ...f, status: 'done' } : f) filesWantToUpload.current = filesWantToUpload.current?.map(f => f.uid === file.uid ? null : f).filter(Boolean) diff --git a/web/src/pages/dashboard/index.tsx b/web/src/pages/dashboard/index.tsx index b3fb7d4bf..7b3d73c47 100644 --- a/web/src/pages/dashboard/index.tsx +++ b/web/src/pages/dashboard/index.tsx @@ -318,7 +318,14 @@ const Dashboard: React.FC = ({ match }) } return notification.error({ message: error?.response?.status || 'Something error', - ...error?.response?.data ? { description: error.response.data.error } : {} + ...error?.response?.data ? { description: <> + + {error?.response?.data?.error || error.message || 'Something error'} + + + {JSON.stringify(error?.response?.data || error?.data || error, null, 2)} + + } : {} }) } finally { setSyncConfirmation(false) From 36f4ea471ab195d4e44e7b72dbfe5c43419659d9 Mon Sep 17 00:00:00 2001 From: M Gilang Januar Date: Tue, 7 Jun 2022 09:06:12 +0700 Subject: [PATCH 3/3] 2.5.1 --- api/package.json | 4 ++-- package.json | 2 +- web/package.json | 4 ++-- web/src/utils/Constant.ts | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/api/package.json b/api/package.json index 521b9982a..dfdc34da9 100644 --- a/api/package.json +++ b/api/package.json @@ -1,6 +1,6 @@ { "name": "api", - "version": "2.5.0", + "version": "2.5.1", "main": "dist/index.js", "license": "MIT", "private": true, @@ -85,4 +85,4 @@ "rimraf": "^3.0.2", "typescript": "^4.4.2" } -} +} \ No newline at end of file diff --git a/package.json b/package.json index c934c41cb..cac5db749 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "teledrive", - "version": "2.5.0", + "version": "2.5.1", "repository": "git@github.com:mgilangjanuar/teledrive.git", "author": "M Gilang Januar ", "license": "MIT", diff --git a/web/package.json b/web/package.json index 29ed98f25..e14293c21 100644 --- a/web/package.json +++ b/web/package.json @@ -1,6 +1,6 @@ { "name": "web", - "version": "2.5.0", + "version": "2.5.1", "private": true, "dependencies": { "@ideasio/add-to-homescreen-react": "^1.0.10", @@ -109,4 +109,4 @@ "workbox-strategies": "^5.1.3", "workbox-streams": "^5.1.3" } -} +} \ No newline at end of file diff --git a/web/src/utils/Constant.ts b/web/src/utils/Constant.ts index 8e894d09d..2b0ba57b3 100644 --- a/web/src/utils/Constant.ts +++ b/web/src/utils/Constant.ts @@ -1,4 +1,4 @@ -export const VERSION = '2.5.0' +export const VERSION = '2.5.1' export const MAX_UPLOAD_SIZE = 2_000_000_000 export const CHUNK_SIZE = 512 * 1024 export const RETRY_COUNT = 50 \ No newline at end of file