diff --git a/client/components/Search/BookView/BookView.vue b/client/components/Search/BookView/BookView.vue index f34fd55..8a11cd2 100644 --- a/client/components/Search/BookView/BookView.vue +++ b/client/components/Search/BookView/BookView.vue @@ -40,6 +40,10 @@ +
+ (читать) +
+
{{ bookGenre }}
@@ -86,6 +90,10 @@ class BookView { this.showDeleted = settings.showDeleted; } + get config() { + return this.$store.state.config; + } + get settings() { return this.$store.state.settings; } @@ -132,6 +140,10 @@ class BookView { copyLink() { this.$emit('bookEvent', {action: 'copyLink', book: this.book}); } + + readBook() { + this.$emit('bookEvent', {action: 'readBook', book: this.book}); + } } export default vueComponent(BookView); diff --git a/client/components/Search/Search.vue b/client/components/Search/Search.vue index 3387c2b..b4b5ae6 100644 --- a/client/components/Search/Search.vue +++ b/client/components/Search/Search.vue @@ -654,7 +654,7 @@ class Search { this.search.series = `=${series}`; } - async download(book, copy = false) { + async download(book, action) { if (this.downloadFlag) return; @@ -691,19 +691,22 @@ class Search { const link = response.link; const href = `${window.location.origin}${link}`; - if (!copy) { + if (action == 'download') { //скачивание const d = this.$refs.download; d.href = href; d.download = downFileName; d.click(); - } else { + } else if (action == 'copyLink') { //копирование ссылки if (utils.copyTextToClipboard(href)) this.$root.notify.success('Ссылка успешно скопирована'); else this.$root.notify.error('Копирование ссылки не удалось'); + } else if (action == 'readBook') { + const url = this.config.bookReadLink.replace('${DOWNLOAD_LINK}', href); + window.open(url, '_blank'); } } catch(e) { this.$root.stdDialog.alert(e.message, 'Ошибка'); @@ -719,10 +722,9 @@ class Search { this.search.title = `=${event.book.title}`; break; case 'download': - this.download(event.book);//no await - break; case 'copyLink': - this.download(event.book, true);//no await + case 'readBook': + this.download(event.book, event.action);//no await break; } } diff --git a/server/config/base.js b/server/config/base.js index bc0e15d..c3af3f8 100644 --- a/server/config/base.js +++ b/server/config/base.js @@ -16,6 +16,7 @@ module.exports = { publicDir: `${dataDir}/public`, accessPassword: '', + bookReadLink: '', loggingEnabled: true, maxFilesDirSize: 1024*1024*1024,//1Gb @@ -23,7 +24,7 @@ module.exports = { cacheCleanInterval: 60,//minutes lowMemoryMode: false, - webConfigParams: ['name', 'version', 'branch'], + webConfigParams: ['name', 'version', 'branch', 'bookReadLink'], server: { ip: '0.0.0.0', diff --git a/server/config/index.js b/server/config/index.js index edfcfdf..42b4953 100644 --- a/server/config/index.js +++ b/server/config/index.js @@ -5,6 +5,7 @@ const branchFilename = __dirname + '/application_env'; const propsToSave = [ 'accessPassword', + 'bookReadLink', 'loggingEnabled', 'maxFilesDirSize', 'queryCacheEnabled',