aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpacien2022-11-28 03:13:01 +0100
committerGitHub2022-11-28 03:13:01 +0100
commitb0b3f99f8078e7bc003fe7e2d60c7524954f7dfe (patch)
treea4af5f2863477924a7a37c2fda155f61b2212a15
parent8e0cda290d85d0a126093c9950c8030cfcb9d800 (diff)
parentd84f0f48c9b1dc73ec20a1cf5c31feeb744aa3d9 (diff)
downloadldgallery-b0b3f99f8078e7bc003fe7e2d60c7524954f7dfe.tar.gz
Merge pull request #348 from ldgallery/p_viewer_epub
viewer: render EPUB ebooks
-rw-r--r--compiler/src/ItemProcessors.hs5
-rw-r--r--compiler/src/Resource.hs1
-rw-r--r--example/src/Misc Media/First Geneva Convention.epubbin0 -> 80897 bytes
-rw-r--r--example/src/gallery.yaml1
-rw-r--r--readme.md1
-rw-r--r--viewer/ldgallery-viewer.7.md6
-rw-r--r--viewer/package.json1
-rw-r--r--viewer/src/@types/gallery.ts6
-rw-r--r--viewer/src/@types/itemType.ts1
-rw-r--r--viewer/src/assets/scss/theme.scss3
-rw-r--r--viewer/src/locales/en.yml3
-rw-r--r--viewer/src/services/navigation.ts14
-rw-r--r--viewer/src/views/GalleryNavigation.vue2
-rw-r--r--viewer/src/views/item_handlers/async/AsyncEpubViewer.vue180
-rw-r--r--viewer/src/views/item_handlers/async/index.ts23
-rw-r--r--viewer/yarn.lock301
16 files changed, 541 insertions, 7 deletions
diff --git a/compiler/src/ItemProcessors.hs b/compiler/src/ItemProcessors.hs
index fa99316..6035477 100644
--- a/compiler/src/ItemProcessors.hs
+++ b/compiler/src/ItemProcessors.hs
@@ -1,7 +1,7 @@
1-- ldgallery - A static generator which turns a collection of tagged 1-- ldgallery - A static generator which turns a collection of tagged
2-- pictures into a searchable web gallery. 2-- pictures into a searchable web gallery.
3-- 3--
4-- Copyright (C) 2019-2021 Pacien TRAN-GIRARD 4-- Copyright (C) 2019-2022 Pacien TRAN-GIRARD
5-- 5--
6-- This program is free software: you can redistribute it and/or modify 6-- This program is free software: you can redistribute it and/or modify
7-- it under the terms of the GNU Affero General Public License as 7-- it under the terms of the GNU Affero General Public License as
@@ -38,6 +38,7 @@ data Format =
38 | PlainTextFormat 38 | PlainTextFormat
39 | MarkdownFormat 39 | MarkdownFormat
40 | PortableDocumentFormat 40 | PortableDocumentFormat
41 | EPUBFormat
41 | VideoFormat 42 | VideoFormat
42 | AudioFormat 43 | AudioFormat
43 | Unknown 44 | Unknown
@@ -59,6 +60,7 @@ formatFromPath =
59 ".txt" -> PlainTextFormat 60 ".txt" -> PlainTextFormat
60 ".md" -> MarkdownFormat 61 ".md" -> MarkdownFormat
61 ".pdf" -> PortableDocumentFormat 62 ".pdf" -> PortableDocumentFormat
63 ".epub" -> EPUBFormat
62 ".wav" -> AudioFormat 64 ".wav" -> AudioFormat
63 ".oga" -> AudioFormat 65 ".oga" -> AudioFormat
64 ".ogg" -> AudioFormat 66 ".ogg" -> AudioFormat
@@ -103,6 +105,7 @@ itemFileProcessor maxResolution =
103 processorFor PlainTextFormat _ = copyResource PlainText 105 processorFor PlainTextFormat _ = copyResource PlainText
104 processorFor MarkdownFormat _ = copyResource Markdown 106 processorFor MarkdownFormat _ = copyResource Markdown
105 processorFor PortableDocumentFormat _ = copyResource PDF 107 processorFor PortableDocumentFormat _ = copyResource PDF
108 processorFor EPUBFormat _ = copyResource EPUB
106 processorFor VideoFormat _ = copyResource Video 109 processorFor VideoFormat _ = copyResource Video
107 processorFor AudioFormat _ = copyResource Audio 110 processorFor AudioFormat _ = copyResource Audio
108 processorFor Unknown _ = copyResource Other 111 processorFor Unknown _ = copyResource Other
diff --git a/compiler/src/Resource.hs b/compiler/src/Resource.hs
index 804c9a1..1868512 100644
--- a/compiler/src/Resource.hs
+++ b/compiler/src/Resource.hs
@@ -92,6 +92,7 @@ data GalleryItemProps =
92 | PlainText { resource :: Resource } 92 | PlainText { resource :: Resource }
93 | Markdown { resource :: Resource } 93 | Markdown { resource :: Resource }
94 | PDF { resource :: Resource } 94 | PDF { resource :: Resource }
95 | EPUB { resource :: Resource }
95 | Video { resource :: Resource } 96 | Video { resource :: Resource }
96 | Audio { resource :: Resource } 97 | Audio { resource :: Resource }
97 | Other { resource :: Resource } 98 | Other { resource :: Resource }
diff --git a/example/src/Misc Media/First Geneva Convention.epub b/example/src/Misc Media/First Geneva Convention.epub
new file mode 100644
index 0000000..4274ab7
--- /dev/null
+++ b/example/src/Misc Media/First Geneva Convention.epub
Binary files differ
diff --git a/example/src/gallery.yaml b/example/src/gallery.yaml
index 1a6cd69..c13cdca 100644
--- a/example/src/gallery.yaml
+++ b/example/src/gallery.yaml
@@ -10,6 +10,7 @@ includedFiles:
10 - '*.txt' 10 - '*.txt'
11 - '*.md' 11 - '*.md'
12 - '*.pdf' 12 - '*.pdf'
13 - '*.epub'
13 - '*.ogg' 14 - '*.ogg'
14 - '*.mp4' 15 - '*.mp4'
15 16
diff --git a/readme.md b/readme.md
index b363490..0d4ed9f 100644
--- a/readme.md
+++ b/readme.md
@@ -77,6 +77,7 @@ Builds of this software embed and make use of the following libraries:
77 * fortawesome/vue-fontawesome, licensed under the MIT License 77 * fortawesome/vue-fontawesome, licensed under the MIT License
78 * vueuse/core, licensed under the MIT License 78 * vueuse/core, licensed under the MIT License
79 * core-js, licensed under the MIT License 79 * core-js, licensed under the MIT License
80 * Epub.js, licensed under the BSD-2-Clause License
80 * hammerjs, licensed under the MIT License 81 * hammerjs, licensed under the MIT License
81 * marked, licensed under the MIT License 82 * marked, licensed under the MIT License
82 * mosha-vue-toastify, licensed under the MIT License 83 * mosha-vue-toastify, licensed under the MIT License
diff --git a/viewer/ldgallery-viewer.7.md b/viewer/ldgallery-viewer.7.md
index 46509fb..afdaec5 100644
--- a/viewer/ldgallery-viewer.7.md
+++ b/viewer/ldgallery-viewer.7.md
@@ -2,7 +2,7 @@
2pagetitle: Viewer user manual - ldgallery 2pagetitle: Viewer user manual - ldgallery
3title: LDGALLERY-VIEWER(7) ldgallery 3title: LDGALLERY-VIEWER(7) ldgallery
4author: Pacien TRAN-GIRARD, Guillaume FOUET 4author: Pacien TRAN-GIRARD, Guillaume FOUET
5date: 2022-10-26 (v2.1-SNAPSHOT) 5date: 2022-10-30 (v2.1-SNAPSHOT)
6--- 6---
7 7
8 8
@@ -37,8 +37,8 @@ Items of the following formats can be opened and visualised within the web appli
37* Pictures (Bitmap, JPEG, PNG, TIFF, HDR, GIF) 37* Pictures (Bitmap, JPEG, PNG, TIFF, HDR, GIF)
38* Videos (OGV, WebM, Matroska, MPEG-4) 38* Videos (OGV, WebM, Matroska, MPEG-4)
39* Audio files (WAV, Opus, FLAC, MP3, MPEG-4) 39* Audio files (WAV, Opus, FLAC, MP3, MPEG-4)
40* Plain text files (`.txt`) 40* Text files (TXT, Markdown)
41* PDFs 41* Ebooks (PDF, EPUB)
42 42
43Formats which are not listed above or which are not supported by the user's web browser are offered for download instead of being directly displayed in the same window. 43Formats which are not listed above or which are not supported by the user's web browser are offered for download instead of being directly displayed in the same window.
44The item being visualised can be downloaded using the download button at the top-left corner. 44The item being visualised can be downloaded using the download button at the top-left corner.
diff --git a/viewer/package.json b/viewer/package.json
index f5ac5e3..61ea287 100644
--- a/viewer/package.json
+++ b/viewer/package.json
@@ -14,6 +14,7 @@
14 "@fortawesome/vue-fontawesome": "3.0.1", 14 "@fortawesome/vue-fontawesome": "3.0.1",
15 "@vueuse/core": "9.3.1", 15 "@vueuse/core": "9.3.1",
16 "core-js": "3.25.0", 16 "core-js": "3.25.0",
17 "epubjs": "0.3.93",
17 "hammerjs": "2.0.8", 18 "hammerjs": "2.0.8",
18 "marked": "4.1.1", 19 "marked": "4.1.1",
19 "mosha-vue-toastify": "1.0.23", 20 "mosha-vue-toastify": "1.0.23",
diff --git a/viewer/src/@types/gallery.ts b/viewer/src/@types/gallery.ts
index 8c0f177..6960de2 100644
--- a/viewer/src/@types/gallery.ts
+++ b/viewer/src/@types/gallery.ts
@@ -64,6 +64,9 @@ export interface MarkdownProperties extends Downloadable {
64export interface PDFProperties extends Downloadable { 64export interface PDFProperties extends Downloadable {
65 type: ItemType.PDF; 65 type: ItemType.PDF;
66} 66}
67export interface EPUBProperties extends Downloadable {
68 type: ItemType.EPUB;
69}
67export interface VideoProperties extends Downloadable { 70export interface VideoProperties extends Downloadable {
68 type: ItemType.VIDEO; 71 type: ItemType.VIDEO;
69} 72}
@@ -107,6 +110,9 @@ export interface MarkdownItem extends Item {
107export interface PDFItem extends Item { 110export interface PDFItem extends Item {
108 properties: PDFProperties; 111 properties: PDFProperties;
109} 112}
113export interface EPUBItem extends Item {
114 properties: EPUBProperties;
115}
110export interface VideoItem extends Item { 116export interface VideoItem extends Item {
111 properties: VideoProperties; 117 properties: VideoProperties;
112} 118}
diff --git a/viewer/src/@types/itemType.ts b/viewer/src/@types/itemType.ts
index ecab05c..8528728 100644
--- a/viewer/src/@types/itemType.ts
+++ b/viewer/src/@types/itemType.ts
@@ -23,6 +23,7 @@ export enum ItemType {
23 PLAINTEXT = 'plaintext', 23 PLAINTEXT = 'plaintext',
24 MARKDOWN = 'markdown', 24 MARKDOWN = 'markdown',
25 PDF = 'pdf', 25 PDF = 'pdf',
26 EPUB = 'epub',
26 VIDEO = 'video', 27 VIDEO = 'video',
27 AUDIO = 'audio', 28 AUDIO = 'audio',
28 DIRECTORY = 'directory', 29 DIRECTORY = 'directory',
diff --git a/viewer/src/assets/scss/theme.scss b/viewer/src/assets/scss/theme.scss
index 63febbf..6622fa5 100644
--- a/viewer/src/assets/scss/theme.scss
+++ b/viewer/src/assets/scss/theme.scss
@@ -41,6 +41,8 @@ $dropdown-item-color: $palette-600;
41$dropdown-item-hover-color: $palette-500; 41$dropdown-item-hover-color: $palette-500;
42$panel-top-bgcolor: $palette-800; 42$panel-top-bgcolor: $palette-800;
43$panel-top-txtcolor: $primary; 43$panel-top-txtcolor: $primary;
44$panel-bottom-bgcolor: $palette-800;
45$panel-bottom-txtcolor: $primary;
44$panel-left-bgcolor: $palette-800; 46$panel-left-bgcolor: $palette-800;
45$panel-left-txtcolor: $primary; 47$panel-left-txtcolor: $primary;
46$command-buttons-bgcolor: $palette-700; 48$command-buttons-bgcolor: $palette-700;
@@ -55,6 +57,7 @@ $thumbnail-other-size: $body-line-height * 7em;
55$proposed-category-bgcolor: $palette-700; 57$proposed-category-bgcolor: $palette-700;
56$viewer-text: $palette-000; 58$viewer-text: $palette-000;
57$viewer-text-background: $palette-900; 59$viewer-text-background: $palette-900;
60$viewer-epub-background: $palette-000;
58 61
59// Layout 62// Layout
60 63
diff --git a/viewer/src/locales/en.yml b/viewer/src/locales/en.yml
index 86ecd49..280f18b 100644
--- a/viewer/src/locales/en.yml
+++ b/viewer/src/locales/en.yml
@@ -15,6 +15,9 @@ directory:
15 no-results: Empty directory 15 no-results: Empty directory
16download: 16download:
17 download-file-fmt: Download {0} 17 download-file-fmt: Download {0}
18epubViewer:
19 previousSection: Previous section
20 nextSection: Next section
18gallery: 21gallery:
19 resource-loading-error: Error loading resource 22 resource-loading-error: Error loading resource
20 unknown-resource: Resource not found 23 unknown-resource: Resource not found
diff --git a/viewer/src/services/navigation.ts b/viewer/src/services/navigation.ts
index b2e807b..fb01169 100644
--- a/viewer/src/services/navigation.ts
+++ b/viewer/src/services/navigation.ts
@@ -19,7 +19,18 @@
19 19
20import { DirectoryItem, DownloadableItem, Item } from '@/@types/gallery'; 20import { DirectoryItem, DownloadableItem, Item } from '@/@types/gallery';
21import { ItemType } from '@/@types/itemType'; 21import { ItemType } from '@/@types/itemType';
22import { faFile, faFileAlt, faFileAudio, faFilePdf, faFileVideo, faFolder, faHome, faImage, IconDefinition } from '@fortawesome/free-solid-svg-icons'; 22import {
23 faFile,
24 faFileAlt,