diff --git a/client/components/app/Appbar.vue b/client/components/app/Appbar.vue index 81f0cafd..970f0c8e 100644 --- a/client/components/app/Appbar.vue +++ b/client/components/app/Appbar.vue @@ -158,7 +158,7 @@ export default { } }) this.$axios - .patch(`/api/user/audiobooks`, updateProgressPayloads) + .patch(`/api/me/audiobook/batch/update`, updateProgressPayloads) .then(() => { this.$toast.success('Batch update success!') this.$store.commit('setProcessingBatch', false) @@ -177,7 +177,7 @@ export default { this.processingBatchDelete = true this.$store.commit('setProcessingBatch', true) this.$axios - .$post(`/api/audiobooks/delete`, { + .$post(`/api/books/batch/delete`, { audiobookIds: this.selectedAudiobooks }) .then(() => { diff --git a/client/components/app/BookListRow.vue b/client/components/app/BookListRow.vue index 0a44809d..7976c1a6 100644 --- a/client/components/app/BookListRow.vue +++ b/client/components/app/BookListRow.vue @@ -162,7 +162,7 @@ export default { } this.isProcessingReadUpdate = true this.$axios - .$patch(`/api/user/audiobook/${this.audiobookId}`, updatePayload) + .$patch(`/api/me/audiobook/${this.audiobookId}`, updatePayload) .then(() => { this.isProcessingReadUpdate = false this.$toast.success(`"${this.title}" Marked as ${updatePayload.isRead ? 'Read' : 'Not Read'}`) diff --git a/client/components/cards/BookCard.vue b/client/components/cards/BookCard.vue index 2c4e3536..9f944562 100644 --- a/client/components/cards/BookCard.vue +++ b/client/components/cards/BookCard.vue @@ -326,7 +326,7 @@ export default { } this.isProcessingReadUpdate = true this.$axios - .$patch(`/api/user/audiobook/${this.audiobookId}`, updatePayload) + .$patch(`/api/me/audiobook/${this.audiobookId}`, updatePayload) .then(() => { this.isProcessingReadUpdate = false this.$toast.success(`"${this.title}" Marked as ${updatePayload.isRead ? 'Read' : 'Not Read'}`) diff --git a/client/components/controls/GlobalSearch.vue b/client/components/controls/GlobalSearch.vue index ca79be2b..efc10705 100644 --- a/client/components/controls/GlobalSearch.vue +++ b/client/components/controls/GlobalSearch.vue @@ -131,7 +131,7 @@ export default { } this.isFetching = true - var searchResults = await this.$axios.$get(`/api/library/${this.currentLibraryId}/search?q=${value}`).catch((error) => { + var searchResults = await this.$axios.$get(`/api/libraries/${this.currentLibraryId}/search?q=${value}`).catch((error) => { console.error('Search error', error) return [] }) diff --git a/client/components/modals/AccountModal.vue b/client/components/modals/AccountModal.vue index 14fbf9af..2a25eac2 100644 --- a/client/components/modals/AccountModal.vue +++ b/client/components/modals/AccountModal.vue @@ -171,7 +171,7 @@ export default { this.processing = true console.log('Calling update', account) this.$axios - .$patch(`/api/user/${this.account.id}`, account) + .$patch(`/api/users/${this.account.id}`, account) .then((data) => { this.processing = false if (data.error) { @@ -198,7 +198,7 @@ export default { var account = { ...this.newUser } this.processing = true this.$axios - .$post('/api/user', account) + .$post('/api/users', account) .then((data) => { this.processing = false if (data.error) { diff --git a/client/components/modals/EditCollectionModal.vue b/client/components/modals/EditCollectionModal.vue index d1d0f907..858ed7d4 100644 --- a/client/components/modals/EditCollectionModal.vue +++ b/client/components/modals/EditCollectionModal.vue @@ -94,7 +94,7 @@ export default { this.processing = true var collectionName = this.collectionName this.$axios - .$delete(`/api/collection/${this.collection.id}`) + .$delete(`/api/collections/${this.collection.id}`) .then(() => { this.processing = false this.show = false @@ -122,7 +122,7 @@ export default { description: this.newCollectionDescription || null } this.$axios - .$patch(`/api/collection/${this.collection.id}`, collectionUpdate) + .$patch(`/api/collections/${this.collection.id}`, collectionUpdate) .then((collection) => { console.log('Collection Updated', collection) this.processing = false diff --git a/client/components/modals/EditModal.vue b/client/components/modals/EditModal.vue index e51ce44a..d20430dd 100644 --- a/client/components/modals/EditModal.vue +++ b/client/components/modals/EditModal.vue @@ -220,7 +220,7 @@ export default { async fetchFull() { try { this.processing = true - this.audiobook = await this.$axios.$get(`/api/audiobook/${this.selectedAudiobookId}`) + this.audiobook = await this.$axios.$get(`/api/books/${this.selectedAudiobookId}`) this.processing = false } catch (error) { console.error('Failed to fetch audiobook', this.selectedAudiobookId, error) diff --git a/client/components/modals/UserCollectionsModal.vue b/client/components/modals/UserCollectionsModal.vue index 53e208e2..16e26199 100644 --- a/client/components/modals/UserCollectionsModal.vue +++ b/client/components/modals/UserCollectionsModal.vue @@ -96,7 +96,7 @@ export default { this.processing = true this.$axios - .$delete(`/api/collection/${collection.id}/book/${this.selectedAudiobookId}`) + .$delete(`/api/collections/${collection.id}/book/${this.selectedAudiobookId}`) .then((updatedCollection) => { console.log(`Book removed from collection`, updatedCollection) this.$toast.success('Book removed from collection') @@ -114,7 +114,7 @@ export default { this.processing = true this.$axios - .$post(`/api/collection/${collection.id}/book`, { id: this.selectedAudiobookId }) + .$post(`/api/collections/${collection.id}/book`, { id: this.selectedAudiobookId }) .then((updatedCollection) => { console.log(`Book added to collection`, updatedCollection) this.$toast.success('Book added to collection') diff --git a/client/components/modals/edit-tabs/Authors.vue b/client/components/modals/edit-tabs/Authors.vue index 3dafa049..449f9610 100644 --- a/client/components/modals/edit-tabs/Authors.vue +++ b/client/components/modals/edit-tabs/Authors.vue @@ -154,7 +154,7 @@ export default { var coverPayload = { url: updatePayload.cover } - var success = await this.$axios.$post(`/api/audiobook/${this.audiobook.id}/cover`, coverPayload).catch((error) => { + var success = await this.$axios.$post(`/api/books/${this.audiobook.id}/cover`, coverPayload).catch((error) => { console.error('Failed to update', error) return false }) @@ -171,7 +171,7 @@ export default { var bookUpdatePayload = { book: updatePayload } - var success = await this.$axios.$patch(`/api/audiobook/${this.audiobook.id}`, bookUpdatePayload).catch((error) => { + var success = await this.$axios.$patch(`/api/books/${this.audiobook.id}`, bookUpdatePayload).catch((error) => { console.error('Failed to update', error) return false }) diff --git a/client/components/modals/edit-tabs/Cover.vue b/client/components/modals/edit-tabs/Cover.vue index cc0ceb9a..8ee2b1f0 100644 --- a/client/components/modals/edit-tabs/Cover.vue +++ b/client/components/modals/edit-tabs/Cover.vue @@ -155,7 +155,7 @@ export default { form.set('cover', this.selectedFile) this.$axios - .$post(`/api/audiobook/${this.audiobook.id}/cover`, form) + .$post(`/api/books/${this.audiobook.id}/cover`, form) .then((data) => { if (data.error) { this.$toast.error(data.error) @@ -217,7 +217,7 @@ export default { // Download cover from url and use if (cover.startsWith('http:') || cover.startsWith('https:')) { - success = await this.$axios.$post(`/api/audiobook/${this.audiobook.id}/cover`, { url: cover }).catch((error) => { + success = await this.$axios.$post(`/api/books/${this.audiobook.id}/cover`, { url: cover }).catch((error) => { console.error('Failed to download cover from url', error) if (error.response && error.response.data) { this.$toast.error(error.response.data) @@ -231,7 +231,7 @@ export default { cover: cover } } - success = await this.$axios.$patch(`/api/audiobook/${this.audiobook.id}`, updatePayload).catch((error) => { + success = await this.$axios.$patch(`/api/books/${this.audiobook.id}`, updatePayload).catch((error) => { console.error('Failed to update', error) if (error.response && error.response.data) { this.$toast.error(error.response.data) @@ -266,7 +266,7 @@ export default { setCover(coverFile) { this.isProcessing = true this.$axios - .$patch(`/api/audiobook/${this.audiobook.id}/coverfile`, coverFile) + .$patch(`/api/books/${this.audiobook.id}/coverfile`, coverFile) .then((data) => { console.log('response data', data) if (data && typeof data === 'string') { diff --git a/client/components/modals/edit-tabs/Details.vue b/client/components/modals/edit-tabs/Details.vue index c893d0db..cdd912c5 100644 --- a/client/components/modals/edit-tabs/Details.vue +++ b/client/components/modals/edit-tabs/Details.vue @@ -195,7 +195,7 @@ export default { tags: this.newTags } - var updatedAudiobook = await this.$axios.$patch(`/api/audiobook/${this.audiobook.id}`, updatePayload).catch((error) => { + var updatedAudiobook = await this.$axios.$patch(`/api/books/${this.audiobook.id}`, updatePayload).catch((error) => { console.error('Failed to update', error) return false }) @@ -220,27 +220,11 @@ export default { this.newTags = this.audiobook.tags || [] }, - resetProgress() { - if (confirm(`Are you sure you want to reset your progress?`)) { - this.resettingProgress = true - this.$axios - .$delete(`/api/user/audiobook/${this.audiobookId}`) - .then(() => { - console.log('Progress reset complete') - this.$toast.success(`Your progress was reset`) - this.resettingProgress = false - }) - .catch((error) => { - console.error('Progress reset failed', error) - this.resettingProgress = false - }) - } - }, deleteAudiobook() { if (confirm(`Are you sure you want to remove this audiobook?\n\n*Does not delete your files, only removes the audiobook from AudioBookshelf`)) { this.isProcessing = true this.$axios - .$delete(`/api/audiobook/${this.audiobookId}`) + .$delete(`/api/books/${this.audiobookId}`) .then(() => { console.log('Audiobook removed') this.$toast.success('Audiobook Removed') diff --git a/client/components/modals/edit-tabs/Match.vue b/client/components/modals/edit-tabs/Match.vue index 0cb932a2..63d479ba 100644 --- a/client/components/modals/edit-tabs/Match.vue +++ b/client/components/modals/edit-tabs/Match.vue @@ -133,7 +133,7 @@ export default { publisher: true, publishYear: true, series: true, - volumeNumber: true, + volumeNumber: true } } }, @@ -198,7 +198,7 @@ export default { publisher: true, publishYear: true, series: true, - volumeNumber: true, + volumeNumber: true } if (this.audiobook.id !== this.audiobookId) { @@ -238,7 +238,7 @@ export default { var coverPayload = { url: updatePayload.cover } - var success = await this.$axios.$post(`/api/audiobook/${this.audiobook.id}/cover`, coverPayload).catch((error) => { + var success = await this.$axios.$post(`/api/books/${this.audiobook.id}/cover`, coverPayload).catch((error) => { console.error('Failed to update', error) return false }) @@ -255,7 +255,7 @@ export default { var bookUpdatePayload = { book: updatePayload } - var success = await this.$axios.$patch(`/api/audiobook/${this.audiobook.id}`, bookUpdatePayload).catch((error) => { + var success = await this.$axios.$patch(`/api/books/${this.audiobook.id}`, bookUpdatePayload).catch((error) => { console.error('Failed to update', error) return false }) diff --git a/client/components/modals/libraries/EditLibrary.vue b/client/components/modals/libraries/EditLibrary.vue index 1e0ee653..cad3be6a 100644 --- a/client/components/modals/libraries/EditLibrary.vue +++ b/client/components/modals/libraries/EditLibrary.vue @@ -105,7 +105,7 @@ export default { this.$emit('update:processing', true) this.$axios - .$patch(`/api/library/${this.library.id}`, newLibraryPayload) + .$patch(`/api/libraries/${this.library.id}`, newLibraryPayload) .then((res) => { this.$emit('update:processing', false) this.$emit('close') @@ -137,7 +137,7 @@ export default { this.$emit('update:processing', true) this.$axios - .$post('/api/library', newLibraryPayload) + .$post('/api/libraries', newLibraryPayload) .then((res) => { this.$emit('update:processing', false) this.$emit('close') diff --git a/client/components/modals/libraries/LibraryItem.vue b/client/components/modals/libraries/LibraryItem.vue index 2933474e..a6fa5118 100644 --- a/client/components/modals/libraries/LibraryItem.vue +++ b/client/components/modals/libraries/LibraryItem.vue @@ -72,7 +72,7 @@ export default { if (confirm(`Are you sure you want to permanently delete library "${this.library.name}"?`)) { this.isDeleting = true this.$axios - .$delete(`/api/library/${this.library.id}`) + .$delete(`/api/libraries/${this.library.id}`) .then((data) => { this.isDeleting = false if (data.error) { diff --git a/client/components/tables/CollectionBooksTable.vue b/client/components/tables/CollectionBooksTable.vue index f36fbc8f..7ae38375 100644 --- a/client/components/tables/CollectionBooksTable.vue +++ b/client/components/tables/CollectionBooksTable.vue @@ -68,7 +68,7 @@ export default { books: this.booksCopy.map((b) => b.id) } this.$axios - .$patch(`/api/collection/${this.collectionId}`, collectionUpdate) + .$patch(`/api/collections/${this.collectionId}`, collectionUpdate) .then((collection) => { console.log('Collection updated', collection) }) diff --git a/client/components/tables/UsersTable.vue b/client/components/tables/UsersTable.vue index 575aab0f..91ab3c23 100644 --- a/client/components/tables/UsersTable.vue +++ b/client/components/tables/UsersTable.vue @@ -101,7 +101,7 @@ export default { if (confirm(`Are you sure you want to permanently delete user "${user.username}"?`)) { this.isDeletingUser = true this.$axios - .$delete(`/api/user/${user.id}`) + .$delete(`/api/users/${user.id}`) .then((data) => { this.isDeletingUser = false if (data.error) { diff --git a/client/components/tables/collection/BookTableRow.vue b/client/components/tables/collection/BookTableRow.vue index 7ce31da4..f607e6e0 100644 --- a/client/components/tables/collection/BookTableRow.vue +++ b/client/components/tables/collection/BookTableRow.vue @@ -140,7 +140,7 @@ export default { } this.isProcessingReadUpdate = true this.$axios - .$patch(`/api/user/audiobook/${this.book.id}`, updatePayload) + .$patch(`/api/me/audiobook/${this.book.id}`, updatePayload) .then(() => { this.isProcessingReadUpdate = false this.$toast.success(`"${this.bookTitle}" Marked as ${updatePayload.isRead ? 'Read' : 'Not Read'}`) @@ -155,7 +155,7 @@ export default { this.processingRemove = true this.$axios - .$delete(`/api/collection/${this.collectionId}/book/${this.book.id}`) + .$delete(`/api/collections/${this.collectionId}/book/${this.book.id}`) .then((updatedCollection) => { console.log(`Book removed from collection`, updatedCollection) this.$toast.success('Book removed from collection') diff --git a/client/package.json b/client/package.json index ea6100ba..ab48a468 100644 --- a/client/package.json +++ b/client/package.json @@ -1,6 +1,6 @@ { "name": "audiobookshelf-client", - "version": "1.6.23", + "version": "1.6.26", "description": "Audiobook manager and player", "main": "index.js", "scripts": { diff --git a/client/pages/account.vue b/client/pages/account.vue index 011aa22b..d6640242 100644 --- a/client/pages/account.vue +++ b/client/pages/account.vue @@ -90,7 +90,7 @@ export default { } this.changingPassword = true this.$axios - .$patch('/api/user/password', { + .$patch('/api/me/password', { password: this.password, newPassword: this.newPassword }) diff --git a/client/pages/audiobook/_id/edit.vue b/client/pages/audiobook/_id/edit.vue index d2bf15db..7d4ae2fb 100644 --- a/client/pages/audiobook/_id/edit.vue +++ b/client/pages/audiobook/_id/edit.vue @@ -115,7 +115,7 @@ export default { if (!store.getters['user/getUserCanUpdate']) { return redirect('/?error=unauthorized') } - var audiobook = await app.$axios.$get(`/api/audiobook/${params.id}`).catch((error) => { + var audiobook = await app.$axios.$get(`/api/books/${params.id}`).catch((error) => { console.error('Failed', error) return false }) @@ -291,7 +291,7 @@ export default { this.saving = true this.$axios - .$patch(`/api/audiobook/${this.audiobook.id}/tracks`, { orderedFileData }) + .$patch(`/api/books/${this.audiobook.id}/tracks`, { orderedFileData }) .then((data) => { console.log('Finished patching files', data) this.saving = false diff --git a/client/pages/audiobook/_id/index.vue b/client/pages/audiobook/_id/index.vue index 56926f87..3752e7b0 100644 --- a/client/pages/audiobook/_id/index.vue +++ b/client/pages/audiobook/_id/index.vue @@ -161,7 +161,7 @@ export default { if (!store.state.user.user) { return redirect(`/login?redirect=${route.path}`) } - var audiobook = await app.$axios.$get(`/api/audiobook/${params.id}`).catch((error) => { + var audiobook = await app.$axios.$get(`/api/books/${params.id}`).catch((error) => { console.error('Failed', error) return false }) @@ -383,7 +383,7 @@ export default { } this.isProcessingReadUpdate = true this.$axios - .$patch(`/api/user/audiobook/${this.audiobookId}`, updatePayload) + .$patch(`/api/me/audiobook/${this.audiobookId}`, updatePayload) .then(() => { this.isProcessingReadUpdate = false this.$toast.success(`"${this.title}" Marked as ${updatePayload.isRead ? 'Read' : 'Not Read'}`) @@ -417,7 +417,7 @@ export default { audiobookUpdated() { console.log('Audiobook Updated - Fetch full audiobook') this.$axios - .$get(`/api/audiobook/${this.audiobookId}`) + .$get(`/api/books/${this.audiobookId}`) .then((audiobook) => { console.log('Updated audiobook', audiobook) this.audiobook = audiobook @@ -430,7 +430,7 @@ export default { if (confirm(`Are you sure you want to reset your progress?`)) { this.resettingProgress = true this.$axios - .$patch(`/api/user/audiobook/${this.audiobookId}/reset-progress`) + .$patch(`/api/me/audiobook/${this.audiobookId}/reset-progress`) .then(() => { console.log('Progress reset complete') this.$toast.success(`Your progress was reset`) diff --git a/client/pages/batch/index.vue b/client/pages/batch/index.vue index 8a891e32..a9c53dfc 100644 --- a/client/pages/batch/index.vue +++ b/client/pages/batch/index.vue @@ -169,7 +169,7 @@ export default { this.isProcessing = true this.$axios - .$post('/api/audiobooks/update', this.audiobookCopies) + .$post('/api/books/batch/update', this.audiobookCopies) .then((data) => { this.isProcessing = false if (data.updates) { diff --git a/client/pages/collection/_id.vue b/client/pages/collection/_id.vue index 5d447918..2f313450 100644 --- a/client/pages/collection/_id.vue +++ b/client/pages/collection/_id.vue @@ -44,7 +44,7 @@ export default { if (!store.state.user.user) { return redirect(`/login?redirect=${route.path}`) } - var collection = await app.$axios.$get(`/api/collection/${params.id}`).catch((error) => { + var collection = await app.$axios.$get(`/api/collections/${params.id}`).catch((error) => { console.error('Failed', error) return false }) @@ -105,7 +105,7 @@ export default { this.processingRemove = true var collectionName = this.collectionName this.$axios - .$delete(`/api/collection/${this.collection.id}`) + .$delete(`/api/collections/${this.collection.id}`) .then(() => { this.processingRemove = false this.$toast.success(`Collection "${collectionName}" Removed`) diff --git a/client/pages/config/index.vue b/client/pages/config/index.vue index 08bbcb5d..9b0ff432 100644 --- a/client/pages/config/index.vue +++ b/client/pages/config/index.vue @@ -150,7 +150,7 @@ export default { if (confirm('WARNING! This action will remove all audiobooks from the database including any updates or matches you have made. This does not do anything to your actual files. Shall we continue?')) { this.isResettingAudiobooks = true this.$axios - .$delete('/api/audiobooks') + .$delete('/api/books/all') .then(() => { this.isResettingAudiobooks = false this.$toast.success('Successfully reset audiobooks') diff --git a/client/pages/config/stats.vue b/client/pages/config/stats.vue index bf0f5d19..50a3f8fe 100644 --- a/client/pages/config/stats.vue +++ b/client/pages/config/stats.vue @@ -97,7 +97,7 @@ export default { }, methods: { async init() { - this.listeningStats = await this.$axios.$get(`/api/user/${this.user.id}/listeningStats`).catch((err) => { + this.listeningStats = await this.$axios.$get(`/api/me/listening-stats`).catch((err) => { console.error('Failed to load listening sesions', err) return [] }) diff --git a/client/pages/config/users/_id.vue b/client/pages/config/users/_id.vue index b7ad421d..e9e052ba 100644 --- a/client/pages/config/users/_id.vue +++ b/client/pages/config/users/_id.vue @@ -71,7 +71,7 @@