mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-12-15 16:29:37 +00:00
parent
4021b6eca1
commit
308ccf470f
5 changed files with 211 additions and 9 deletions
|
|
@ -19,6 +19,11 @@
|
|||
{{ streaming ? $strings.ButtonPlaying : $strings.ButtonPlay }}
|
||||
</ui-btn>
|
||||
|
||||
<!-- RSS feed -->
|
||||
<ui-tooltip v-if="rssFeed" :text="$strings.LabelOpenRSSFeed" direction="top">
|
||||
<ui-icon-btn icon="rss_feed" class="mx-0.5" :bg-color="rssFeed ? 'success' : 'primary'" outlined @click="clickRSSFeed" />
|
||||
</ui-tooltip>
|
||||
|
||||
<button type="button" class="h-9 w-9 flex items-center justify-center shadow-sm pl-3 pr-3 text-left focus:outline-none cursor-pointer text-gray-100 hover:text-gray-200 rounded-full hover:bg-white/5 mx-px" @click.stop.prevent="editClick">
|
||||
<span class="material-icons text-xl">edit</span>
|
||||
</button>
|
||||
|
|
@ -37,6 +42,8 @@
|
|||
<div v-show="processing" class="absolute top-0 left-0 w-full h-full z-10 bg-black bg-opacity-40 flex items-center justify-center">
|
||||
<ui-loading-indicator />
|
||||
</div>
|
||||
|
||||
<modals-rssfeed-collection-modal v-model="showRssFeedModal" :collection="collection" :feed="rssFeed" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
|
@ -46,7 +53,7 @@ export default {
|
|||
if (!store.state.user.user) {
|
||||
return redirect(`/login?redirect=${route.path}`)
|
||||
}
|
||||
var collection = await app.$axios.$get(`/api/collections/${params.id}`).catch((error) => {
|
||||
const collection = await app.$axios.$get(`/api/collections/${params.id}?include=rssfeed`).catch((error) => {
|
||||
console.error('Failed', error)
|
||||
return false
|
||||
})
|
||||
|
|
@ -61,12 +68,14 @@ export default {
|
|||
|
||||
store.commit('libraries/addUpdateCollection', collection)
|
||||
return {
|
||||
collectionId: collection.id
|
||||
collectionId: collection.id,
|
||||
rssFeed: collection.rssFeed || null
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
processing: false
|
||||
processing: false,
|
||||
showRssFeedModal: false
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
|
|
@ -99,6 +108,9 @@ export default {
|
|||
showPlayButton() {
|
||||
return this.playableBooks.length
|
||||
},
|
||||
userIsAdminOrUp() {
|
||||
return this.$store.getters['user/getIsAdminOrUp']
|
||||
},
|
||||
userCanUpdate() {
|
||||
return this.$store.getters['user/getUserCanUpdate']
|
||||
},
|
||||
|
|
@ -112,6 +124,12 @@ export default {
|
|||
action: 'create-playlist'
|
||||
}
|
||||
]
|
||||
if (this.userIsAdminOrUp) {
|
||||
items.push({
|
||||
text: this.$strings.LabelOpenRSSFeed,
|
||||
action: 'open-rss-feed'
|
||||
})
|
||||
}
|
||||
if (this.userCanDelete) {
|
||||
items.push({
|
||||
text: this.$strings.ButtonDelete,
|
||||
|
|
@ -122,11 +140,16 @@ export default {
|
|||
}
|
||||
},
|
||||
methods: {
|
||||
clickRSSFeed() {
|
||||
this.showRssFeedModal = true
|
||||
},
|
||||
contextMenuAction(action) {
|
||||
if (action === 'delete') {
|
||||
this.removeClick()
|
||||
} else if (action === 'create-playlist') {
|
||||
this.createPlaylistFromCollection()
|
||||
} else if (action === 'open-rss-feed') {
|
||||
this.showRssFeedModal = true
|
||||
}
|
||||
},
|
||||
createPlaylistFromCollection() {
|
||||
|
|
@ -206,9 +229,27 @@ export default {
|
|||
queueItems
|
||||
})
|
||||
}
|
||||
},
|
||||
rssFeedOpen(data) {
|
||||
if (data.entityId === this.collectionId) {
|
||||
console.log('RSS Feed Opened', data)
|
||||
this.rssFeed = data
|
||||
}
|
||||
},
|
||||
rssFeedClosed(data) {
|
||||
if (data.entityId === this.collectionId) {
|
||||
console.log('RSS Feed Closed', data)
|
||||
this.rssFeed = null
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted() {},
|
||||
beforeDestroy() {}
|
||||
mounted() {
|
||||
this.$root.socket.on('rss_feed_open', this.rssFeedOpen)
|
||||
this.$root.socket.on('rss_feed_closed', this.rssFeedClosed)
|
||||
},
|
||||
beforeDestroy() {
|
||||
this.$root.socket.off('rss_feed_open', this.rssFeedOpen)
|
||||
this.$root.socket.off('rss_feed_closed', this.rssFeedClosed)
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue