diff --git a/CHANGELOG.md b/CHANGELOG.md index 64111fc..f016128 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ------------------ - Улучшение поддержки reverse-proxy, в конфиг добавлены параметры server.root и opds.root для встраивания inpx-web в уже существующий веб-сервер +- В настройки веб-интерфейса добавлена опция "Скачивать книги в виде zip-архива" - Исправлен баг "Android-читалки не очень хорошо работают с OPDS" (#4) - В readme добавлена ссылка для донатов: [отблагодарить автора проекта](https://donatty.com/liberama) diff --git a/client/components/Search/BaseList.js b/client/components/Search/BaseList.js index 0082d58..9afc132 100644 --- a/client/components/Search/BaseList.js +++ b/client/components/Search/BaseList.js @@ -1,3 +1,4 @@ +import axios from 'axios'; import dayjs from 'dayjs'; import _ from 'lodash'; @@ -50,6 +51,7 @@ export default class BaseList { expandedAuthor = []; expandedSeries = []; + downloadAsZip = false; showCounts = true; showRates = true; showGenres = true; @@ -81,6 +83,7 @@ export default class BaseList { this.expandedAuthor = _.cloneDeep(settings.expandedAuthor); this.expandedSeries = _.cloneDeep(settings.expandedSeries); + this.downloadAsZip = settings.downloadAsZip; this.showCounts = settings.showCounts; this.showRates = settings.showRates; this.showGenres = settings.showGenres; @@ -133,13 +136,20 @@ export default class BaseList { const response = await this.api.getBookLink(book._uid); const link = response.link; - const href = `${window.location.origin}${link}`; + let href = `${window.location.origin}${link}`; + //downloadAsZip + if (this.downloadAsZip && (action == 'download' || action == 'copyLink')) { + href += '/zip'; + //подожлем формирования zip-файла + await axios.head(href); + } + + //action if (action == 'download') { //скачивание const d = this.$refs.download; d.href = href; - d.download = response.downFileName; d.click(); } else if (action == 'copyLink') { diff --git a/client/components/Search/SettingsDialog/SettingsDialog.vue b/client/components/Search/SettingsDialog/SettingsDialog.vue index 1d25da2..42e8074 100644 --- a/client/components/Search/SettingsDialog/SettingsDialog.vue +++ b/client/components/Search/SettingsDialog/SettingsDialog.vue @@ -19,7 +19,8 @@ /> - + + @@ -60,6 +61,9 @@ const componentOptions = { limit(newValue) { this.commit('setSettings', {'limit': newValue}); }, + downloadAsZip(newValue) { + this.commit('setSettings', {'downloadAsZip': newValue}); + }, showCounts(newValue) { this.commit('setSettings', {'showCounts': newValue}); }, @@ -93,6 +97,7 @@ class SettingsDialog { //settings limit = 20; + downloadAsZip = false; showCounts = true; showRates = true; showInfo = true; @@ -129,6 +134,7 @@ class SettingsDialog { this.limit = settings.limit; + this.downloadAsZip = settings.downloadAsZip; this.showCounts = settings.showCounts; this.showRates = settings.showRates; this.showInfo = settings.showInfo; diff --git a/client/store/root.js b/client/store/root.js index 6187bbe..1a868b1 100644 --- a/client/store/root.js +++ b/client/store/root.js @@ -7,6 +7,7 @@ const state = { limit: 20, expandedAuthor: [], expandedSeries: [], + downloadAsZip: false, showCounts: true, showRates: true, showInfo: true,