diff --git a/pages/item/_id/index.vue b/pages/item/_id/index.vue
index 6f6c8ba4..97c99ed5 100644
--- a/pages/item/_id/index.vue
+++ b/pages/item/_id/index.vue
@@ -27,9 +27,23 @@
{{ subtitle }}
-
- connected
- {{ libraryItem.serverAddress }}
+
+
+
Media is not linked to an Audiobookshelf server. No progress will be synced.
+
+
+
Media is linked to an Audiobookshelf server on a different address ({{ localLibraryItem.serverAddress }}). No progress will be synced until you connect to this server.
+
+
+
Media is linked to a different server connection config. This might mean a different user downloaded this media (User Id: {{ localLibraryItem.serverUserId }}). Currently connected user id: {{ user.id }}. Progress will only sync to the user that downloaded the media.
+
+
+
Downloaded media is linked to this server
+
+
+
Linked to server {{ libraryItem.serverAddress }}
+
+
@@ -151,6 +165,10 @@ export default {
if (libraryItemId.startsWith('local')) {
libraryItem = await app.$db.getLocalLibraryItem(libraryItemId)
console.log('Got lli', libraryItemId)
+ // If library item is linked to the currently connected server then redirect to the page using the server library item id
+ if (libraryItem?.libraryItemId && libraryItem?.serverAddress === store.getters['user/getServerAddress']) {
+ return redirect(`/item/${libraryItem.libraryItemId}`)
+ }
} else if (store.state.user.serverConnectionConfig) {
libraryItem = await app.$nativeHttp.get(`/api/items/${libraryItemId}?expanded=1&include=rssfeed`).catch((error) => {
console.error('Failed', error)
@@ -201,6 +219,10 @@ export default {
isLocal() {
return this.libraryItem.isLocal
},
+ isLocalOnly() {
+ // TODO: Remove the possibility to have local only on android
+ return this.isLocal && !this.libraryItem.libraryItemId
+ },
hasLocal() {
// Server library item has matching local library item
return this.isLocal || this.libraryItem.localLibraryItem
@@ -221,11 +243,34 @@ export default {
if (!this.isLocal) return this.libraryItem.id
// Check if local library item is connected to the current server
if (!this.libraryItem.serverAddress || !this.libraryItem.libraryItemId) return null
- if (this.$store.getters['user/getServerAddress'] === this.libraryItem.serverAddress) {
+ if (this.currentServerAddress === this.libraryItem.serverAddress) {
return this.libraryItem.libraryItemId
}
return null
},
+ localLibraryItemServerConnectionConfigId() {
+ return this.localLibraryItem?.serverConnectionConfigId
+ },
+ currentServerAddress() {
+ return this.$store.getters['user/getServerAddress']
+ },
+ currentServerConnectionConfigId() {
+ return this.$store.getters['user/getServerConnectionConfigId']
+ },
+ /**
+ * User is currently connected to a server and this local library item has the same server address
+ */
+ isLocalMatchingServerAddress() {
+ if (this.isLocalOnly || !this.localLibraryItem || !this.currentServerAddress) return false
+ return this.localLibraryItem.serverAddress === this.currentServerAddress
+ },
+ /**
+ * User is currently connected to a server and this local library item has the same connection config id
+ */
+ isLocalMatchingConnectionConfig() {
+ if (this.isLocalOnly || !this.localLibraryItemServerConnectionConfigId || !this.currentServerConnectionConfigId) return false
+ return this.localLibraryItemServerConnectionConfigId === this.currentServerConnectionConfigId
+ },
bookCoverAspectRatio() {
return this.$store.getters['libraries/getBookCoverAspectRatio']
},
diff --git a/plugins/capacitor/AbsDatabase.js b/plugins/capacitor/AbsDatabase.js
index 0d6ee8a6..42ab8701 100644
--- a/plugins/capacitor/AbsDatabase.js
+++ b/plugins/capacitor/AbsDatabase.js
@@ -88,6 +88,8 @@ class AbsDatabaseWeb extends WebPlugin {
value: [{
id: 'local_test',
libraryItemId: 'test34',
+ serverAddress: 'https://abs.test.com',
+ serverUserId: 'test56',
folderId: 'test1',
absolutePath: 'a',
contentUrl: 'c',