From acf06532b8b71825fc394f1a9cd08539f4e8208f Mon Sep 17 00:00:00 2001 From: Felipe Machado Date: Sat, 21 Sep 2024 13:37:58 -0300 Subject: [PATCH] Support JFIF files which are basically JPGs anyways (#983) Note that this outputs JPG, but I think that should be fine. It's the better format anyways. --- electron/commands/select-file.ts | 4 ++++ renderer/locales/en.json | 2 +- renderer/locales/es.json | 2 +- renderer/locales/fr.json | 2 +- renderer/locales/ja.json | 2 +- renderer/locales/locale_template | 2 +- renderer/locales/ru.json | 2 +- renderer/locales/zh.json | 2 +- renderer/pages/index.tsx | 2 +- 9 files changed, 12 insertions(+), 8 deletions(-) diff --git a/electron/commands/select-file.ts b/electron/commands/select-file.ts index 50bd72c..e812958 100644 --- a/electron/commands/select-file.ts +++ b/electron/commands/select-file.ts @@ -21,10 +21,12 @@ const selectFile = async () => { "png", "jpg", "jpeg", + "jfif", "webp", "PNG", "JPG", "JPEG", + "JFIF", "WEBP", ], }, @@ -50,10 +52,12 @@ const selectFile = async () => { file.endsWith(".png") || file.endsWith(".jpg") || file.endsWith(".jpeg") || + file.endsWith(".jfif") || file.endsWith(".webp") || file.endsWith(".JPG") || file.endsWith(".PNG") || file.endsWith(".JPEG") || + file.endsWith(".JFIF") || file.endsWith(".WEBP") ) { isValid = true; diff --git a/renderer/locales/en.json b/renderer/locales/en.json index 1bc23fb..60bf7a8 100644 --- a/renderer/locales/en.json +++ b/renderer/locales/en.json @@ -194,7 +194,7 @@ }, "INVALID_IMAGE_ERROR": { "TITLE": "Invalid Image", - "DESCRIPTION": "Please select an image with a valid extension like PNG, JPG, JPEG, or WEBP.", + "DESCRIPTION": "Please select an image with a valid extension like PNG, JPG, JPEG, JFIF or WEBP.", "ADDITIONAL_DESCRIPTION": "Please drag and drop an image" }, "NO_IMAGE_ERROR": { diff --git a/renderer/locales/es.json b/renderer/locales/es.json index 993f215..bf97879 100644 --- a/renderer/locales/es.json +++ b/renderer/locales/es.json @@ -194,7 +194,7 @@ }, "INVALID_IMAGE_ERROR": { "TITLE": "Imagen inválida", - "DESCRIPTION": "Por favor, selecciona una imagen con una extensión válida como PNG, JPG, JPEG o WEBP.", + "DESCRIPTION": "Por favor, selecciona una imagen con una extensión válida como PNG, JPG, JPEG, JFIF o WEBP.", "ADDITIONAL_DESCRIPTION": "Por favor, arrastra y suelta una imagen" }, "NO_IMAGE_ERROR": { diff --git a/renderer/locales/fr.json b/renderer/locales/fr.json index 9d963ab..abcb8d2 100644 --- a/renderer/locales/fr.json +++ b/renderer/locales/fr.json @@ -194,7 +194,7 @@ }, "INVALID_IMAGE_ERROR": { "TITLE": "Image invalide", - "DESCRIPTION": "Veuillez sélectionner une image avec une extension valide comme PNG, JPG, JPEG ou WEBP.", + "DESCRIPTION": "Veuillez sélectionner une image avec une extension valide comme PNG, JPG, JPEG, JFIF ou WEBP.", "ADDITIONAL_DESCRIPTION": "Veuillez glisser-déposer une image" }, "NO_IMAGE_ERROR": { diff --git a/renderer/locales/ja.json b/renderer/locales/ja.json index 642cacc..f30bff0 100644 --- a/renderer/locales/ja.json +++ b/renderer/locales/ja.json @@ -194,7 +194,7 @@ }, "INVALID_IMAGE_ERROR": { "TITLE": "無効な画像", - "DESCRIPTION": "PNG、JPG、JPEG、またはWEBPなどの有効な拡張子を持つ画像を選択してください。", + "DESCRIPTION": "PNG、JPG、JPEG、JFIF、またはWEBPなどの有効な拡張子を持つ画像を選択してください。", "ADDITIONAL_DESCRIPTION": "画像をドラッグアンドドロップしてください" }, "NO_IMAGE_ERROR": { diff --git a/renderer/locales/locale_template b/renderer/locales/locale_template index 1fe1c94..a1285bb 100644 --- a/renderer/locales/locale_template +++ b/renderer/locales/locale_template @@ -192,7 +192,7 @@ }, "INVALID_IMAGE_ERROR": { "TITLE": "Invalid Image", - "DESCRIPTION": "Please select an image with a valid extension like PNG, JPG, JPEG, or WEBP.", + "DESCRIPTION": "Please select an image with a valid extension like PNG, JPG, JPEG, JFIF or WEBP.", "ADDITIONAL_DESCRIPTION": "Please drag and drop an image" }, "NO_IMAGE_ERROR": { diff --git a/renderer/locales/ru.json b/renderer/locales/ru.json index df1c118..043b336 100644 --- a/renderer/locales/ru.json +++ b/renderer/locales/ru.json @@ -194,7 +194,7 @@ }, "INVALID_IMAGE_ERROR": { "TITLE": "Неверное изображение", - "DESCRIPTION": "Пожалуйста, выберите изображение с правильным расширением, таким как PNG, JPG, JPEG или WEBP.", + "DESCRIPTION": "Пожалуйста, выберите изображение с правильным расширением, таким как PNG, JPG, JPEG, JFIF или WEBP.", "ADDITIONAL_DESCRIPTION": "Пожалуйста, перетащите изображение" }, "NO_IMAGE_ERROR": { diff --git a/renderer/locales/zh.json b/renderer/locales/zh.json index b892fcf..ac0cffb 100644 --- a/renderer/locales/zh.json +++ b/renderer/locales/zh.json @@ -194,7 +194,7 @@ }, "INVALID_IMAGE_ERROR": { "TITLE": "图片无效", - "DESCRIPTION": "请选择一个扩展名为 PNG、JPG、JPEG 或 WEBP 的有效图片", + "DESCRIPTION": "请选择一个扩展名为 PNG、JPG、JPEG、JFIF 或 WEBP 的有效图片", "ADDITIONAL_DESCRIPTION": "请拖放图片" }, "NO_IMAGE_ERROR": { diff --git a/renderer/pages/index.tsx b/renderer/pages/index.tsx index 6d3273a..89a6a23 100644 --- a/renderer/pages/index.tsx +++ b/renderer/pages/index.tsx @@ -51,7 +51,7 @@ import getDirectoryFromPath from "@common/get-directory-from-path"; import { translationAtom } from "@/atoms/translations-atom"; const Home = () => { - const allowedFileTypes = ["png", "jpg", "jpeg", "webp"]; + const allowedFileTypes = ["png", "jpg", "jpeg", "jfif", "webp"]; const t = useAtomValue(translationAtom);