mirror of
https://github.com/advplyr/audiobookshelf-app.git
synced 2026-08-29 22:57:16 +02:00
Add explicit library filters
This commit is contained in:
@@ -54,8 +54,39 @@ export default {
|
|||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
sublist: null,
|
sublist: null
|
||||||
bookItems: [
|
}
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
show(newVal) {
|
||||||
|
if (!newVal) {
|
||||||
|
if (this.sublist && !this.selectedItemSublist) this.sublist = null
|
||||||
|
if (!this.sublist && this.selectedItemSublist) this.sublist = this.selectedItemSublist
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
show: {
|
||||||
|
get() {
|
||||||
|
return this.value
|
||||||
|
},
|
||||||
|
set(val) {
|
||||||
|
this.$emit('input', val)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
selected: {
|
||||||
|
get() {
|
||||||
|
return this.filterBy
|
||||||
|
},
|
||||||
|
set(val) {
|
||||||
|
this.$emit('update:filterBy', val)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
userCanAccessExplicitContent() {
|
||||||
|
return this.$store.getters['user/getUserCanAccessExplicitContent']
|
||||||
|
},
|
||||||
|
bookItems() {
|
||||||
|
const items = [
|
||||||
{
|
{
|
||||||
text: this.$strings.LabelAll,
|
text: this.$strings.LabelAll,
|
||||||
value: 'all'
|
value: 'all'
|
||||||
@@ -110,8 +141,20 @@ export default {
|
|||||||
value: 'feed-open',
|
value: 'feed-open',
|
||||||
sublist: false
|
sublist: false
|
||||||
}
|
}
|
||||||
],
|
]
|
||||||
podcastItems: [
|
|
||||||
|
if (this.userCanAccessExplicitContent) {
|
||||||
|
items.push({
|
||||||
|
text: this.$strings.LabelExplicit,
|
||||||
|
value: 'explicit',
|
||||||
|
sublist: false
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
return items
|
||||||
|
},
|
||||||
|
podcastItems() {
|
||||||
|
const items = [
|
||||||
{
|
{
|
||||||
text: this.$strings.LabelAll,
|
text: this.$strings.LabelAll,
|
||||||
value: 'all'
|
value: 'all'
|
||||||
@@ -132,32 +175,16 @@ export default {
|
|||||||
sublist: false
|
sublist: false
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
|
||||||
},
|
if (this.userCanAccessExplicitContent) {
|
||||||
watch: {
|
items.push({
|
||||||
show(newVal) {
|
text: this.$strings.LabelExplicit,
|
||||||
if (!newVal) {
|
value: 'explicit',
|
||||||
if (this.sublist && !this.selectedItemSublist) this.sublist = null
|
sublist: false
|
||||||
if (!this.sublist && this.selectedItemSublist) this.sublist = this.selectedItemSublist
|
})
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
computed: {
|
|
||||||
show: {
|
|
||||||
get() {
|
|
||||||
return this.value
|
|
||||||
},
|
|
||||||
set(val) {
|
|
||||||
this.$emit('input', val)
|
|
||||||
}
|
|
||||||
},
|
|
||||||
selected: {
|
|
||||||
get() {
|
|
||||||
return this.filterBy
|
|
||||||
},
|
|
||||||
set(val) {
|
|
||||||
this.$emit('update:filterBy', val)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return items
|
||||||
},
|
},
|
||||||
isPodcast() {
|
isPodcast() {
|
||||||
return this.$store.getters['libraries/getCurrentLibraryMediaType'] === 'podcast'
|
return this.$store.getters['libraries/getCurrentLibraryMediaType'] === 'podcast'
|
||||||
|
|||||||
+16
-11
@@ -31,16 +31,18 @@ export const getters = {
|
|||||||
getCustomHeaders: (state) => {
|
getCustomHeaders: (state) => {
|
||||||
return state.serverConnectionConfig?.customHeaders || null
|
return state.serverConnectionConfig?.customHeaders || null
|
||||||
},
|
},
|
||||||
getUserMediaProgress: (state) => (libraryItemId, episodeId = null) => {
|
getUserMediaProgress:
|
||||||
if (!state.user?.mediaProgress) return null
|
(state) =>
|
||||||
return state.user.mediaProgress.find(li => {
|
(libraryItemId, episodeId = null) => {
|
||||||
if (episodeId && li.episodeId !== episodeId) return false
|
if (!state.user?.mediaProgress) return null
|
||||||
return li.libraryItemId == libraryItemId
|
return state.user.mediaProgress.find((li) => {
|
||||||
})
|
if (episodeId && li.episodeId !== episodeId) return false
|
||||||
},
|
return li.libraryItemId == libraryItemId
|
||||||
|
})
|
||||||
|
},
|
||||||
getUserBookmarksForItem: (state) => (libraryItemId) => {
|
getUserBookmarksForItem: (state) => (libraryItemId) => {
|
||||||
if (!state?.user?.bookmarks) return []
|
if (!state?.user?.bookmarks) return []
|
||||||
return state.user.bookmarks.filter(bm => bm.libraryItemId === libraryItemId)
|
return state.user.bookmarks.filter((bm) => bm.libraryItemId === libraryItemId)
|
||||||
},
|
},
|
||||||
getUserSetting: (state) => (key) => {
|
getUserSetting: (state) => (key) => {
|
||||||
return state.settings?.[key] || null
|
return state.settings?.[key] || null
|
||||||
@@ -53,6 +55,9 @@ export const getters = {
|
|||||||
},
|
},
|
||||||
getUserCanDownload: (state) => {
|
getUserCanDownload: (state) => {
|
||||||
return !!state.user?.permissions?.download
|
return !!state.user?.permissions?.download
|
||||||
|
},
|
||||||
|
getUserCanAccessExplicitContent: (state) => {
|
||||||
|
return !!state.user?.permissions?.accessExplicitContent
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -145,11 +150,11 @@ export const mutations = {
|
|||||||
},
|
},
|
||||||
removeMediaProgress(state, id) {
|
removeMediaProgress(state, id) {
|
||||||
if (!state.user) return
|
if (!state.user) return
|
||||||
state.user.mediaProgress = state.user.mediaProgress.filter(mp => mp.id != id)
|
state.user.mediaProgress = state.user.mediaProgress.filter((mp) => mp.id != id)
|
||||||
},
|
},
|
||||||
updateUserMediaProgress(state, data) {
|
updateUserMediaProgress(state, data) {
|
||||||
if (!data || !state.user) return
|
if (!data || !state.user) return
|
||||||
const mediaProgressIndex = state.user.mediaProgress.findIndex(mp => mp.id === data.id)
|
const mediaProgressIndex = state.user.mediaProgress.findIndex((mp) => mp.id === data.id)
|
||||||
if (mediaProgressIndex >= 0) {
|
if (mediaProgressIndex >= 0) {
|
||||||
state.user.mediaProgress.splice(mediaProgressIndex, 1, data)
|
state.user.mediaProgress.splice(mediaProgressIndex, 1, data)
|
||||||
} else {
|
} else {
|
||||||
@@ -174,7 +179,7 @@ export const mutations = {
|
|||||||
},
|
},
|
||||||
deleteBookmark(state, { libraryItemId, time }) {
|
deleteBookmark(state, { libraryItemId, time }) {
|
||||||
if (!state.user?.bookmarks) return
|
if (!state.user?.bookmarks) return
|
||||||
state.user.bookmarks = state.user.bookmarks.filter(bm => {
|
state.user.bookmarks = state.user.bookmarks.filter((bm) => {
|
||||||
if (bm.libraryItemId === libraryItemId && bm.time === time) return false
|
if (bm.libraryItemId === libraryItemId && bm.time === time) return false
|
||||||
return true
|
return true
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -146,6 +146,7 @@
|
|||||||
"LabelEndOfChapter": "End of Chapter",
|
"LabelEndOfChapter": "End of Chapter",
|
||||||
"LabelEndTime": "End time",
|
"LabelEndTime": "End time",
|
||||||
"LabelEpisode": "Episode",
|
"LabelEpisode": "Episode",
|
||||||
|
"LabelExplicit": "Explicit",
|
||||||
"LabelFeedURL": "Feed URL",
|
"LabelFeedURL": "Feed URL",
|
||||||
"LabelFile": "File",
|
"LabelFile": "File",
|
||||||
"LabelFileBirthtime": "File Birthtime",
|
"LabelFileBirthtime": "File Birthtime",
|
||||||
|
|||||||
Reference in New Issue
Block a user