From 14c85cbadfeb754f9483fcf59fcb77938766a659 Mon Sep 17 00:00:00 2001 From: Huang Xin Date: Fri, 12 Sep 2025 23:10:25 +0800 Subject: [PATCH] feat(metadata): add an option to remove cover image, closes #2020 (#2028) --- .../public/locales/ar/translation.json | 3 +- .../public/locales/bn/translation.json | 3 +- .../public/locales/bo/translation.json | 3 +- .../public/locales/de/translation.json | 3 +- .../public/locales/el/translation.json | 3 +- .../public/locales/es/translation.json | 3 +- .../public/locales/fr/translation.json | 3 +- .../public/locales/hi/translation.json | 3 +- .../public/locales/id/translation.json | 3 +- .../public/locales/it/translation.json | 3 +- .../public/locales/ja/translation.json | 3 +- .../public/locales/ko/translation.json | 3 +- .../public/locales/nl/translation.json | 3 +- .../public/locales/pl/translation.json | 3 +- .../public/locales/pt/translation.json | 3 +- .../public/locales/ru/translation.json | 3 +- .../public/locales/si/translation.json | 3 +- .../public/locales/ta/translation.json | 3 +- .../public/locales/th/translation.json | 3 +- .../public/locales/tr/translation.json | 3 +- .../public/locales/uk/translation.json | 3 +- .../public/locales/vi/translation.json | 3 +- .../public/locales/zh-CN/translation.json | 3 +- .../public/locales/zh-TW/translation.json | 3 +- .../components/metadata/BookDetailEdit.tsx | 56 +++++++++++++------ apps/readest-app/src/services/appService.ts | 8 ++- 26 files changed, 93 insertions(+), 43 deletions(-) diff --git a/apps/readest-app/public/locales/ar/translation.json b/apps/readest-app/public/locales/ar/translation.json index 3623179c..57d87f4b 100644 --- a/apps/readest-app/public/locales/ar/translation.json +++ b/apps/readest-app/public/locales/ar/translation.json @@ -543,5 +543,6 @@ "Resize Sidebar": "تغيير حجم الشريط الجانبي", "Menu": "القائمة", "Dismiss": "رفض", - "Get Help from the Readest Community": "الحصول على المساعدة من مجتمع ريديست" + "Get Help from the Readest Community": "الحصول على المساعدة من مجتمع ريديست", + "Remove cover image": "إزالة صورة الغلاف" } diff --git a/apps/readest-app/public/locales/bn/translation.json b/apps/readest-app/public/locales/bn/translation.json index 5bf5b873..47c6d2d3 100644 --- a/apps/readest-app/public/locales/bn/translation.json +++ b/apps/readest-app/public/locales/bn/translation.json @@ -527,5 +527,6 @@ "Resize Sidebar": "সাইডবারের আকার পরিবর্তন", "Menu": "মেনু", "Dismiss": "বাতিল", - "Get Help from the Readest Community": "রিডেস্ট কমিউনিটি থেকে সাহায্য নিন" + "Get Help from the Readest Community": "রিডেস্ট কমিউনিটি থেকে সাহায্য নিন", + "Remove cover image": "মলাট ছবি সরান" } diff --git a/apps/readest-app/public/locales/bo/translation.json b/apps/readest-app/public/locales/bo/translation.json index 0c5fcf46..8efa90ca 100644 --- a/apps/readest-app/public/locales/bo/translation.json +++ b/apps/readest-app/public/locales/bo/translation.json @@ -523,5 +523,6 @@ "Resize Sidebar": "གཡས་སྒོ་གཅོད་སྒྲིག", "Menu": "སྒེའུ་ཁུང་།", "Dismiss": "བརྟེན་སྒྲིག", - "Get Help from the Readest Community": "Readest མཛའ་བརྩེའི་རོགས་རམ་ལོངས་སུ་རོགས་རམ་ཐོབ།" + "Get Help from the Readest Community": "Readest མཛའ་བརྩེའི་རོགས་རམ་ལོངས་སུ་རོགས་རམ་ཐོབ།", + "Remove cover image": "སྟོང་ངོས་ཀྱི་པར་རིས་ཕྱིར་འཐེན།" } diff --git a/apps/readest-app/public/locales/de/translation.json b/apps/readest-app/public/locales/de/translation.json index 40f0db85..95bea24f 100644 --- a/apps/readest-app/public/locales/de/translation.json +++ b/apps/readest-app/public/locales/de/translation.json @@ -527,5 +527,6 @@ "Resize Sidebar": "Seitenleisten-Größe ändern", "Menu": "Menü", "Dismiss": "Schließen", - "Get Help from the Readest Community": "Hilfe von der Readest-Community erhalten" + "Get Help from the Readest Community": "Hilfe von der Readest-Community erhalten", + "Remove cover image": "Coverbild entfernen" } diff --git a/apps/readest-app/public/locales/el/translation.json b/apps/readest-app/public/locales/el/translation.json index c7877e1a..786c6ff9 100644 --- a/apps/readest-app/public/locales/el/translation.json +++ b/apps/readest-app/public/locales/el/translation.json @@ -527,5 +527,6 @@ "Resize Sidebar": "Αλλαγή μεγέθους πλαϊνής γραμμής", "Menu": "Μενού", "Dismiss": "Απόρριψη", - "Get Help from the Readest Community": "Λάβετε βοήθεια από την κοινότητα Readest" + "Get Help from the Readest Community": "Λάβετε βοήθεια από την κοινότητα Readest", + "Remove cover image": "Αφαίρεση εικόνας εξωφύλλου" } diff --git a/apps/readest-app/public/locales/es/translation.json b/apps/readest-app/public/locales/es/translation.json index 88c7f05d..79148c80 100644 --- a/apps/readest-app/public/locales/es/translation.json +++ b/apps/readest-app/public/locales/es/translation.json @@ -531,5 +531,6 @@ "Resize Sidebar": "Redimensionar barra lateral", "Menu": "Menú", "Dismiss": "Descartar", - "Get Help from the Readest Community": "Obtén ayuda de la comunidad de Readest" + "Get Help from the Readest Community": "Obtén ayuda de la comunidad de Readest", + "Remove cover image": "Eliminar imagen de portada" } diff --git a/apps/readest-app/public/locales/fr/translation.json b/apps/readest-app/public/locales/fr/translation.json index 58203b32..48550f7b 100644 --- a/apps/readest-app/public/locales/fr/translation.json +++ b/apps/readest-app/public/locales/fr/translation.json @@ -531,5 +531,6 @@ "Resize Sidebar": "Redimensionner la Barre Latérale", "Menu": "Menu", "Dismiss": "Fermer", - "Get Help from the Readest Community": "Obtenir de l'aide de la communauté Readest" + "Get Help from the Readest Community": "Obtenir de l'aide de la communauté Readest", + "Remove cover image": "Supprimer l'image de couverture" } diff --git a/apps/readest-app/public/locales/hi/translation.json b/apps/readest-app/public/locales/hi/translation.json index 9259a65d..ff0fbc96 100644 --- a/apps/readest-app/public/locales/hi/translation.json +++ b/apps/readest-app/public/locales/hi/translation.json @@ -527,5 +527,6 @@ "Resize Sidebar": "साइडबार का आकार बदलें", "Menu": "मेनू", "Dismiss": "खारिज करें", - "Get Help from the Readest Community": "Readest समुदाय से मदद लें" + "Get Help from the Readest Community": "Readest समुदाय से मदद लें", + "Remove cover image": "कवर इमेज हटाएं" } diff --git a/apps/readest-app/public/locales/id/translation.json b/apps/readest-app/public/locales/id/translation.json index b088b367..2cdf0945 100644 --- a/apps/readest-app/public/locales/id/translation.json +++ b/apps/readest-app/public/locales/id/translation.json @@ -523,5 +523,6 @@ "Resize Sidebar": "Ubah Ukuran Bilah Samping", "Menu": "Menu", "Dismiss": "Tutup", - "Get Help from the Readest Community": "Dapatkan Bantuan dari Komunitas Readest" + "Get Help from the Readest Community": "Dapatkan Bantuan dari Komunitas Readest", + "Remove cover image": "Hapus gambar sampul" } diff --git a/apps/readest-app/public/locales/it/translation.json b/apps/readest-app/public/locales/it/translation.json index de8957de..a0a478af 100644 --- a/apps/readest-app/public/locales/it/translation.json +++ b/apps/readest-app/public/locales/it/translation.json @@ -531,5 +531,6 @@ "Resize Sidebar": "Ridimensiona barra laterale", "Menu": "Menu", "Dismiss": "Chiudi", - "Get Help from the Readest Community": "Ottieni aiuto dalla community di Readest" + "Get Help from the Readest Community": "Ottieni aiuto dalla community di Readest", + "Remove cover image": "Rimuovi immagine di copertina" } diff --git a/apps/readest-app/public/locales/ja/translation.json b/apps/readest-app/public/locales/ja/translation.json index c9f98a3c..4447caa2 100644 --- a/apps/readest-app/public/locales/ja/translation.json +++ b/apps/readest-app/public/locales/ja/translation.json @@ -523,5 +523,6 @@ "Resize Sidebar": "サイドバーのサイズ変更", "Menu": "メニュー", "Dismiss": "閉じる", - "Get Help from the Readest Community": "Readestコミュニティからヘルプを得る" + "Get Help from the Readest Community": "Readestコミュニティからヘルプを得る", + "Remove cover image": "表紙画像を削除" } diff --git a/apps/readest-app/public/locales/ko/translation.json b/apps/readest-app/public/locales/ko/translation.json index 1f2ec19f..1099b1eb 100644 --- a/apps/readest-app/public/locales/ko/translation.json +++ b/apps/readest-app/public/locales/ko/translation.json @@ -523,5 +523,6 @@ "Resize Sidebar": "사이드바 크기 조정", "Menu": "메뉴", "Dismiss": "닫기", - "Get Help from the Readest Community": "Readest 커뮤니티에서 도움 받기" + "Get Help from the Readest Community": "Readest 커뮤니티에서 도움 받기", + "Remove cover image": "표지 이미지 제거" } diff --git a/apps/readest-app/public/locales/nl/translation.json b/apps/readest-app/public/locales/nl/translation.json index 2356f6e9..309d7af0 100644 --- a/apps/readest-app/public/locales/nl/translation.json +++ b/apps/readest-app/public/locales/nl/translation.json @@ -527,5 +527,6 @@ "Resize Sidebar": "Formaat Zijbalk Aanpassen", "Menu": "Menu", "Dismiss": "Sluiten", - "Get Help from the Readest Community": "Hulp krijgen van de Readest Community" + "Get Help from the Readest Community": "Hulp krijgen van de Readest Community", + "Remove cover image": "Omslagafbeelding verwijderen" } diff --git a/apps/readest-app/public/locales/pl/translation.json b/apps/readest-app/public/locales/pl/translation.json index f0ad4105..0ec37bc2 100644 --- a/apps/readest-app/public/locales/pl/translation.json +++ b/apps/readest-app/public/locales/pl/translation.json @@ -535,5 +535,6 @@ "Resize Sidebar": "Zmień rozmiar paska bocznego", "Menu": "Menu", "Dismiss": "Odrzuć", - "Get Help from the Readest Community": "Uzyskaj pomoc od społeczności Readest" + "Get Help from the Readest Community": "Uzyskaj pomoc od społeczności Readest", + "Remove cover image": "Usuń obraz okładki" } diff --git a/apps/readest-app/public/locales/pt/translation.json b/apps/readest-app/public/locales/pt/translation.json index 54404ca4..50dcf6f8 100644 --- a/apps/readest-app/public/locales/pt/translation.json +++ b/apps/readest-app/public/locales/pt/translation.json @@ -531,5 +531,6 @@ "Resize Sidebar": "Redimensionar Barra Lateral", "Menu": "Menu", "Dismiss": "Dispensar", - "Get Help from the Readest Community": "Obter ajuda da comunidade Readest" + "Get Help from the Readest Community": "Obter ajuda da comunidade Readest", + "Remove cover image": "Remover imagem da capa" } diff --git a/apps/readest-app/public/locales/ru/translation.json b/apps/readest-app/public/locales/ru/translation.json index a7531778..8a24adbc 100644 --- a/apps/readest-app/public/locales/ru/translation.json +++ b/apps/readest-app/public/locales/ru/translation.json @@ -535,5 +535,6 @@ "Resize Sidebar": "Изменить размер боковой панели", "Menu": "Меню", "Dismiss": "Закрыть", - "Get Help from the Readest Community": "Получить помощь от сообщества Readest" + "Get Help from the Readest Community": "Получить помощь от сообщества Readest", + "Remove cover image": "Удалить изображение обложки" } diff --git a/apps/readest-app/public/locales/si/translation.json b/apps/readest-app/public/locales/si/translation.json index 002ba5e7..8dcff932 100644 --- a/apps/readest-app/public/locales/si/translation.json +++ b/apps/readest-app/public/locales/si/translation.json @@ -527,5 +527,6 @@ "Resize Sidebar": "පැති තීරුවේ ප්‍රමාණය වෙනස් කරන්න", "Menu": "මෙනුව", "Dismiss": "අත්හැරීම", - "Get Help from the Readest Community": "Readest ප්‍රජාවෙන් උදව් ලබා ගන්න" + "Get Help from the Readest Community": "Readest ප්‍රජාවෙන් උදව් ලබා ගන්න", + "Remove cover image": "ආවරණ රූපය ඉවත් කරන්න" } diff --git a/apps/readest-app/public/locales/ta/translation.json b/apps/readest-app/public/locales/ta/translation.json index 127166ec..1d2470e8 100644 --- a/apps/readest-app/public/locales/ta/translation.json +++ b/apps/readest-app/public/locales/ta/translation.json @@ -527,5 +527,6 @@ "Resize Sidebar": "பக்கப்பட்டியை மீட்டமைக்கவும்", "Menu": "மெனு", "Dismiss": "நிராகரிக்கவும்", - "Get Help from the Readest Community": "Readest சமூகத்திலிருந்து உதவி பெறவும்" + "Get Help from the Readest Community": "Readest சமூகத்திலிருந்து உதவி பெறவும்", + "Remove cover image": "அட்டை படத்தை நீக்கவும்" } diff --git a/apps/readest-app/public/locales/th/translation.json b/apps/readest-app/public/locales/th/translation.json index c426c7ea..c7042713 100644 --- a/apps/readest-app/public/locales/th/translation.json +++ b/apps/readest-app/public/locales/th/translation.json @@ -523,5 +523,6 @@ "Resize Sidebar": "ปรับขนาดแถบข้าง", "Menu": "เมนู", "Dismiss": "ปิด", - "Get Help from the Readest Community": "รับความช่วยเหลือจากชุมชน Readest" + "Get Help from the Readest Community": "รับความช่วยเหลือจากชุมชน Readest", + "Remove cover image": "ลบรูปปก" } diff --git a/apps/readest-app/public/locales/tr/translation.json b/apps/readest-app/public/locales/tr/translation.json index dfd43f5a..27d817e3 100644 --- a/apps/readest-app/public/locales/tr/translation.json +++ b/apps/readest-app/public/locales/tr/translation.json @@ -527,5 +527,6 @@ "Resize Sidebar": "Kenar Çubuğunu Yeniden Boyutlandır", "Menu": "Menü", "Dismiss": "Kapat", - "Get Help from the Readest Community": "Readest Topluluğundan Yardım Alın" + "Get Help from the Readest Community": "Readest Topluluğundan Yardım Alın", + "Remove cover image": "Kapak resmini kaldır" } diff --git a/apps/readest-app/public/locales/uk/translation.json b/apps/readest-app/public/locales/uk/translation.json index a018fda3..f46c334b 100644 --- a/apps/readest-app/public/locales/uk/translation.json +++ b/apps/readest-app/public/locales/uk/translation.json @@ -535,5 +535,6 @@ "Resize Sidebar": "Змінити розмір бічної панелі", "Menu": "Меню", "Dismiss": "Відхилити", - "Get Help from the Readest Community": "Отримати допомогу від спільноти Readest" + "Get Help from the Readest Community": "Отримати допомогу від спільноти Readest", + "Remove cover image": "Видалити зображення обкладинки" } diff --git a/apps/readest-app/public/locales/vi/translation.json b/apps/readest-app/public/locales/vi/translation.json index 80829816..3a06682e 100644 --- a/apps/readest-app/public/locales/vi/translation.json +++ b/apps/readest-app/public/locales/vi/translation.json @@ -523,5 +523,6 @@ "Resize Sidebar": "Thay Đổi Kích Thước Thanh Bên", "Menu": "Menu", "Dismiss": "Đóng", - "Get Help from the Readest Community": "Nhận Trợ Giúp từ Cộng Đồng Readest" + "Get Help from the Readest Community": "Nhận Trợ Giúp từ Cộng Đồng Readest", + "Remove cover image": "Xóa ảnh bìa" } diff --git a/apps/readest-app/public/locales/zh-CN/translation.json b/apps/readest-app/public/locales/zh-CN/translation.json index 01117562..61d0230d 100644 --- a/apps/readest-app/public/locales/zh-CN/translation.json +++ b/apps/readest-app/public/locales/zh-CN/translation.json @@ -523,5 +523,6 @@ "Resize Sidebar": "调整侧边栏大小", "Menu": "菜单", "Dismiss": "关闭", - "Get Help from the Readest Community": "从 Readest 社区获取帮助" + "Get Help from the Readest Community": "从 Readest 社区获取帮助", + "Remove cover image": "移除封面图片" } diff --git a/apps/readest-app/public/locales/zh-TW/translation.json b/apps/readest-app/public/locales/zh-TW/translation.json index c266d386..cdf75bcd 100644 --- a/apps/readest-app/public/locales/zh-TW/translation.json +++ b/apps/readest-app/public/locales/zh-TW/translation.json @@ -523,5 +523,6 @@ "Resize Sidebar": "調整側邊欄大小", "Menu": "選單", "Dismiss": "關閉", - "Get Help from the Readest Community": "從 Readest 社群獲取幫助" + "Get Help from the Readest Community": "從 Readest 社群獲取幫助", + "Remove cover image": "移除封面圖片" } diff --git a/apps/readest-app/src/components/metadata/BookDetailEdit.tsx b/apps/readest-app/src/components/metadata/BookDetailEdit.tsx index f4527fc9..b5bb346f 100644 --- a/apps/readest-app/src/components/metadata/BookDetailEdit.tsx +++ b/apps/readest-app/src/components/metadata/BookDetailEdit.tsx @@ -1,6 +1,6 @@ import clsx from 'clsx'; import React, { useEffect, useState } from 'react'; -import { MdEdit, MdLock, MdLockOpen, MdOutlineSearch } from 'react-icons/md'; +import { MdEdit, MdDelete, MdLock, MdLockOpen, MdOutlineSearch } from 'react-icons/md'; import { Book } from '@/types/book'; import { BookMetadata } from '@/libs/document'; @@ -28,6 +28,8 @@ interface BookDetailEditProps { onSave: () => void; } +const emptyCoverImageUrl = '_blank'; + const BookDetailEdit: React.FC = ({ book, metadata, @@ -169,8 +171,8 @@ const BookDetailEdit: React.FC = ({ return (
-
-
+
+
-
+
+ +
-
+
{titleAuthorFields.map(({ field, label, required, value, placeholder }) => ( = ({ {searchLoading ? ( ) : ( - + )} {_('Auto')} {_('Auto-Retrieve')} diff --git a/apps/readest-app/src/services/appService.ts b/apps/readest-app/src/services/appService.ts index c143c4f7..5238a935 100644 --- a/apps/readest-app/src/services/appService.ts +++ b/apps/readest-app/src/services/appService.ts @@ -658,7 +658,11 @@ export abstract class BaseAppService implements AppService { } async updateCoverImage(book: Book, imageUrl?: string, imageFile?: string): Promise { - const arrayBuffer = await this.imageToArrayBuffer(imageUrl, imageFile); - await this.fs.writeFile(getCoverFilename(book), 'Books', arrayBuffer); + if (imageUrl === '_blank') { + await this.fs.removeFile(getCoverFilename(book), 'Books'); + } else if (imageUrl || imageFile) { + const arrayBuffer = await this.imageToArrayBuffer(imageUrl, imageFile); + await this.fs.writeFile(getCoverFilename(book), 'Books', arrayBuffer); + } } }