From 8329498d4c5426f309b8b3569e830807b17f3c1b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=81=BE=E3=81=A3=E3=81=A1=E3=82=83=E3=81=A6=E3=81=83?= =?UTF-8?q?=E3=83=BC=E3=80=82?= <56515516+mattyatea@users.noreply.github.com> Date: Sun, 18 Aug 2024 06:00:10 +0900 Subject: [PATCH] =?UTF-8?q?enhance(frontend):=20=E3=83=95=E3=82=A1?= =?UTF-8?q?=E3=82=A4=E3=83=AB=E3=81=AE=E3=82=A2=E3=83=83=E3=83=97=E3=83=AD?= =?UTF-8?q?=E3=83=BC=E3=83=89=E6=99=82=E3=81=AB524=E3=81=8C=E8=BF=94?= =?UTF-8?q?=E3=81=95=E3=82=8C=E3=81=9F=E9=9A=9B=E3=81=AE=E3=82=A8=E3=83=A9?= =?UTF-8?q?=E3=83=BC=E3=82=92=E6=98=8E=E7=A4=BA=E7=9A=84=E3=81=AB=E8=A1=A8?= =?UTF-8?q?=E7=A4=BA=E3=81=99=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB=20(Missk?= =?UTF-8?q?eyIO#710)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- locales/en-US.yml | 1 + locales/index.d.ts | 4 ++++ locales/ja-JP.yml | 1 + locales/ko-KR.yml | 1 + packages/frontend/src/scripts/upload.ts | 6 ++++++ 5 files changed, 13 insertions(+) diff --git a/locales/en-US.yml b/locales/en-US.yml index 0e8d053bf..fd6db2757 100644 --- a/locales/en-US.yml +++ b/locales/en-US.yml @@ -976,6 +976,7 @@ failedToUpload: "Upload failed" cannotUploadBecauseInappropriate: "This file could not be uploaded because parts of it have been detected as potentially inappropriate." cannotUploadBecauseNoFreeSpace: "Upload failed due to lack of Drive capacity." cannotUploadBecauseExceedsFileSizeLimit: "This file cannot be uploaded as it exceeds the file size limit." +cannotUploadBecauseTimeout: "The file could not be uploaded due to a connection timeout." beta: "Beta" enableAutoSensitive: "Automatic marking as sensitive" enableAutoSensitiveDescription: "Allows automatic detection and marking of sensitive media through Machine Learning where possible. Even if this option is disabled, it may be enabled instance-wide." diff --git a/locales/index.d.ts b/locales/index.d.ts index c53f67dd2..e6dcc26dc 100644 --- a/locales/index.d.ts +++ b/locales/index.d.ts @@ -3928,6 +3928,10 @@ export interface Locale extends ILocale { * ファイルサイズの制限を超えているためアップロードできません。 */ "cannotUploadBecauseExceedsFileSizeLimit": string; + /** + * 接続がタイムアウトしたため、ファイルをアップロードできませんでした。 + */ + "cannotUploadBecauseTimeout": string; /** * ベータ */ diff --git a/locales/ja-JP.yml b/locales/ja-JP.yml index 7ad273c3b..297b5c976 100644 --- a/locales/ja-JP.yml +++ b/locales/ja-JP.yml @@ -978,6 +978,7 @@ failedToUpload: "アップロード失敗" cannotUploadBecauseInappropriate: "不適切な内容を含む可能性があると判定されたためアップロードできません。" cannotUploadBecauseNoFreeSpace: "ドライブの空き容量が無いためアップロードできません。" cannotUploadBecauseExceedsFileSizeLimit: "ファイルサイズの制限を超えているためアップロードできません。" +cannotUploadBecauseTimeout: "接続がタイムアウトしたため、ファイルをアップロードできませんでした。" beta: "ベータ" enableAutoSensitive: "自動センシティブ判定" enableAutoSensitiveDescription: "利用可能な場合は、機械学習を利用して自動でメディアにセンシティブフラグを設定します。この機能をオフにしても、サーバーによっては自動で設定されることがあります。" diff --git a/locales/ko-KR.yml b/locales/ko-KR.yml index 0f9111b2d..0adcf4984 100644 --- a/locales/ko-KR.yml +++ b/locales/ko-KR.yml @@ -975,6 +975,7 @@ failedToUpload: "업로드 실패" cannotUploadBecauseInappropriate: "이 파일은 부적절한 내용을 포함한다고 판단되어 업로드할 수 없습니다." cannotUploadBecauseNoFreeSpace: "드라이브 용량이 부족하여 업로드할 수 없습니다." cannotUploadBecauseExceedsFileSizeLimit: "파일 크기가 너무 크기 때문에 업로드할 수 없습니다." +cannotUploadBecauseTimeout: "접속 시간이 초과되어 파일을 업로드할 수 없습니다." beta: "베타" enableAutoSensitive: "자동 NSFW 탐지" enableAutoSensitiveDescription: "이용 가능할 경우 기계학습을 통해 자동으로 미디어 NSFW를 설정합니다. 이 기능을 해제하더라도, 서버 정책에 따라 자동으로 설정될 수 있습니다." diff --git a/packages/frontend/src/scripts/upload.ts b/packages/frontend/src/scripts/upload.ts index 3e947183c..f61b72993 100644 --- a/packages/frontend/src/scripts/upload.ts +++ b/packages/frontend/src/scripts/upload.ts @@ -98,6 +98,12 @@ export function uploadFile( title: i18n.ts.failedToUpload, text: i18n.ts.cannotUploadBecauseExceedsFileSizeLimit, }); + } else if (xhr.status === 524) { + alert({ + type: 'error', + title: i18n.ts.failedToUpload, + text: i18n.ts.cannotUploadBecauseTimeout, + }); } else if (ev.target?.response) { const res = JSON.parse(ev.target.response); if (res.error?.id === 'bec5bd69-fba3-43c9-b4fb-2894b66ad5d2') {