mirror of
https://github.com/advplyr/audiobookshelf-app.git
synced 2025-07-13 07:24:55 +02:00
Fix:EReader for ebooks in library folder root
This commit is contained in:
parent
b860dfc791
commit
592ea7c533
2 changed files with 14 additions and 8 deletions
|
@ -89,15 +89,18 @@ export default {
|
||||||
},
|
},
|
||||||
ebookUrl() {
|
ebookUrl() {
|
||||||
if (!this.ebookFile) return null
|
if (!this.ebookFile) return null
|
||||||
|
let filepath = ''
|
||||||
var itemRelPath = this.selectedLibraryItem.relPath
|
if (this.selectedLibraryItem.isFile) {
|
||||||
|
filepath = this.$encodeUriPath(this.ebookFile.metadata.filename)
|
||||||
|
} else {
|
||||||
|
const itemRelPath = this.selectedLibraryItem.relPath
|
||||||
if (itemRelPath.startsWith('/')) itemRelPath = itemRelPath.slice(1)
|
if (itemRelPath.startsWith('/')) itemRelPath = itemRelPath.slice(1)
|
||||||
|
const relPath = this.ebookFile.metadata.relPath
|
||||||
var relPath = this.ebookFile.metadata.relPath
|
|
||||||
if (relPath.startsWith('/')) relPath = relPath.slice(1)
|
if (relPath.startsWith('/')) relPath = relPath.slice(1)
|
||||||
|
|
||||||
var serverAddress = this.$store.getters['user/getServerAddress']
|
filepath = this.$encodeUriPath(`${itemRelPath}/${relPath}`)
|
||||||
return `${serverAddress}/ebook/${this.libraryId}/${this.folderId}/${itemRelPath}/${relPath}`
|
}
|
||||||
|
return `/ebook/${this.libraryId}/${this.folderId}/${filepath}`
|
||||||
},
|
},
|
||||||
playerLibraryItemId() {
|
playerLibraryItemId() {
|
||||||
return this.$store.state.playerLibraryItemId
|
return this.$store.state.playerLibraryItemId
|
||||||
|
|
|
@ -16,6 +16,9 @@ if (Capacitor.getPlatform() != 'web') {
|
||||||
|
|
||||||
Vue.prototype.$isDev = process.env.NODE_ENV !== 'production'
|
Vue.prototype.$isDev = process.env.NODE_ENV !== 'production'
|
||||||
|
|
||||||
|
Vue.prototype.$encodeUriPath = (path) => {
|
||||||
|
return path.replace(/\\/g, '/').replace(/%/g, '%25').replace(/#/g, '%23')
|
||||||
|
}
|
||||||
Vue.prototype.$dateDistanceFromNow = (unixms) => {
|
Vue.prototype.$dateDistanceFromNow = (unixms) => {
|
||||||
if (!unixms) return ''
|
if (!unixms) return ''
|
||||||
return formatDistance(unixms, Date.now(), { addSuffix: true })
|
return formatDistance(unixms, Date.now(), { addSuffix: true })
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue