mirror of
https://github.com/advplyr/audiobookshelf-app.git
synced 2026-08-29 22:57:16 +02:00
Remove: local only items from frontend
This commit is contained in:
@@ -63,7 +63,7 @@
|
|||||||
|
|
||||||
<!-- Downloaded icon -->
|
<!-- Downloaded icon -->
|
||||||
<div v-if="showHasLocalDownload" class="absolute right-0 top-0 z-20" :style="{ top: (isPodcast || (seriesSequence && showSequence) ? 1.75 : 0.375) * sizeMultiplier + 'rem', right: 0.375 * sizeMultiplier + 'rem', padding: `${0.1 * sizeMultiplier}rem ${0.25 * sizeMultiplier}rem` }">
|
<div v-if="showHasLocalDownload" class="absolute right-0 top-0 z-20" :style="{ top: (isPodcast || (seriesSequence && showSequence) ? 1.75 : 0.375) * sizeMultiplier + 'rem', right: 0.375 * sizeMultiplier + 'rem', padding: `${0.1 * sizeMultiplier}rem ${0.25 * sizeMultiplier}rem` }">
|
||||||
<span class="material-icons text-2xl text-success">{{ isLocalOnly ? 'task' : 'download_done' }}</span>
|
<span class="material-icons text-2xl text-success">{{ 'download_done' }}</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Error widget -->
|
<!-- Error widget -->
|
||||||
@@ -153,10 +153,6 @@ export default {
|
|||||||
isLocal() {
|
isLocal() {
|
||||||
return !!this._libraryItem.isLocal
|
return !!this._libraryItem.isLocal
|
||||||
},
|
},
|
||||||
isLocalOnly() {
|
|
||||||
// Local item with no server match
|
|
||||||
return this.isLocal && !this._libraryItem.libraryItemId
|
|
||||||
},
|
|
||||||
media() {
|
media() {
|
||||||
return this._libraryItem.media || {}
|
return this._libraryItem.media || {}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -31,7 +31,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div v-if="localLibraryItem || isLocal" class="absolute top-0 right-0 z-20" :style="{ top: 0.375 * sizeMultiplier + 'rem', right: 0.375 * sizeMultiplier + 'rem', padding: `${0.1 * sizeMultiplier}rem ${0.25 * sizeMultiplier}rem` }">
|
<div v-if="localLibraryItem || isLocal" class="absolute top-0 right-0 z-20" :style="{ top: 0.375 * sizeMultiplier + 'rem', right: 0.375 * sizeMultiplier + 'rem', padding: `${0.1 * sizeMultiplier}rem ${0.25 * sizeMultiplier}rem` }">
|
||||||
<span class="material-icons text-2xl text-success">{{ isLocalOnly ? 'task' : 'download_done' }}</span>
|
<span class="material-icons text-2xl text-success">{{ 'download_done' }}</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -93,10 +93,6 @@ export default {
|
|||||||
isLocal() {
|
isLocal() {
|
||||||
return !!this._libraryItem.isLocal
|
return !!this._libraryItem.isLocal
|
||||||
},
|
},
|
||||||
isLocalOnly() {
|
|
||||||
// Local item with no server match
|
|
||||||
return this.isLocal && !this._libraryItem.libraryItemId
|
|
||||||
},
|
|
||||||
media() {
|
media() {
|
||||||
return this._libraryItem.media || {}
|
return this._libraryItem.media || {}
|
||||||
},
|
},
|
||||||
@@ -363,4 +359,4 @@ export default {
|
|||||||
min-width: var(--list-card-cover-width);
|
min-width: var(--list-card-cover-width);
|
||||||
max-width: var(--list-card-cover-width);
|
max-width: var(--list-card-cover-width);
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -36,10 +36,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div v-if="hasLocal" class="mx-1">
|
<div v-if="hasLocal" class="mx-1">
|
||||||
<div v-if="isLocalOnly" class="w-full rounded-md bg-warning/10 border border-warning p-4">
|
<div v-if="currentServerConnectionConfigId && !isLocalMatchingServerAddress" class="w-full rounded-md bg-warning/10 border border-warning p-4">
|
||||||
<p class="text-sm">{{ $strings.MessageMediaNotLinkedToServer }}</p>
|
|
||||||
</div>
|
|
||||||
<div v-else-if="currentServerConnectionConfigId && !isLocalMatchingServerAddress" class="w-full rounded-md bg-warning/10 border border-warning p-4">
|
|
||||||
<p class="text-sm">{{ $getString('MessageMediaLinkedToADifferentServer', [localLibraryItem.serverAddress]) }}</p>
|
<p class="text-sm">{{ $getString('MessageMediaLinkedToADifferentServer', [localLibraryItem.serverAddress]) }}</p>
|
||||||
</div>
|
</div>
|
||||||
<div v-else-if="currentServerConnectionConfigId && !isLocalMatchingUser" class="w-full rounded-md bg-warning/10 border border-warning p-4">
|
<div v-else-if="currentServerConnectionConfigId && !isLocalMatchingUser" class="w-full rounded-md bg-warning/10 border border-warning p-4">
|
||||||
@@ -240,10 +237,6 @@ export default {
|
|||||||
isLocal() {
|
isLocal() {
|
||||||
return this.libraryItem.isLocal
|
return this.libraryItem.isLocal
|
||||||
},
|
},
|
||||||
isLocalOnly() {
|
|
||||||
// TODO: Remove the possibility to have local only on android
|
|
||||||
return this.isLocal && !this.libraryItem.libraryItemId
|
|
||||||
},
|
|
||||||
hasLocal() {
|
hasLocal() {
|
||||||
// Server library item has matching local library item
|
// Server library item has matching local library item
|
||||||
return this.isLocal || this.libraryItem.localLibraryItem
|
return this.isLocal || this.libraryItem.localLibraryItem
|
||||||
@@ -282,21 +275,21 @@ export default {
|
|||||||
* User is currently connected to a server and this local library item has the same server address
|
* User is currently connected to a server and this local library item has the same server address
|
||||||
*/
|
*/
|
||||||
isLocalMatchingServerAddress() {
|
isLocalMatchingServerAddress() {
|
||||||
if (this.isLocalOnly || !this.localLibraryItem || !this.currentServerAddress) return false
|
if (!this.localLibraryItem || !this.currentServerAddress) return false
|
||||||
return this.localLibraryItem.serverAddress === this.currentServerAddress
|
return this.localLibraryItem.serverAddress === this.currentServerAddress
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* User is currently connected to a server and this local library item has the same user id
|
* User is currently connected to a server and this local library item has the same user id
|
||||||
*/
|
*/
|
||||||
isLocalMatchingUser() {
|
isLocalMatchingUser() {
|
||||||
if (this.isLocalOnly || !this.localLibraryItem || !this.user) return false
|
if (!this.localLibraryItem || !this.user) return false
|
||||||
return this.localLibraryItem.serverUserId === this.user.id || this.localLibraryItem.serverUserId === this.user.oldUserId
|
return this.localLibraryItem.serverUserId === this.user.id || this.localLibraryItem.serverUserId === this.user.oldUserId
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* User is currently connected to a server and this local library item has the same connection config id
|
* User is currently connected to a server and this local library item has the same connection config id
|
||||||
*/
|
*/
|
||||||
isLocalMatchingConnectionConfig() {
|
isLocalMatchingConnectionConfig() {
|
||||||
if (this.isLocalOnly || !this.localLibraryItemServerConnectionConfigId || !this.currentServerConnectionConfigId) return false
|
if (!this.localLibraryItemServerConnectionConfigId || !this.currentServerConnectionConfigId) return false
|
||||||
return this.localLibraryItemServerConnectionConfigId === this.currentServerConnectionConfigId
|
return this.localLibraryItemServerConnectionConfigId === this.currentServerConnectionConfigId
|
||||||
},
|
},
|
||||||
bookCoverAspectRatio() {
|
bookCoverAspectRatio() {
|
||||||
|
|||||||
@@ -51,9 +51,6 @@ export default {
|
|||||||
if (!this.mediaItemHistory) return []
|
if (!this.mediaItemHistory) return []
|
||||||
return (this.mediaItemHistory.events || []).sort((a, b) => b.timestamp - a.timestamp)
|
return (this.mediaItemHistory.events || []).sort((a, b) => b.timestamp - a.timestamp)
|
||||||
},
|
},
|
||||||
mediaItemIsLocal() {
|
|
||||||
return this.mediaItemHistory && this.mediaItemHistory.isLocal
|
|
||||||
},
|
|
||||||
mediaItemLibraryItemId() {
|
mediaItemLibraryItemId() {
|
||||||
if (!this.mediaItemHistory) return null
|
if (!this.mediaItemHistory) return null
|
||||||
return this.mediaItemHistory.libraryItemId
|
return this.mediaItemHistory.libraryItemId
|
||||||
@@ -91,7 +88,7 @@ export default {
|
|||||||
|
|
||||||
// Collapse saves
|
// Collapse saves
|
||||||
if (evt.name === 'Save') {
|
if (evt.name === 'Save') {
|
||||||
let saveName = evt.name + "-" + evt.serverSyncAttempted + "-" + evt.serverSyncSuccess
|
let saveName = evt.name + '-' + evt.serverSyncAttempted + '-' + evt.serverSyncSuccess
|
||||||
if (lastSaveName === saveName && numSaves > 0 && !keyUpdated) {
|
if (lastSaveName === saveName && numSaves > 0 && !keyUpdated) {
|
||||||
include = false
|
include = false
|
||||||
const totalInGroup = groups[key].length
|
const totalInGroup = groups[key].length
|
||||||
@@ -140,19 +137,14 @@ export default {
|
|||||||
},
|
},
|
||||||
playAtTime(startTime) {
|
playAtTime(startTime) {
|
||||||
this.$store.commit('setPlayerIsStartingPlayback', this.mediaItemEpisodeId || this.mediaItemLibraryItemId)
|
this.$store.commit('setPlayerIsStartingPlayback', this.mediaItemEpisodeId || this.mediaItemLibraryItemId)
|
||||||
if (this.mediaItemIsLocal) {
|
// Server may have local
|
||||||
// Local only
|
const localProg = this.$store.getters['globals/getLocalMediaProgressByServerItemId'](this.mediaItemLibraryItemId, this.mediaItemEpisodeId)
|
||||||
this.$eventBus.$emit('play-item', { libraryItemId: this.mediaItemLibraryItemId, episodeId: this.mediaItemEpisodeId, startTime })
|
if (localProg) {
|
||||||
|
// Has local copy so prefer
|
||||||
|
this.$eventBus.$emit('play-item', { libraryItemId: localProg.localLibraryItemId, episodeId: localProg.localEpisodeId, serverLibraryItemId: this.mediaItemLibraryItemId, serverEpisodeId: this.mediaItemEpisodeId, startTime })
|
||||||
} else {
|
} else {
|
||||||
// Server may have local
|
// Only on server
|
||||||
const localProg = this.$store.getters['globals/getLocalMediaProgressByServerItemId'](this.mediaItemLibraryItemId, this.mediaItemEpisodeId)
|
this.$eventBus.$emit('play-item', { libraryItemId: this.mediaItemLibraryItemId, episodeId: this.mediaItemEpisodeId, startTime })
|
||||||
if (localProg) {
|
|
||||||
// Has local copy so prefer
|
|
||||||
this.$eventBus.$emit('play-item', { libraryItemId: localProg.localLibraryItemId, episodeId: localProg.localEpisodeId, serverLibraryItemId: this.mediaItemLibraryItemId, serverEpisodeId: this.mediaItemEpisodeId, startTime })
|
|
||||||
} else {
|
|
||||||
// Only on server
|
|
||||||
this.$eventBus.$emit('play-item', { libraryItemId: this.mediaItemLibraryItemId, episodeId: this.mediaItemEpisodeId, startTime })
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
getEventIcon(name) {
|
getEventIcon(name) {
|
||||||
@@ -211,4 +203,4 @@ export default {
|
|||||||
if (this.onMediaItemHistoryUpdatedListener) this.onMediaItemHistoryUpdatedListener.remove()
|
if (this.onMediaItemHistoryUpdatedListener) this.onMediaItemHistoryUpdatedListener.remove()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Reference in New Issue
Block a user