Add rescan feature

This commit is contained in:
Tiberiu Ichim 2026-02-06 14:25:20 +02:00
parent d358b82b17
commit e433cf9c05
4 changed files with 55 additions and 11 deletions

View file

@ -566,7 +566,7 @@ export default {
text: this.$strings.HeaderMatch
})
}
if (this.userIsAdminOrUp && !this.isFile) {
if ((this.userIsAdminOrUp || this.userCanDelete) && !this.isFile) {
items.push({
func: 'rescan',
text: this.$strings.ButtonReScan

View file

@ -424,6 +424,10 @@ export default {
}
if (this.userCanDelete) {
items.push({
text: this.$strings.ButtonReScan,
action: 'rescan'
})
items.push({
text: this.$strings.ButtonMoveToLibrary,
action: 'move'
@ -760,6 +764,28 @@ export default {
}
this.$store.commit('globals/setConfirmPrompt', payload)
},
rescan() {
this.processing = true
this.$axios
.$post(`/api/items/${this.libraryItemId}/scan`)
.then((data) => {
var result = data.result
if (!result) {
this.$toast.error(this.$getString('ToastRescanFailed', [this.title]))
} else if (result === 'UPDATED') {
this.$toast.success(this.$strings.ToastRescanUpdated)
} else if (result === 'UPTODATE') {
this.$toast.success(this.$strings.ToastRescanUpToDate)
}
})
.catch((error) => {
console.error('Failed to rescan', error)
this.$toast.error(this.$getString('ToastRescanFailed', [this.title]))
})
.finally(() => {
this.processing = false
})
},
contextMenuAction({ action, data }) {
if (action === 'collections') {
this.$store.commit('setSelectedLibraryItem', this.libraryItem)
@ -775,6 +801,8 @@ export default {
this.downloadLibraryItem()
} else if (action === 'delete') {
this.deleteLibraryItem()
} else if (action === 'rescan') {
this.rescan()
} else if (action === 'move') {
this.$store.commit('setSelectedLibraryItem', this.libraryItem)
this.$store.commit('globals/setShowMoveToLibraryModal', true)