From b4a37fed281f3a4c1d48b94ca5cf787f2f301b4c Mon Sep 17 00:00:00 2001 From: advplyr Date: Sun, 4 Dec 2022 16:30:18 -0600 Subject: [PATCH] Update:Showing fullscreen cover uses raw cover --- components/covers/BookCover.vue | 5 +++-- components/modals/FullscreenCover.vue | 2 +- store/globals.js | 14 +++++++------- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/components/covers/BookCover.vue b/components/covers/BookCover.vue index 2b46ed5d..7cc824e2 100644 --- a/components/covers/BookCover.vue +++ b/components/covers/BookCover.vue @@ -47,7 +47,8 @@ export default { default: 120 }, bookCoverAspectRatio: Number, - downloadCover: String + downloadCover: String, + raw: Boolean }, data() { return { @@ -115,7 +116,7 @@ export default { if (this.downloadCover) return this.downloadCover if (!this.libraryItem) return null var store = this.$store || this.$nuxt.$store - return store.getters['globals/getLibraryItemCoverSrc'](this.libraryItem, this.placeholderUrl) + return store.getters['globals/getLibraryItemCoverSrc'](this.libraryItem, this.placeholderUrl, this.raw) }, cover() { return this.media.coverPath || this.placeholderUrl diff --git a/components/modals/FullscreenCover.vue b/components/modals/FullscreenCover.vue index d5e71e2e..a903ce4a 100644 --- a/components/modals/FullscreenCover.vue +++ b/components/modals/FullscreenCover.vue @@ -1,7 +1,7 @@ diff --git a/store/globals.js b/store/globals.js index 050c36a0..8d2c610d 100644 --- a/store/globals.js +++ b/store/globals.js @@ -45,26 +45,26 @@ export const getters = { return i.libraryItemId == libraryItemId }) }, - getLibraryItemCoverSrc: (state, getters, rootState, rootGetters) => (libraryItem, placeholder = '/book_placeholder.jpg') => { + getLibraryItemCoverSrc: (state, getters, rootState, rootGetters) => (libraryItem, placeholder, raw = false) => { if (!libraryItem) return placeholder - var media = libraryItem.media + const media = libraryItem.media if (!media || !media.coverPath || media.coverPath === placeholder) return placeholder // Absolute URL covers (should no longer be used) if (media.coverPath.startsWith('http:') || media.coverPath.startsWith('https:')) return media.coverPath - var userToken = rootGetters['user/getToken'] - var serverAddress = rootGetters['user/getServerAddress'] + const userToken = rootGetters['user/getToken'] + const serverAddress = rootGetters['user/getServerAddress'] if (!userToken || !serverAddress) return placeholder - var lastUpdate = libraryItem.updatedAt || Date.now() + const lastUpdate = libraryItem.updatedAt || Date.now() if (process.env.NODE_ENV !== 'production') { // Testing // return `http://localhost:3333/api/items/${libraryItem.id}/cover?token=${userToken}&ts=${lastUpdate}` } - var url = new URL(`/api/items/${libraryItem.id}/cover`, serverAddress) - return `${url}?token=${userToken}&ts=${lastUpdate}` + const url = new URL(`/api/items/${libraryItem.id}/cover`, serverAddress) + return `${url}?token=${userToken}&ts=${lastUpdate}${raw ? '&raw=1' : ''}` }, getLocalMediaProgressById: (state) => (localLibraryItemId, episodeId = null) => { return state.localMediaProgress.find(lmp => {