From a77afa0a16d725687f5343bff4b7259ce4d12750 Mon Sep 17 00:00:00 2001 From: sysadminstory Date: Wed, 26 Jan 2022 00:50:33 +0100 Subject: [PATCH 1/5] Fix ePub reader data saving Saving data for ePub File is fixed by updating the base path take as reference. --- templates/epubreader.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/epubreader.php b/templates/epubreader.php index 6ddf590..1251cd4 100644 --- a/templates/epubreader.php +++ b/templates/epubreader.php @@ -28,7 +28,7 @@ ?> - +' data-scope='' data-cursor='' data-defaults='' data-preferences='' data-metadata='' data-annotations=''> From 35450546d9a6694519e6d0581e51d3e5ba8cd51b Mon Sep 17 00:00:00 2001 From: sysadminstory Date: Thu, 27 Jan 2022 23:29:01 +0100 Subject: [PATCH 2/5] Fix PDF reader data saving Saving data for ePub File is fixed by updating the base path taken as reference. --- templates/pdfreader.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/pdfreader.php b/templates/pdfreader.php index fc77698..5e7bf20 100644 --- a/templates/pdfreader.php +++ b/templates/pdfreader.php @@ -28,7 +28,7 @@ ?> - +' data-scope='' data-cursor='' data-defaults='' data-preferences='' data-metadata='' data-annotations=''> From c777a4b518ebbace20058f1a2c0e7db890dc6ba0 Mon Sep 17 00:00:00 2001 From: sysadminstory Date: Thu, 27 Jan 2022 23:56:57 +0100 Subject: [PATCH 3/5] Change to make work PDF reader using a cusomer app folder Move the loading of the 'pdf.worker.js' file from ready.js to pdfreader.php --- js/ready.js | 3 ++- templates/pdfreader.php | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/js/ready.js b/js/ready.js index 721c1df..421279d 100644 --- a/js/ready.js +++ b/js/ready.js @@ -145,7 +145,8 @@ document.onreadystatechange = function () { function renderPdf(file, options) { PDFJS.filePath = "vendor/pdfjs/"; PDFJS.imageResourcesPath = "vendor/pdfjs/css/images/"; - PDFJS.workerSrc = options.session.basePath + 'vendor/pdfjs/lib/pdf.worker.js'; + // This file is loaded using the HTML template instead + // PDFJS.workerSrc = options.session.basePath + 'vendor/pdfjs/lib/pdf.worker.js'; var reader = pdfReader(file, options); } diff --git a/templates/pdfreader.php b/templates/pdfreader.php index 5e7bf20..4de36d8 100644 --- a/templates/pdfreader.php +++ b/templates/pdfreader.php @@ -43,6 +43,7 @@ + From 37ff6488306bcf523db79f0e1879e08ac8d86252 Mon Sep 17 00:00:00 2001 From: sysadminstory Date: Thu, 27 Jan 2022 23:29:01 +0100 Subject: [PATCH 4/5] Fix PDF reader data saving Saving data for ePub File is fixed by updating the base path taken as reference. --- js/ready.js | 3 ++- templates/pdfreader.php | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/js/ready.js b/js/ready.js index 721c1df..421279d 100644 --- a/js/ready.js +++ b/js/ready.js @@ -145,7 +145,8 @@ document.onreadystatechange = function () { function renderPdf(file, options) { PDFJS.filePath = "vendor/pdfjs/"; PDFJS.imageResourcesPath = "vendor/pdfjs/css/images/"; - PDFJS.workerSrc = options.session.basePath + 'vendor/pdfjs/lib/pdf.worker.js'; + // This file is loaded using the HTML template instead + // PDFJS.workerSrc = options.session.basePath + 'vendor/pdfjs/lib/pdf.worker.js'; var reader = pdfReader(file, options); } diff --git a/templates/pdfreader.php b/templates/pdfreader.php index fc77698..4de36d8 100644 --- a/templates/pdfreader.php +++ b/templates/pdfreader.php @@ -28,7 +28,7 @@ ?> - +' data-scope='' data-cursor='' data-defaults='' data-preferences='' data-metadata='' data-annotations=''> @@ -43,6 +43,7 @@ + From cd18e33e2760ef64c5b3fa2e1aee9603f364a83e Mon Sep 17 00:00:00 2001 From: sysadminstory Date: Tue, 22 Mar 2022 11:22:04 +0100 Subject: [PATCH 5/5] Separate static file and data saving URLs Static files (like css, js, ...) are now loaded using the 'data-staticpath' parameter, that was added to every template. Static files must be loaded using the real physical URL (un the "customapps" folder if used) instead of the dynamic files, that must be loaded using the index.php file (hidden if the URL rewriting is activated) --- js/ready.js | 7 +++---- templates/cbreader.php | 2 +- templates/epubreader.php | 2 +- templates/pdfreader.php | 2 +- vendor/cbrjs/cbr.js | 4 ++-- 5 files changed, 8 insertions(+), 9 deletions(-) diff --git a/js/ready.js b/js/ready.js index 421279d..d14fdfe 100644 --- a/js/ready.js +++ b/js/ready.js @@ -23,10 +23,9 @@ document.onreadystatechange = function () { options.session.preferences = $session.data('preferences') || {}; options.session.defaults = $session.data('defaults') || {}; options.session.basePath = $session.data('basepath'); + options.session.staticPath = $session.data('staticpath'); options.session.downloadLink = $session.data('downloadlink'); - console.log(options.session.basePath); - /* functions return jquery promises */ options.session.getPreference = function(name) { @@ -118,6 +117,7 @@ document.onreadystatechange = function () { EPUBJS.filePath = "vendor/epubjs/"; EPUBJS.cssPath = "vendor/epubjs/css/"; EPUBJS.basePath = $('.session').data('basepath'); + EPUBJS.staticPath = $('.session').data('staticpath'); /* device-specific boilerplate */ @@ -145,8 +145,7 @@ document.onreadystatechange = function () { function renderPdf(file, options) { PDFJS.filePath = "vendor/pdfjs/"; PDFJS.imageResourcesPath = "vendor/pdfjs/css/images/"; - // This file is loaded using the HTML template instead - // PDFJS.workerSrc = options.session.basePath + 'vendor/pdfjs/lib/pdf.worker.js'; + PDFJS.workerSrc = options.session.staticPath + 'vendor/pdfjs/lib/pdf.worker.js'; var reader = pdfReader(file, options); } diff --git a/templates/cbreader.php b/templates/cbreader.php index c7aab33..51cc42f 100644 --- a/templates/cbreader.php +++ b/templates/cbreader.php @@ -28,7 +28,7 @@ ?> - +' data-staticpath='linkTo('epubreader', ''));?>' data-scope='' data-cursor='' data-defaults='' data-preferences='' data-metadata='' data-annotations=''> diff --git a/templates/epubreader.php b/templates/epubreader.php index 1251cd4..d804403 100644 --- a/templates/epubreader.php +++ b/templates/epubreader.php @@ -28,7 +28,7 @@ ?> -' data-scope='' data-cursor='' data-defaults='' data-preferences='' data-metadata='' data-annotations=''> +' data-staticpath='linkTo('epubreader', ''));?>' data-scope='' data-cursor='' data-defaults='' data-preferences='' data-metadata='' data-annotations=''> diff --git a/templates/pdfreader.php b/templates/pdfreader.php index 4de36d8..577de3c 100644 --- a/templates/pdfreader.php +++ b/templates/pdfreader.php @@ -28,7 +28,7 @@ ?> -' data-scope='' data-cursor='' data-defaults='' data-preferences='' data-metadata='' data-annotations=''> +' data-staticpath='linkTo('epubreader', ''));?>' data-scope='' data-cursor='' data-defaults='' data-preferences='' data-metadata='' data-annotations=''> diff --git a/vendor/cbrjs/cbr.js b/vendor/cbrjs/cbr.js index 082389a..e866d25 100644 --- a/vendor/cbrjs/cbr.js +++ b/vendor/cbrjs/cbr.js @@ -73,7 +73,7 @@ CBRJS.Reader = function(bookPath, _options) { xhr.onload = function () { if ((this.status === 200) && this.response) { var done = false; - var ua = new bitjs.archive[archive_class](this.response, document.head.dataset.basepath + 'vendor/bitjs/'); + var ua = new bitjs.archive[archive_class](this.response, document.head.dataset.staticpath + 'vendor/bitjs/'); ua.addEventListener(bitjs.archive.UnarchiveEvent.Type.START, function (e) { $progressbar.css('width', '0%'); @@ -276,7 +276,7 @@ ComicBook = (function ($) { 70: 'toggleFullscreen', // f 27: 'closeSidebar' // esc }, - vendorPath: document.head.dataset.basepath + 'vendor/', + vendorPath: document.head.dataset.staticpath + 'vendor/', forward_buffer: 3, session: { getCursor: function() {},