diff --git a/src/screens/reader/hooks/useChapter.ts b/src/screens/reader/hooks/useChapter.ts index 5807aa697..e509a149a 100644 --- a/src/screens/reader/hooks/useChapter.ts +++ b/src/screens/reader/hooks/useChapter.ts @@ -97,7 +97,9 @@ export default function useChapter(webViewRef: RefObject) { }) .catch(e => setError(e.message)); } - setChapterText(sanitizeChapterText(text)); + setChapterText( + sanitizeChapterText(novel.pluginId, novel.name, chapter.name, text), + ); const [nextChap, prevChap] = await Promise.all([ getNextChapter(chapter.novelId, chapter.id), getPrevChapter(chapter.novelId, chapter.id), diff --git a/src/screens/reader/utils/sanitizeChapterText.ts b/src/screens/reader/utils/sanitizeChapterText.ts index a6783404c..c90ad796e 100644 --- a/src/screens/reader/utils/sanitizeChapterText.ts +++ b/src/screens/reader/utils/sanitizeChapterText.ts @@ -1,7 +1,12 @@ import { getString } from '@strings/translations'; import sanitizeHtml from 'sanitize-html'; -export const sanitizeChapterText = (html: string): string => { +export const sanitizeChapterText = ( + pluginId: string, + novelName: string, + chapterName: string, + html: string, +): string => { let text = sanitizeHtml(html, { allowedTags: sanitizeHtml.defaults.allowedTags.concat([ 'img', @@ -23,5 +28,12 @@ export const sanitizeChapterText = (html: string): string => { }, allowedSchemes: ['data', 'http', 'https', 'file'], }); - return text || getString('readerScreen.emptyChapterMessage'); + return ( + text || + getString('readerScreen.emptyChapterMessage', { + pluginId, + novelName, + chapterName, + }) + ); }; diff --git a/strings/languages/en/strings.json b/strings/languages/en/strings.json index 14b4dfbab..eae20b9cc 100644 --- a/strings/languages/en/strings.json +++ b/strings/languages/en/strings.json @@ -432,7 +432,7 @@ "scrollToCurrentChapter": "Scroll to current chapter", "scrollToTop": "Scroll to top" }, - "emptyChapterMessage": "

Chapter is empty.

Report on GitHub if it's available in WebView.

", + "emptyChapterMessage": "

Chapter is empty.

Report on GitHub if it's available in WebView.

Plugin: %{pluginId}

Novel: %{novelName}

Chapter: %{chapterName}

", "finished": "Finished", "nextChapter": "Next: %{name}", "noNextChapter": "There's no next chapter", diff --git a/strings/languages/vi_VN/strings.json b/strings/languages/vi_VN/strings.json index 519e0accb..148aaf3dc 100644 --- a/strings/languages/vi_VN/strings.json +++ b/strings/languages/vi_VN/strings.json @@ -460,7 +460,7 @@ "scrollToCurrentChapter": "Chương hiện tại", "scrollToTop": "Lên đầu" }, - "emptyChapterMessage": "

Chương này trống.

Báo lỗi tạiGitHubnếu như chương vẫn hiện thị ở WebView.

", + "emptyChapterMessage": "

Chương này trống.

Báo lỗi tại GitHub nếu như chương vẫn hiện thị ở WebView.

Plugin: %{pluginId}

Novel: %{novelName}

Chapter: %{chapterName}

", "finished": "Đã xong", "nextChapter": "Tiếp: %{name}", "noNextChapter": "Không có chương kế tiếp",