Skip to content

Commit

Permalink
New: Show error message if continue reading file does not exist
Browse files Browse the repository at this point in the history
  • Loading branch information
ollm committed Jan 16, 2024
1 parent 4962724 commit 7aee55c
Show file tree
Hide file tree
Showing 21 changed files with 65 additions and 7 deletions.
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,13 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),

##### 🚀 New Features

- Show error message if continue reading file does not exist

##### 🐛 Bug Fixes

- node-zstd not have native dependencies in arm64 build (Linux and macOS) [`e906f21`](https://github.com/ollm/OpenComic/commit/e906f212dae36c43d514beda44fba62e5ca26be5)
- Manga mode not working in epub [`a901754`](https://github.com/ollm/OpenComic/commit/a901754a4274687cddbfa3820ca3667b8b80e6ee)
- eBook not working with decimal device pixel ratio (1.5, 2.5, etc)
- eBook not working with decimal device pixel ratio (1.5, 2.5, etc) [`4962724`](https://github.com/ollm/OpenComic/commit/496272442747e466638e890a187f84b100deda14)

## [v1.1.0](https://github.com/ollm/OpenComic/releases/tag/v1.1.0) (13-01-2024)

Expand Down
1 change: 1 addition & 0 deletions languages/ca.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
},
"comics": {
"continueReading": "Continuar llegint",
"continueReadingNotExists": "El fitxer desat a continuar llegint no existeix actualment",
"emptyIndex": "No hi ha cap còmic en la biblioteca",
"emptyFolder": "No hi ha cap arxiu compatible en aquesta carpeta",
"emptyRecentlyOpened": "No hi ha fitxers oberts recentment",
Expand Down
1 change: 1 addition & 0 deletions languages/cs.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
},
"comics": {
"continueReading": "Pokračovat ve čtení",
"continueReadingNotExists": "",
"emptyIndex": "V této sbírce nejsou žádné komiksy.",
"emptyFolder": "V této složce nejsou žádné kompatibilní soubory.",
"emptyRecentlyOpened": "",
Expand Down
1 change: 1 addition & 0 deletions languages/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
},
"comics": {
"continueReading": "Lesen fortsetzen",
"continueReadingNotExists": "",
"emptyIndex": "In dieser Kollektion gibt es keine Comics.",
"emptyFolder": "In diesem Ordner gibt es keine kompatiblen Dateien.",
"emptyRecentlyOpened": "",
Expand Down
1 change: 1 addition & 0 deletions languages/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
},
"comics": {
"continueReading": "Continue reading",
"continueReadingNotExists": "The file saved in continue reading does not currently exist",
"emptyIndex": "There are no comics in the library",
"emptyFolder": "There is no compatible file in this folder",
"emptyRecentlyOpened": "No recently opened files",
Expand Down
1 change: 1 addition & 0 deletions languages/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
},
"comics": {
"continueReading": "Continuar leyendo",
"continueReadingNotExists": "El archivo guardado en continuar leyendo no existe actualmente",
"emptyIndex": "No hay ningún cómic en la biblioteca",
"emptyFolder": "No hay ningún archivo compatible en esta carpeta",
"emptyRecentlyOpened": "No hay archivos abiertos recientemente",
Expand Down
1 change: 1 addition & 0 deletions languages/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
},
"comics": {
"continueReading": "Continuer à lire",
"continueReadingNotExists": "",
"emptyIndex": "Il n'y a aucun comics dans cette collection.",
"emptyFolder": "Il n'y a aucun fichier compatible dans ce dossier.",
"emptyRecentlyOpened": "",
Expand Down
1 change: 1 addition & 0 deletions languages/hu.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
},
"comics": {
"continueReading": "Folytatás",
"continueReadingNotExists": "",
"emptyIndex": "Ebben a gyűjteményben nincsenek képregények.",
"emptyFolder": "Ebben a mappában nincsenek megfelelő fájlok.",
"emptyRecentlyOpened": "",
Expand Down
1 change: 1 addition & 0 deletions languages/it.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
},
"comics": {
"continueReading": "Continua a leggere",
"continueReadingNotExists": "",
"emptyIndex": "Non ci sono fumetti in questa raccolta.",
"emptyFolder": "Non ci sono file compatibili in questa cartella.",
"emptyRecentlyOpened": "",
Expand Down
1 change: 1 addition & 0 deletions languages/ja.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
},
"comics": {
"continueReading": "続きを読む",
"continueReadingNotExists": "",
"emptyIndex": "このコレクションには本がありません",
"emptyFolder": "このフォルダには閲覧可能なファイルがありません",
"emptyRecentlyOpened": "",
Expand Down
1 change: 1 addition & 0 deletions languages/pt-br.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
},
"comics": {
"continueReading": "Continue lendo",
"continueReadingNotExists": "",
"emptyIndex": "Não há quadrinhos nesta coleção.",
"emptyFolder": "Não há arquivo compatível nesta pasta.",
"emptyRecentlyOpened": "",
Expand Down
1 change: 1 addition & 0 deletions languages/ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
},
"comics": {
"continueReading": "Продолжить чтение",
"continueReadingNotExists": "",
"emptyIndex": "В этом сборнике нет комиксов.",
"emptyFolder": "В этой папке нет совместимых файлов.",
"emptyRecentlyOpened": "",
Expand Down
1 change: 1 addition & 0 deletions languages/th.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
},
"comics": {
"continueReading": "อ่านต่อ",
"continueReadingNotExists": "",
"emptyIndex": "ไม่มีคอมมิกส์ในห้องสมุด",
"emptyFolder": "ไม่มีไฟล์ที่รองรับในโฟลเดอร์นี้",
"emptyRecentlyOpened": "ไม่มีไฟล์ที่เปิดล่าสุด",
Expand Down
1 change: 1 addition & 0 deletions languages/vi.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
},
"comics": {
"continueReading": "Đọc tiếp",
"continueReadingNotExists": "",
"emptyIndex": "Chưa có truyện trong bộ sưu tập",
"emptyFolder": "Không có tệp tương thích trong thư mục",
"emptyRecentlyOpened": "Chưa mở tệp nào gần đây",
Expand Down
1 change: 1 addition & 0 deletions languages/zh-hans.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
},
"comics": {
"continueReading": "继续阅读",
"continueReadingNotExists": "",
"emptyIndex": "库里还没有漫画。",
"emptyFolder": "此文件夹中没有兼容的文件。",
"emptyRecentlyOpened": "没有最近打开的文件。",
Expand Down
1 change: 1 addition & 0 deletions languages/zh-hant.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
},
"comics": {
"continueReading": "繼續閱讀",
"continueReadingNotExists": "",
"emptyIndex": "收藏夾裡還沒有漫畫。",
"emptyFolder": "這個檔案夾裡沒有可讀檔案。",
"emptyRecentlyOpened": "",
Expand Down
18 changes: 18 additions & 0 deletions scripts/dom.js
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,7 @@ async function loadFilesIndexPage(file, animation, path, keepScroll, mainPath)
readingProgress.thumbnail = (thumbnail.cache) ? thumbnail.path : '';
readingProgress.mainPath = mainPath;
readingProgress.pathText = returnTextPath(readingProgress.path, mainPath, true, !readingProgress.ebook);
readingProgress.exists = fileManager.simpleExists(readingProgress.path);
handlebarsContext.comicsReadingProgress = readingProgress;
}
else
Expand All @@ -311,6 +312,7 @@ async function loadFilesIndexPage(file, animation, path, keepScroll, mainPath)
readingProgressCurrentPath.thumbnail = (thumbnail.cache) ? thumbnail.path : '';
readingProgressCurrentPath.mainPath = mainPath;
readingProgressCurrentPath.pathText = returnTextPath(readingProgressCurrentPath.path, path, true, !readingProgressCurrentPath.ebook);
readingProgressCurrentPath.exists = fileManager.simpleExists(readingProgressCurrentPath.path);
handlebarsContext.comicsReadingProgressCurrentPath = readingProgressCurrentPath;
}
else
Expand Down Expand Up @@ -891,6 +893,21 @@ function indexHeader(title = false)
return template.load('index.header.html');
}

function continueReadingError()
{
events.snackbar({
key: 'continueReadingError',
text: language.comics.continueReadingNotExists,
duration: 6,
buttons: [
{
text: language.buttons.dismiss,
function: 'events.closeSnackbar();',
},
],
});
}

function compressedError(error)
{
//console.log(error);
Expand Down Expand Up @@ -2132,6 +2149,7 @@ module.exports = {
translatePageName: translatePageName,
metadataPathName: metadataPathName,
fromLibrary: fromLibrary,
continueReadingError: continueReadingError,
poster: domPoster,
search: search,
labels: labels,
Expand Down
22 changes: 20 additions & 2 deletions scripts/file-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -2619,7 +2619,7 @@ function isCompressed(name)
return false;
}

function firstCompressedFile(path, index = 0)
function firstCompressedFile(path, index = 0, checkDirectory = true)
{
let segments = path.split(p.sep);
let len = segments.length;
Expand All @@ -2637,7 +2637,7 @@ function firstCompressedFile(path, index = 0)
{
let extension = fileExtension(newPath);

if(extension && inArray(extension, compressedExtensions.all) && (_isServer || !fs.statSync(newPath).isDirectory()))
if(extension && inArray(extension, compressedExtensions.all) && (!checkDirectory || _isServer || !fs.statSync(newPath).isDirectory()))
return newPath;
}
}
Expand Down Expand Up @@ -2761,6 +2761,23 @@ function pathType(path)
return false;
}

function simpleExists(path)
{
if(isServer(path))
{
return true;
}
else
{
path = firstCompressedFile(path, 0, false);

if(fs.existsSync(path))
return true;
}

return false;
}

function filtered(files, specialFiles = false)
{
let filtered = [];
Expand Down Expand Up @@ -2894,6 +2911,7 @@ module.exports = {
lastCompressedFile: lastCompressedFile,
containsCompressed: containsCompressed,
isParentPath: isParentPath,
simpleExists: simpleExists,
macosSecurityScopedBookmarks: macosSecurityScopedBookmarks,
dirSize: dirSize,
dirSizeSync: dirSizeSync,
Expand Down
4 changes: 2 additions & 2 deletions templates/index.content.right.list.html
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<div class="continue-reading-list{{#if comicsReadingProgress}}{{#if comicsReadingProgressCurrentPath}} continue-reading-list-double{{/if}}{{/if}}">
{{#if comicsReadingProgress}}
<div class="continue-reading gamepad-item body-medium" onclick="{{#if comicsReadingProgress.ebook}}reading.setNextOpenChapterProgress({{comicsReadingProgress.chapterIndex}}, {{comicsReadingProgress.chapterProgress}});{{/if}}dom.openComic(true, '{{chain 'escapeBackSlash' 'escapeQuotesSimples' comicsReadingProgress.path}}', '{{chain 'escapeBackSlash' 'escapeQuotesSimples' comicsReadingProgress.mainPath}}');">
<div class="continue-reading gamepad-item body-medium{{#unless comicsReadingProgress.exists}} continue-reading-not-exists{{/unless}}" onclick="{{#if comicsReadingProgress.exists}}{{#if comicsReadingProgress.ebook}}reading.setNextOpenChapterProgress({{comicsReadingProgress.chapterIndex}}, {{comicsReadingProgress.chapterProgress}});{{/if}}dom.openComic(true, '{{chain 'escapeBackSlash' 'escapeQuotesSimples' comicsReadingProgress.path}}', '{{chain 'escapeBackSlash' 'escapeQuotesSimples' comicsReadingProgress.mainPath}}');{{else}}dom.continueReadingError();{{/if}}">
<div>
<div class="sha-image-bg-{{comicsReadingProgress.sha}}" style="background-image: url({{chain 'escapeBackSlash' 'escapeQuotesSimples' comicsReadingProgress.thumbnail}});"></div>
<span>{{language.comics.continueReading}}:&nbsp&nbsp&nbsp{{{comicsReadingProgress.pathText}}}</span>
</div>
</div>
{{/if}}
{{#if comicsReadingProgressCurrentPath}}
<div class="continue-reading gamepad-item body-medium" onclick="{{#if comicsReadingProgressCurrentPath.ebook}}reading.setNextOpenChapterProgress({{comicsReadingProgressCurrentPath.chapterIndex}}, {{comicsReadingProgressCurrentPath.chapterProgress}});{{/if}}dom.openComic(true, '{{chain 'escapeBackSlash' 'escapeQuotesSimples' comicsReadingProgressCurrentPath.path}}', '{{chain 'escapeBackSlash' 'escapeQuotesSimples' comicsReadingProgressCurrentPath.mainPath}}');">
<div class="continue-reading gamepad-item body-medium{{#unless comicsReadingProgressCurrentPath.exists}} continue-reading-not-exists{{/unless}}" onclick="{{#if comicsReadingProgressCurrentPath.exists}}{{#if comicsReadingProgressCurrentPath.ebook}}reading.setNextOpenChapterProgress({{comicsReadingProgressCurrentPath.chapterIndex}}, {{comicsReadingProgressCurrentPath.chapterProgress}});{{/if}}dom.openComic(true, '{{chain 'escapeBackSlash' 'escapeQuotesSimples' comicsReadingProgressCurrentPath.path}}', '{{chain 'escapeBackSlash' 'escapeQuotesSimples' comicsReadingProgressCurrentPath.mainPath}}');{{else}}dom.continueReadingError();{{/if}}">
<div>
<div class="sha-image-bg-{{comicsReadingProgressCurrentPath.sha}}" style="background-image: url({{chain 'escapeBackSlash' 'escapeQuotesSimples' comicsReadingProgressCurrentPath.thumbnail}});"></div>
<span>{{language.comics.continueReading}}:&nbsp&nbsp&nbsp{{{comicsReadingProgressCurrentPath.pathText}}}</span>
Expand Down
4 changes: 2 additions & 2 deletions templates/index.content.right.module.html
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<div class="continue-reading-list{{#if comicsReadingProgress}}{{#if comicsReadingProgressCurrentPath}} continue-reading-list-double{{/if}}{{/if}}">
{{#if comicsReadingProgress}}
<div class="continue-reading gamepad-item body-medium" onclick="{{#if comicsReadingProgress.ebook}}reading.setNextOpenChapterProgress({{comicsReadingProgress.chapterIndex}}, {{comicsReadingProgress.chapterProgress}});{{/if}}dom.openComic(true, '{{chain 'escapeBackSlash' 'escapeQuotesSimples' comicsReadingProgress.path}}', '{{chain 'escapeBackSlash' 'escapeQuotesSimples' comicsReadingProgress.mainPath}}');">
<div class="continue-reading gamepad-item body-medium{{#unless comicsReadingProgress.exists}} continue-reading-not-exists{{/unless}}" onclick="{{#if comicsReadingProgress.exists}}{{#if comicsReadingProgress.ebook}}reading.setNextOpenChapterProgress({{comicsReadingProgress.chapterIndex}}, {{comicsReadingProgress.chapterProgress}});{{/if}}dom.openComic(true, '{{chain 'escapeBackSlash' 'escapeQuotesSimples' comicsReadingProgress.path}}', '{{chain 'escapeBackSlash' 'escapeQuotesSimples' comicsReadingProgress.mainPath}}');{{else}}dom.continueReadingError();{{/if}}">
<div>
<div class="sha-image-bg-{{comicsReadingProgress.sha}}" style="background-image: url({{chain 'escapeBackSlash' 'escapeQuotesSimples' comicsReadingProgress.thumbnail}});"></div>
<span>{{language.comics.continueReading}}:&nbsp&nbsp&nbsp{{{comicsReadingProgress.pathText}}}</span>
</div>
</div>
{{/if}}
{{#if comicsReadingProgressCurrentPath}}
<div class="continue-reading gamepad-item body-medium" onclick="{{#if comicsReadingProgressCurrentPath.ebook}}reading.setNextOpenChapterProgress({{comicsReadingProgressCurrentPath.chapterIndex}}, {{comicsReadingProgressCurrentPath.chapterProgress}});{{/if}}dom.openComic(true, '{{chain 'escapeBackSlash' 'escapeQuotesSimples' comicsReadingProgressCurrentPath.path}}', '{{chain 'escapeBackSlash' 'escapeQuotesSimples' comicsReadingProgressCurrentPath.mainPath}}');">
<div class="continue-reading gamepad-item body-medium{{#unless comicsReadingProgressCurrentPath.exists}} continue-reading-not-exists{{/unless}}" onclick="{{#if comicsReadingProgressCurrentPath.exists}}{{#if comicsReadingProgressCurrentPath.ebook}}reading.setNextOpenChapterProgress({{comicsReadingProgressCurrentPath.chapterIndex}}, {{comicsReadingProgressCurrentPath.chapterProgress}});{{/if}}dom.openComic(true, '{{chain 'escapeBackSlash' 'escapeQuotesSimples' comicsReadingProgressCurrentPath.path}}', '{{chain 'escapeBackSlash' 'escapeQuotesSimples' comicsReadingProgressCurrentPath.mainPath}}');{{else}}dom.continueReadingError();{{/if}}">
<div>
<div class="sha-image-bg-{{comicsReadingProgressCurrentPath.sha}}" style="background-image: url({{chain 'escapeBackSlash' 'escapeQuotesSimples' comicsReadingProgressCurrentPath.thumbnail}});"></div>
<span>{{language.comics.continueReading}}:&nbsp&nbsp&nbsp{{{comicsReadingProgressCurrentPath.pathText}}}</span>
Expand Down
5 changes: 5 additions & 0 deletions themes/material-design/theme.css
Original file line number Diff line number Diff line change
Expand Up @@ -1688,6 +1688,11 @@ cb
overflow: hidden;
}

.continue-reading-not-exists > div
{
background-color: var(--md-sys-color-error-container);
}

.continue-reading > div > div
{
width: 54px;
Expand Down

0 comments on commit 7aee55c

Please sign in to comment.