Update:New EBook API endpoint

This commit is contained in:
advplyr 2023-05-28 10:47:28 -05:00
parent b3f19ef628
commit 4f75a89633
11 changed files with 72 additions and 40 deletions

View file

@ -57,7 +57,6 @@ Archive.init({
export default {
props: {
url: String,
libraryItem: {
type: Object,
default: () => {}
@ -88,6 +87,15 @@ export default {
}
},
computed: {
userToken() {
return this.$store.getters['user/getToken']
},
libraryItemId() {
return this.libraryItem?.id
},
ebookUrl() {
return `/api/items/${this.libraryItemId}/ebook`
},
comicMetadataKeys() {
return this.comicMetadata ? Object.keys(this.comicMetadata) : []
},
@ -146,10 +154,11 @@ export default {
},
async extract() {
this.loading = true
console.log('Extracting', this.url)
var buff = await this.$axios.$get(this.url, {
responseType: 'blob'
var buff = await this.$axios.$get(this.ebookUrl, {
responseType: 'blob',
headers: {
Authorization: `Bearer ${this.userToken}`
}
})
const archive = await Archive.open(buff)
const originalFilesObject = await archive.getFilesObject()