Add:Enable e-reader server setting to allow all users to access experimental e-reader #614

This commit is contained in:
advplyr 2022-05-20 16:34:51 -05:00
parent 302870a101
commit 796602d1b2
12 changed files with 44 additions and 45 deletions

View File

@ -153,9 +153,6 @@ export default {
}, },
currentChapterName() { currentChapterName() {
return this.currentChapter ? this.currentChapter.title : '' return this.currentChapter ? this.currentChapter.title : ''
},
showExperimentalFeatures() {
return this.$store.state.showExperimentalFeatures
} }
}, },
methods: { methods: {

View File

@ -89,9 +89,6 @@ export default {
offsetTop() { offsetTop() {
return 64 return 64
}, },
showExperimentalFeatures() {
return this.$store.state.showExperimentalFeatures
},
userIsAdminOrUp() { userIsAdminOrUp() {
return this.$store.getters['user/getIsAdminOrUp'] return this.$store.getters['user/getIsAdminOrUp']
}, },

View File

@ -74,9 +74,6 @@ export default {
} }
}, },
computed: { computed: {
showExperimentalFeatures() {
return this.$store.state.showExperimentalFeatures
},
coverAspectRatio() { coverAspectRatio() {
return this.$store.getters['getServerSetting']('coverAspectRatio') return this.$store.getters['getServerSetting']('coverAspectRatio')
}, },

View File

@ -109,19 +109,14 @@ export default {
hasValidCovers() { hasValidCovers() {
var validCovers = this.bookItems.map((bookItem) => bookItem.media.coverPath) var validCovers = this.bookItems.map((bookItem) => bookItem.media.coverPath)
return !!validCovers.length return !!validCovers.length
},
showExperimentalFeatures() {
return this.$store.state.showExperimentalFeatures
} }
}, },
methods: { methods: {
mouseoverCard() { mouseoverCard() {
this.isHovering = true this.isHovering = true
// if (this.$refs.groupcover) this.$refs.groupcover.setHover(true)
}, },
mouseleaveCard() { mouseleaveCard() {
this.isHovering = false this.isHovering = false
// if (this.$refs.groupcover) this.$refs.groupcover.setHover(false)
}, },
clickCard() { clickCard() {
this.$emit('click', this.group) this.$emit('click', this.group)

View File

@ -147,6 +147,9 @@ export default {
showExperimentalFeatures() { showExperimentalFeatures() {
return this.store.state.showExperimentalFeatures return this.store.state.showExperimentalFeatures
}, },
enableEReader() {
return this.store.getters['getServerSetting']('enableEReader')
},
_libraryItem() { _libraryItem() {
return this.libraryItem || {} return this.libraryItem || {}
}, },
@ -287,13 +290,13 @@ export default {
return this.store.getters['getlibraryItemIdStreaming'] === this.libraryItemId return this.store.getters['getlibraryItemIdStreaming'] === this.libraryItemId
}, },
showReadButton() { showReadButton() {
return !this.isSelectionMode && this.showExperimentalFeatures && !this.showPlayButton && this.hasEbook return !this.isSelectionMode && !this.showPlayButton && this.hasEbook && (this.showExperimentalFeatures || this.enableEReader)
}, },
showPlayButton() { showPlayButton() {
return !this.isSelectionMode && !this.isMissing && !this.isInvalid && !this.isStreaming && (this.numTracks || this.recentEpisode) return !this.isSelectionMode && !this.isMissing && !this.isInvalid && !this.isStreaming && (this.numTracks || this.recentEpisode)
}, },
showSmallEBookIcon() { showSmallEBookIcon() {
return !this.isSelectionMode && this.showExperimentalFeatures && this.hasEbook return !this.isSelectionMode && this.hasEbook && (this.showExperimentalFeatures || this.enableEReader)
}, },
isMissing() { isMissing() {
return this._libraryItem.isMissing return this._libraryItem.isMissing

View File

@ -59,9 +59,6 @@ export default {
if (this.bookCoverAspectRatio === 1) return this.width / (120 * 1.6 * 2) if (this.bookCoverAspectRatio === 1) return this.width / (120 * 1.6 * 2)
return this.width / 240 return this.width / 240
}, },
showExperimentalFeatures() {
return this.store.state.showExperimentalFeatures
},
store() { store() {
return this.$store || this.$nuxt.$store return this.$store || this.$nuxt.$store
}, },

View File

@ -64,8 +64,7 @@ export default {
{ {
id: 'manage', id: 'manage',
title: 'Manage', title: 'Manage',
component: 'modals-item-tabs-manage', component: 'modals-item-tabs-manage'
experimental: true
} }
] ]
} }

View File

@ -126,9 +126,6 @@ export default {
} }
}, },
computed: { computed: {
showExperimentalFeatures() {
return this.$store.state.showExperimentalFeatures
},
media() { media() {
return this.libraryItem.media || {} return this.libraryItem.media || {}
}, },

View File

@ -122,6 +122,20 @@
</p> </p>
</ui-tooltip> </ui-tooltip>
</div> </div>
<div class="flex items-center mb-2 mt-8">
<h1 class="text-xl">Experimental Feature Settings</h1>
</div>
<div class="flex items-center py-2">
<ui-toggle-switch v-model="newServerSettings.enableEReader" :disabled="updatingServerSettings" @input="(val) => updateSettingsKey('enableEReader', val)" />
<ui-tooltip :text="tooltips.enableEReader">
<p class="pl-4 text-lg">
Enable e-reader for all users
<span class="material-icons icon-text">info_outlined</span>
</p>
</ui-tooltip>
</div>
</div> </div>
<div class="h-0.5 bg-primary bg-opacity-30 w-full" /> <div class="h-0.5 bg-primary bg-opacity-30 w-full" />
@ -172,7 +186,9 @@
<ui-tooltip :text="experimentalFeaturesTooltip"> <ui-tooltip :text="experimentalFeaturesTooltip">
<p class="pl-4 text-lg"> <p class="pl-4 text-lg">
Experimental Features Experimental Features
<span class="material-icons icon-text">info_outlined</span> <a href="https://github.com/advplyr/audiobookshelf/discussions/75" target="_blank">
<span class="material-icons icon-text">info_outlined</span>
</a>
</p> </p>
</ui-tooltip> </ui-tooltip>
</div> </div>
@ -207,6 +223,7 @@ export default {
isPurgingCache: false, isPurgingCache: false,
newServerSettings: {}, newServerSettings: {},
tooltips: { tooltips: {
experimentalFeatures: 'Features in development that could use your feedback and help testing. Click to open github discussion.',
scannerDisableWatcher: 'Disables the automatic adding/updating of items when file changes are detected. *Requires server restart', scannerDisableWatcher: 'Disables the automatic adding/updating of items when file changes are detected. *Requires server restart',
scannerPreferOpfMetadata: 'OPF file metadata will be used for book details over folder names', scannerPreferOpfMetadata: 'OPF file metadata will be used for book details over folder names',
scannerPreferAudioMetadata: 'Audio file ID3 meta tags will be used for book details over folder names', scannerPreferAudioMetadata: 'Audio file ID3 meta tags will be used for book details over folder names',
@ -216,7 +233,8 @@ export default {
bookshelfView: 'Alternative view without wooden bookshelf', bookshelfView: 'Alternative view without wooden bookshelf',
storeCoverWithItem: 'By default covers are stored in /metadata/items, enabling this setting will store covers in your library item folder. Only one file named "cover" will be kept', storeCoverWithItem: 'By default covers are stored in /metadata/items, enabling this setting will store covers in your library item folder. Only one file named "cover" will be kept',
storeMetadataWithItem: 'By default metadata files are stored in /metadata/items, enabling this setting will store metadata files in your library item folders. Uses .abs file extension', storeMetadataWithItem: 'By default metadata files are stored in /metadata/items, enabling this setting will store metadata files in your library item folders. Uses .abs file extension',
coverAspectRatio: 'Prefer to use square covers over standard 1.6:1 book covers' coverAspectRatio: 'Prefer to use square covers over standard 1.6:1 book covers',
enableEReader: 'E-reader is still a work in progress, but use this setting to open it up to all your users (or use the "Experimental Features" toggle below just for you)'
}, },
showConfirmPurgeCache: false showConfirmPurgeCache: false
} }
@ -229,9 +247,6 @@ export default {
} }
}, },
computed: { computed: {
experimentalFeaturesTooltip() {
return 'Features in development that could use your feedback and help testing.'
},
serverSettings() { serverSettings() {
return this.$store.state.serverSettings return this.$store.state.serverSettings
}, },

View File

@ -104,9 +104,6 @@ export default {
bookCoverAspectRatio() { bookCoverAspectRatio() {
return this.coverAspectRatio === this.$constants.BookCoverAspectRatio.SQUARE ? 1 : 1.6 return this.coverAspectRatio === this.$constants.BookCoverAspectRatio.SQUARE ? 1 : 1.6
}, },
showExperimentalFeatures() {
return this.$store.state.showExperimentalFeatures
},
username() { username() {
return this.user.username return this.user.username
}, },

View File

@ -135,7 +135,7 @@
{{ isMissing ? 'Missing' : 'Incomplete' }} {{ isMissing ? 'Missing' : 'Incomplete' }}
</ui-btn> </ui-btn>
<ui-btn v-if="showExperimentalFeatures && ebookFile" color="info" :padding-x="4" small class="flex items-center h-9 mr-2" @click="openEbook"> <ui-btn v-if="showReadButton" color="info" :padding-x="4" small class="flex items-center h-9 mr-2" @click="openEbook">
<span class="material-icons -ml-2 pr-2 text-white">auto_stories</span> <span class="material-icons -ml-2 pr-2 text-white">auto_stories</span>
Read Read
</ui-btn> </ui-btn>
@ -223,6 +223,12 @@ export default {
} }
}, },
computed: { computed: {
showExperimentalFeatures() {
return this.$store.state.showExperimentalFeatures
},
enableEReader() {
return this.store.getters['getServerSetting']('enableEReader')
},
userIsAdminOrUp() { userIsAdminOrUp() {
return this.$store.getters['user/getIsAdminOrUp'] return this.$store.getters['user/getIsAdminOrUp']
}, },
@ -241,9 +247,6 @@ export default {
isDeveloperMode() { isDeveloperMode() {
return this.$store.state.developerMode return this.$store.state.developerMode
}, },
showExperimentalFeatures() {
return this.$store.state.showExperimentalFeatures
},
isPodcast() { isPodcast() {
return this.libraryItem.mediaType === 'podcast' return this.libraryItem.mediaType === 'podcast'
}, },
@ -262,6 +265,9 @@ export default {
if (this.isPodcast) return this.podcastEpisodes.length if (this.isPodcast) return this.podcastEpisodes.length
return this.tracks.length return this.tracks.length
}, },
showReadButton() {
return this.ebookFile && (this.showExperimentalFeatures || this.enableEReader)
},
libraryId() { libraryId() {
return this.libraryItem.libraryId return this.libraryItem.libraryId
}, },
@ -342,7 +348,7 @@ export default {
return this.media.ebookFile return this.media.ebookFile
}, },
showExperimentalReadAlert() { showExperimentalReadAlert() {
return !this.tracks.length && this.ebookFile && !this.showExperimentalFeatures return !this.tracks.length && this.ebookFile && !this.showExperimentalFeatures && !this.enableEReader
}, },
description() { description() {
return this.mediaMetadata.description || '' return this.mediaMetadata.description || ''

View File

@ -5,10 +5,6 @@ class ServerSettings {
constructor(settings) { constructor(settings) {
this.id = 'server-settings' this.id = 'server-settings'
// Misc/Unused
this.autoTagNew = false
this.newTagExpireDays = 15
// Scanner // Scanner
this.scannerParseSubtitle = false this.scannerParseSubtitle = false
this.scannerFindCovers = false this.scannerFindCovers = false
@ -43,11 +39,16 @@ class ServerSettings {
// Podcasts // Podcasts
this.podcastEpisodeSchedule = '0 * * * *' // Every hour this.podcastEpisodeSchedule = '0 * * * *' // Every hour
// Sorting
this.sortingIgnorePrefix = false this.sortingIgnorePrefix = false
this.sortingPrefixes = ['the', 'a'] this.sortingPrefixes = ['the', 'a']
// Misc Flags
this.chromecastEnabled = false this.chromecastEnabled = false
this.enableEReader = false
this.logLevel = Logger.logLevel this.logLevel = Logger.logLevel
this.version = null this.version = null
if (settings) { if (settings) {
@ -56,8 +57,6 @@ class ServerSettings {
} }
construct(settings) { construct(settings) {
this.autoTagNew = settings.autoTagNew
this.newTagExpireDays = settings.newTagExpireDays
this.scannerFindCovers = !!settings.scannerFindCovers this.scannerFindCovers = !!settings.scannerFindCovers
this.scannerCoverProvider = settings.scannerCoverProvider || 'google' this.scannerCoverProvider = settings.scannerCoverProvider || 'google'
this.scannerParseSubtitle = settings.scannerParseSubtitle this.scannerParseSubtitle = settings.scannerParseSubtitle
@ -91,6 +90,7 @@ class ServerSettings {
this.sortingIgnorePrefix = !!settings.sortingIgnorePrefix this.sortingIgnorePrefix = !!settings.sortingIgnorePrefix
this.sortingPrefixes = settings.sortingPrefixes || ['the', 'a'] this.sortingPrefixes = settings.sortingPrefixes || ['the', 'a']
this.chromecastEnabled = !!settings.chromecastEnabled this.chromecastEnabled = !!settings.chromecastEnabled
this.enableEReader = !!settings.enableEReader
this.logLevel = settings.logLevel || Logger.logLevel this.logLevel = settings.logLevel || Logger.logLevel
this.version = settings.version || null this.version = settings.version || null
@ -102,8 +102,6 @@ class ServerSettings {
toJSON() { toJSON() {
return { return {
id: this.id, id: this.id,
autoTagNew: this.autoTagNew,
newTagExpireDays: this.newTagExpireDays,
scannerFindCovers: this.scannerFindCovers, scannerFindCovers: this.scannerFindCovers,
scannerCoverProvider: this.scannerCoverProvider, scannerCoverProvider: this.scannerCoverProvider,
scannerParseSubtitle: this.scannerParseSubtitle, scannerParseSubtitle: this.scannerParseSubtitle,
@ -125,6 +123,7 @@ class ServerSettings {
sortingIgnorePrefix: this.sortingIgnorePrefix, sortingIgnorePrefix: this.sortingIgnorePrefix,
sortingPrefixes: [...this.sortingPrefixes], sortingPrefixes: [...this.sortingPrefixes],
chromecastEnabled: this.chromecastEnabled, chromecastEnabled: this.chromecastEnabled,
enableEReader: this.enableEReader,
logLevel: this.logLevel, logLevel: this.logLevel,
version: this.version version: this.version
} }