feat(webui): download read list as zip

closes #411
This commit is contained in:
Gauthier Roebroeck 2021-10-05 18:09:22 +08:00
parent 7a176f2307
commit acdea3daf1
4 changed files with 26 additions and 2 deletions

View file

@ -52,6 +52,10 @@ export function readListThumbnailUrl (readListId: string): string {
return `${urls.originNoSlash}/api/v1/readlists/${readListId}/thumbnail`
}
export function readListFileUrl (readListId: string): string {
return `${urls.originNoSlash}/api/v1/readlists/${readListId}/file`
}
export function transientBookPageUrl (transientBookId: string, page: number): string {
return `${urls.originNoSlash}/api/v1/transient-books/${transientBookId}/pages/${page}`
}

View file

@ -596,6 +596,7 @@
"bulk_edit_metadata": "Bulk edit metadata",
"delete": "Delete",
"deselect_all": "Deselect all",
"download_readlist": "Download read list",
"download_series": "Download series",
"edit": "Edit",
"edit_metadata": "Edit metadata",

View file

@ -94,7 +94,19 @@
</v-col>
</v-row>
<v-divider v-if="readList.summary" class="my-3"/>
<v-row class="px-2">
<v-col>
<v-btn :title="$t('menu.download_readlist')"
small
:disabled="!canDownload"
:href="fileUrl">
<v-icon left small>mdi-file-download</v-icon>
{{ $t('common.download') }}
</v-btn>
</v-col>
</v-row>
<v-divider class="my-3"/>
<item-browser
:items.sync="books"
@ -136,6 +148,7 @@ import {authorRoles} from '@/types/author-roles'
import {LibraryDto} from '@/types/komga-libraries'
import {mergeFilterParams, toNameValue} from '@/functions/filter'
import {Location} from 'vue-router'
import {readListFileUrl} from '@/functions/urls'
export default Vue.extend({
name: 'BrowseReadList',
@ -242,6 +255,12 @@ export default Vue.extend({
isAdmin(): boolean {
return this.$store.getters.meAdmin
},
canDownload(): boolean {
return this.$store.getters.meFileDownload
},
fileUrl(): string {
return readListFileUrl(this.readListId)
},
filterActive(): boolean {
return Object.keys(this.filters).some(x => this.filters[x].length !== 0)
},

View file

@ -541,7 +541,7 @@ export default Vue.extend({
return this.$store.getters.meFileDownload && !this.unavailable
},
fileUrl(): string {
return seriesFileUrl(this.series.id)
return seriesFileUrl(this.seriesId)
},
thumbnailUrl(): string {
return seriesThumbnailUrl(this.seriesId)