mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2024-12-30 18:48:55 +01:00
Add:Separate setting for alt bookshelf view on home page
This commit is contained in:
parent
d06c61b329
commit
c5f91ec508
@ -70,11 +70,8 @@ export default {
|
|||||||
libraryName() {
|
libraryName() {
|
||||||
return this.$store.getters['libraries/getCurrentLibraryName']
|
return this.$store.getters['libraries/getCurrentLibraryName']
|
||||||
},
|
},
|
||||||
bookshelfView() {
|
|
||||||
return this.$store.getters['getServerSetting']('bookshelfView')
|
|
||||||
},
|
|
||||||
isAlternativeBookshelfView() {
|
isAlternativeBookshelfView() {
|
||||||
return this.bookshelfView === this.$constants.BookshelfView.TITLES
|
return this.$store.getters['getHomeBookshelfView'] === this.$constants.BookshelfView.TITLES
|
||||||
},
|
},
|
||||||
bookCoverWidth() {
|
bookCoverWidth() {
|
||||||
var coverSize = this.$store.getters['user/getUserSetting']('bookshelfCoverSize')
|
var coverSize = this.$store.getters['user/getUserSetting']('bookshelfCoverSize')
|
||||||
|
@ -112,17 +112,16 @@ export default {
|
|||||||
coverAspectRatio() {
|
coverAspectRatio() {
|
||||||
return this.$store.getters['libraries/getBookCoverAspectRatio']
|
return this.$store.getters['libraries/getBookCoverAspectRatio']
|
||||||
},
|
},
|
||||||
bookshelfView() {
|
|
||||||
return this.$store.getters['getServerSetting']('bookshelfView')
|
|
||||||
},
|
|
||||||
sortingIgnorePrefix() {
|
sortingIgnorePrefix() {
|
||||||
return this.$store.getters['getServerSetting']('sortingIgnorePrefix')
|
return this.$store.getters['getServerSetting']('sortingIgnorePrefix')
|
||||||
},
|
},
|
||||||
isCoverSquareAspectRatio() {
|
isCoverSquareAspectRatio() {
|
||||||
return this.coverAspectRatio == 1
|
return this.coverAspectRatio == 1
|
||||||
},
|
},
|
||||||
|
bookshelfView() {
|
||||||
|
return this.$store.getters['getBookshelfView']
|
||||||
|
},
|
||||||
isAlternativeBookshelfView() {
|
isAlternativeBookshelfView() {
|
||||||
// if (!this.isEntityBook) return false // Only used for bookshelf showing books
|
|
||||||
return this.bookshelfView === this.$constants.BookshelfView.TITLES
|
return this.bookshelfView === this.$constants.BookshelfView.TITLES
|
||||||
},
|
},
|
||||||
hasFilter() {
|
hasFilter() {
|
||||||
|
@ -61,6 +61,15 @@
|
|||||||
</p>
|
</p>
|
||||||
</ui-tooltip>
|
</ui-tooltip>
|
||||||
</div> -->
|
</div> -->
|
||||||
|
<div class="flex items-center py-2">
|
||||||
|
<ui-toggle-switch v-model="homeUseAlternativeBookshelfView" :disabled="updatingServerSettings" @input="updateHomeAlternativeBookshelfView" />
|
||||||
|
<ui-tooltip :text="tooltips.bookshelfView">
|
||||||
|
<p class="pl-4">
|
||||||
|
Alternative bookshelf view for home page
|
||||||
|
<span class="material-icons icon-text text-sm">info_outlined</span>
|
||||||
|
</p>
|
||||||
|
</ui-tooltip>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="flex items-center py-2">
|
<div class="flex items-center py-2">
|
||||||
<ui-toggle-switch v-model="useAlternativeBookshelfView" :disabled="updatingServerSettings" @input="updateAlternativeBookshelfView" />
|
<ui-toggle-switch v-model="useAlternativeBookshelfView" :disabled="updatingServerSettings" @input="updateAlternativeBookshelfView" />
|
||||||
@ -271,6 +280,7 @@ export default {
|
|||||||
isResettingLibraryItems: false,
|
isResettingLibraryItems: false,
|
||||||
updatingServerSettings: false,
|
updatingServerSettings: false,
|
||||||
useSquareBookCovers: false,
|
useSquareBookCovers: false,
|
||||||
|
homeUseAlternativeBookshelfView: false,
|
||||||
useAlternativeBookshelfView: false,
|
useAlternativeBookshelfView: false,
|
||||||
isPurgingCache: false,
|
isPurgingCache: false,
|
||||||
newServerSettings: {},
|
newServerSettings: {},
|
||||||
@ -362,6 +372,11 @@ export default {
|
|||||||
coverAspectRatio: val ? this.$constants.BookCoverAspectRatio.SQUARE : this.$constants.BookCoverAspectRatio.STANDARD
|
coverAspectRatio: val ? this.$constants.BookCoverAspectRatio.SQUARE : this.$constants.BookCoverAspectRatio.STANDARD
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
updateHomeAlternativeBookshelfView(val) {
|
||||||
|
this.updateServerSettings({
|
||||||
|
homeBookshelfView: val ? this.$constants.BookshelfView.TITLES : this.$constants.BookshelfView.STANDARD
|
||||||
|
})
|
||||||
|
},
|
||||||
updateAlternativeBookshelfView(val) {
|
updateAlternativeBookshelfView(val) {
|
||||||
this.updateServerSettings({
|
this.updateServerSettings({
|
||||||
bookshelfView: val ? this.$constants.BookshelfView.TITLES : this.$constants.BookshelfView.STANDARD
|
bookshelfView: val ? this.$constants.BookshelfView.TITLES : this.$constants.BookshelfView.STANDARD
|
||||||
@ -393,6 +408,7 @@ export default {
|
|||||||
|
|
||||||
this.useSquareBookCovers = this.newServerSettings.coverAspectRatio === this.$constants.BookCoverAspectRatio.SQUARE
|
this.useSquareBookCovers = this.newServerSettings.coverAspectRatio === this.$constants.BookCoverAspectRatio.SQUARE
|
||||||
|
|
||||||
|
this.homeUseAlternativeBookshelfView = this.newServerSettings.homeBookshelfView === this.$constants.BookshelfView.TITLES
|
||||||
this.useAlternativeBookshelfView = this.newServerSettings.bookshelfView === this.$constants.BookshelfView.TITLES
|
this.useAlternativeBookshelfView = this.newServerSettings.bookshelfView === this.$constants.BookshelfView.TITLES
|
||||||
},
|
},
|
||||||
resetLibraryItems() {
|
resetLibraryItems() {
|
||||||
|
@ -75,6 +75,9 @@ const Hotkeys = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export {
|
||||||
|
Constants
|
||||||
|
}
|
||||||
export default ({ app }, inject) => {
|
export default ({ app }, inject) => {
|
||||||
inject('constants', Constants)
|
inject('constants', Constants)
|
||||||
inject('keynames', KeyNames)
|
inject('keynames', KeyNames)
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import { checkForUpdate, currentVersion } from '@/plugins/version'
|
import { checkForUpdate, currentVersion } from '@/plugins/version'
|
||||||
import Vue from 'vue'
|
import Vue from 'vue'
|
||||||
|
const { Constants } = require('../plugins/constants')
|
||||||
|
|
||||||
export const state = () => ({
|
export const state = () => ({
|
||||||
Source: null,
|
Source: null,
|
||||||
@ -45,6 +46,14 @@ export const getters = {
|
|||||||
if (!state.streamLibraryItem) return null
|
if (!state.streamLibraryItem) return null
|
||||||
if (!episodeId) return state.streamLibraryItem.id == libraryItemId
|
if (!episodeId) return state.streamLibraryItem.id == libraryItemId
|
||||||
return state.streamLibraryItem.id == libraryItemId && state.streamEpisodeId == episodeId
|
return state.streamLibraryItem.id == libraryItemId && state.streamEpisodeId == episodeId
|
||||||
|
},
|
||||||
|
getBookshelfView: state => {
|
||||||
|
if (!state.serverSettings || isNaN(state.serverSettings.bookshelfView)) return Constants.BookshelfView.STANDARD
|
||||||
|
return state.serverSettings.bookshelfView
|
||||||
|
},
|
||||||
|
getHomeBookshelfView: state => {
|
||||||
|
if (!state.serverSettings || isNaN(state.serverSettings.homeBookshelfView)) return Constants.BookshelfView.STANDARD
|
||||||
|
return state.serverSettings.homeBookshelfView
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
const { Constants } = require('../plugins/constants')
|
||||||
|
|
||||||
export const state = () => ({
|
export const state = () => ({
|
||||||
libraries: [],
|
libraries: [],
|
||||||
lastLoad: 0,
|
lastLoad: 0,
|
||||||
@ -49,7 +51,7 @@ export const getters = {
|
|||||||
},
|
},
|
||||||
getBookCoverAspectRatio: (state, getters) => {
|
getBookCoverAspectRatio: (state, getters) => {
|
||||||
if (!getters.getCurrentLibrarySettings || isNaN(getters.getCurrentLibrarySettings.coverAspectRatio)) return 1
|
if (!getters.getCurrentLibrarySettings || isNaN(getters.getCurrentLibrarySettings.coverAspectRatio)) return 1
|
||||||
return getters.getCurrentLibrarySettings.coverAspectRatio === 0 ? 1.6 : 1
|
return getters.getCurrentLibrarySettings.coverAspectRatio === Constants.BookCoverAspectRatio.STANDARD ? 1.6 : 1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -39,7 +39,11 @@ class ServerSettings {
|
|||||||
this.loggerScannerLogsToKeep = 2
|
this.loggerScannerLogsToKeep = 2
|
||||||
|
|
||||||
// Cover
|
// Cover
|
||||||
|
// TODO: Remove after mobile apps are configured to use library server settings
|
||||||
this.coverAspectRatio = BookCoverAspectRatio.SQUARE
|
this.coverAspectRatio = BookCoverAspectRatio.SQUARE
|
||||||
|
|
||||||
|
// Bookshelf Display
|
||||||
|
this.homeBookshelfView = BookshelfView.STANDARD
|
||||||
this.bookshelfView = BookshelfView.STANDARD
|
this.bookshelfView = BookshelfView.STANDARD
|
||||||
|
|
||||||
// Podcasts
|
// Podcasts
|
||||||
@ -80,13 +84,7 @@ class ServerSettings {
|
|||||||
this.scannerMaxThreads = isNullOrNaN(settings.scannerMaxThreads) ? 0 : Number(settings.scannerMaxThreads)
|
this.scannerMaxThreads = isNullOrNaN(settings.scannerMaxThreads) ? 0 : Number(settings.scannerMaxThreads)
|
||||||
|
|
||||||
this.storeCoverWithItem = !!settings.storeCoverWithItem
|
this.storeCoverWithItem = !!settings.storeCoverWithItem
|
||||||
if (settings.storeCoverWithBook != undefined) { // storeCoverWithBook was old name of setting < v2
|
|
||||||
this.storeCoverWithItem = !!settings.storeCoverWithBook
|
|
||||||
}
|
|
||||||
this.storeMetadataWithItem = !!settings.storeMetadataWithItem
|
this.storeMetadataWithItem = !!settings.storeMetadataWithItem
|
||||||
if (settings.storeMetadataWithBook != undefined) { // storeMetadataWithBook was old name of setting < v2
|
|
||||||
this.storeMetadataWithItem = !!settings.storeMetadataWithBook
|
|
||||||
}
|
|
||||||
|
|
||||||
this.rateLimitLoginRequests = !isNaN(settings.rateLimitLoginRequests) ? Number(settings.rateLimitLoginRequests) : 10
|
this.rateLimitLoginRequests = !isNaN(settings.rateLimitLoginRequests) ? Number(settings.rateLimitLoginRequests) : 10
|
||||||
this.rateLimitLoginWindow = !isNaN(settings.rateLimitLoginWindow) ? Number(settings.rateLimitLoginWindow) : 10 * 60 * 1000 // 10 Minutes
|
this.rateLimitLoginWindow = !isNaN(settings.rateLimitLoginWindow) ? Number(settings.rateLimitLoginWindow) : 10 * 60 * 1000 // 10 Minutes
|
||||||
@ -100,6 +98,7 @@ class ServerSettings {
|
|||||||
this.loggerScannerLogsToKeep = settings.loggerScannerLogsToKeep || 2
|
this.loggerScannerLogsToKeep = settings.loggerScannerLogsToKeep || 2
|
||||||
|
|
||||||
this.coverAspectRatio = !isNaN(settings.coverAspectRatio) ? settings.coverAspectRatio : BookCoverAspectRatio.SQUARE
|
this.coverAspectRatio = !isNaN(settings.coverAspectRatio) ? settings.coverAspectRatio : BookCoverAspectRatio.SQUARE
|
||||||
|
this.homeBookshelfView = settings.homeBookshelfView || BookshelfView.STANDARD
|
||||||
this.bookshelfView = settings.bookshelfView || BookshelfView.STANDARD
|
this.bookshelfView = settings.bookshelfView || BookshelfView.STANDARD
|
||||||
|
|
||||||
this.sortingIgnorePrefix = !!settings.sortingIgnorePrefix
|
this.sortingIgnorePrefix = !!settings.sortingIgnorePrefix
|
||||||
@ -110,6 +109,17 @@ class ServerSettings {
|
|||||||
this.logLevel = settings.logLevel || Logger.logLevel
|
this.logLevel = settings.logLevel || Logger.logLevel
|
||||||
this.version = settings.version || null
|
this.version = settings.version || null
|
||||||
|
|
||||||
|
// Migrations
|
||||||
|
if (settings.storeCoverWithBook != undefined) { // storeCoverWithBook was renamed to storeCoverWithItem in 2.0.0
|
||||||
|
this.storeCoverWithItem = !!settings.storeCoverWithBook
|
||||||
|
}
|
||||||
|
if (settings.storeMetadataWithBook != undefined) { // storeMetadataWithBook was renamed to storeMetadataWithItem in 2.0.0
|
||||||
|
this.storeMetadataWithItem = !!settings.storeMetadataWithBook
|
||||||
|
}
|
||||||
|
if (settings.homeBookshelfView == undefined) { // homeBookshelfView was added in 2.1.3
|
||||||
|
this.homeBookshelfView = settings.bookshelfView
|
||||||
|
}
|
||||||
|
|
||||||
if (this.logLevel !== Logger.logLevel) {
|
if (this.logLevel !== Logger.logLevel) {
|
||||||
Logger.setLogLevel(this.logLevel)
|
Logger.setLogLevel(this.logLevel)
|
||||||
}
|
}
|
||||||
@ -140,6 +150,7 @@ class ServerSettings {
|
|||||||
loggerDailyLogsToKeep: this.loggerDailyLogsToKeep,
|
loggerDailyLogsToKeep: this.loggerDailyLogsToKeep,
|
||||||
loggerScannerLogsToKeep: this.loggerScannerLogsToKeep,
|
loggerScannerLogsToKeep: this.loggerScannerLogsToKeep,
|
||||||
coverAspectRatio: this.coverAspectRatio,
|
coverAspectRatio: this.coverAspectRatio,
|
||||||
|
homeBookshelfView: this.homeBookshelfView,
|
||||||
bookshelfView: this.bookshelfView,
|
bookshelfView: this.bookshelfView,
|
||||||
sortingIgnorePrefix: this.sortingIgnorePrefix,
|
sortingIgnorePrefix: this.sortingIgnorePrefix,
|
||||||
sortingPrefixes: [...this.sortingPrefixes],
|
sortingPrefixes: [...this.sortingPrefixes],
|
||||||
|
Loading…
Reference in New Issue
Block a user