From 42616b59de16c21721137accb3078874ef90008d Mon Sep 17 00:00:00 2001 From: mikiher Date: Mon, 14 Oct 2024 13:30:17 +0300 Subject: [PATCH] Cleanup: remove explicit localhost:3333 and remove unnessesary if(dev) blocks --- client/components/covers/AuthorImage.vue | 6 +----- client/components/modals/ShareModal.vue | 4 ++-- client/components/modals/rssfeed/OpenCloseModal.vue | 2 +- client/pages/audiobook/_id/chapters.vue | 2 +- client/players/AudioTrack.js | 4 ---- client/store/globals.js | 10 ---------- 6 files changed, 5 insertions(+), 23 deletions(-) diff --git a/client/components/covers/AuthorImage.vue b/client/components/covers/AuthorImage.vue index af8a394f..01926363 100644 --- a/client/components/covers/AuthorImage.vue +++ b/client/components/covers/AuthorImage.vue @@ -56,11 +56,7 @@ export default { }, imgSrc() { if (!this.imagePath) return null - if (process.env.NODE_ENV !== 'production') { - // Testing - return `http://localhost:3333${this.$config.routerBasePath}/api/authors/${this.authorId}/image?token=${this.userToken}&ts=${this.updatedAt}` - } - return `/api/authors/${this.authorId}/image?token=${this.userToken}&ts=${this.updatedAt}` + return `${this.$config.routerBasePath}/api/authors/${this.authorId}/image?token=${this.userToken}&ts=${this.updatedAt}` } }, methods: { diff --git a/client/components/modals/ShareModal.vue b/client/components/modals/ShareModal.vue index 65ef4fc7..d0487fd3 100644 --- a/client/components/modals/ShareModal.vue +++ b/client/components/modals/ShareModal.vue @@ -112,11 +112,11 @@ export default { return this.$store.state.user.user }, demoShareUrl() { - return `${window.origin}/share/${this.newShareSlug}` + return `${window.origin}${this.$config.routerBasePath}/share/${this.newShareSlug}` }, currentShareUrl() { if (!this.currentShare) return '' - return `${window.origin}/share/${this.currentShare.slug}` + return `${window.origin}${this.$config.routerBasePath}/share/${this.currentShare.slug}` }, currentShareTimeRemaining() { if (!this.currentShare) return 'Error' diff --git a/client/components/modals/rssfeed/OpenCloseModal.vue b/client/components/modals/rssfeed/OpenCloseModal.vue index f15a8e8e..53542cf5 100644 --- a/client/components/modals/rssfeed/OpenCloseModal.vue +++ b/client/components/modals/rssfeed/OpenCloseModal.vue @@ -139,7 +139,7 @@ export default { slug: this.newFeedSlug, metadataDetails: this.metadataDetails } - if (this.$isDev) payload.serverAddress = `http://localhost:3333${this.$config.routerBasePath}` + if (this.$isDev) payload.serverAddress = process.env.serverUrl console.log('Payload', payload) this.$axios diff --git a/client/pages/audiobook/_id/chapters.vue b/client/pages/audiobook/_id/chapters.vue index 3448479b..43d64b90 100644 --- a/client/pages/audiobook/_id/chapters.vue +++ b/client/pages/audiobook/_id/chapters.vue @@ -415,7 +415,7 @@ export default { const audioEl = this.audioEl || document.createElement('audio') var src = audioTrack.contentUrl + `?token=${this.userToken}` if (this.$isDev) { - src = `http://localhost:3333${this.$config.routerBasePath}${src}` + src = `${process.env.serverUrl}${src}` } audioEl.src = src diff --git a/client/players/AudioTrack.js b/client/players/AudioTrack.js index 78ddfd76..9627d3cd 100644 --- a/client/players/AudioTrack.js +++ b/client/players/AudioTrack.js @@ -23,10 +23,6 @@ export default class AudioTrack { get relativeContentUrl() { if (!this.contentUrl || this.contentUrl.startsWith('http')) return this.contentUrl - if (process.env.NODE_ENV === 'development') { - return `${process.env.serverUrl}${this.contentUrl}?token=${this.userToken}` - } - return this.contentUrl + `?token=${this.userToken}` } } diff --git a/client/store/globals.js b/client/store/globals.js index 8e98c56d..553301f5 100644 --- a/client/store/globals.js +++ b/client/store/globals.js @@ -98,12 +98,6 @@ export const getters = { const userToken = rootGetters['user/getToken'] const lastUpdate = libraryItem.updatedAt || Date.now() const libraryItemId = libraryItem.libraryItemId || libraryItem.id // Workaround for /users/:id page showing media progress covers - - if (process.env.NODE_ENV !== 'production') { - // Testing - return `http://localhost:3333${rootState.routerBasePath}/api/items/${libraryItemId}/cover?token=${userToken}&ts=${lastUpdate}${raw ? '&raw=1' : ''}` - } - return `${rootState.routerBasePath}/api/items/${libraryItemId}/cover?token=${userToken}&ts=${lastUpdate}${raw ? '&raw=1' : ''}` }, getLibraryItemCoverSrcById: @@ -112,10 +106,6 @@ export const getters = { const placeholder = `${rootState.routerBasePath}/book_placeholder.jpg` if (!libraryItemId) return placeholder const userToken = rootGetters['user/getToken'] - if (process.env.NODE_ENV !== 'production') { - // Testing - return `http://localhost:3333${rootState.routerBasePath}/api/items/${libraryItemId}/cover?token=${userToken}${raw ? '&raw=1' : ''}${timestamp ? `&ts=${timestamp}` : ''}` - } return `${rootState.routerBasePath}/api/items/${libraryItemId}/cover?token=${userToken}${raw ? '&raw=1' : ''}${timestamp ? `&ts=${timestamp}` : ''}` }, getIsBatchSelectingMediaItems: (state) => {