mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2026-08-01 14:11:43 +00:00
Compare commits
No commits in common. "25fe4dee3a0aa2ab7cb46f018505bbddd3695b56" and "8775e55762de9494bd66fe413b7072572bd00d8d" have entirely different histories.
25fe4dee3a
...
8775e55762
4 changed files with 27 additions and 51 deletions
|
|
@ -97,9 +97,9 @@ export default {
|
||||||
},
|
},
|
||||||
ebookUrl() {
|
ebookUrl() {
|
||||||
if (this.fileId) {
|
if (this.fileId) {
|
||||||
return `/api/items/${this.libraryItemId}/ebook/${this.fileId}`
|
return `${this.$config.routerBasePath}/api/items/${this.libraryItemId}/ebook/${this.fileId}`
|
||||||
}
|
}
|
||||||
return `/api/items/${this.libraryItemId}/ebook`
|
return `${this.$config.routerBasePath}/api/items/${this.libraryItemId}/ebook`
|
||||||
},
|
},
|
||||||
themeRules() {
|
themeRules() {
|
||||||
const isDark = this.ereaderSettings.theme === 'dark'
|
const isDark = this.ereaderSettings.theme === 'dark'
|
||||||
|
|
@ -309,24 +309,14 @@ export default {
|
||||||
/** @type {EpubReader} */
|
/** @type {EpubReader} */
|
||||||
const reader = this
|
const reader = this
|
||||||
|
|
||||||
// Use axios to make request because we have token refresh logic in interceptor
|
|
||||||
const customRequest = async (url) => {
|
|
||||||
try {
|
|
||||||
return this.$axios.$get(url, {
|
|
||||||
responseType: 'arraybuffer'
|
|
||||||
})
|
|
||||||
} catch (error) {
|
|
||||||
console.error('EpubReader.initEpub customRequest failed:', error)
|
|
||||||
throw error
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/** @type {ePub.Book} */
|
/** @type {ePub.Book} */
|
||||||
reader.book = new ePub(reader.ebookUrl, {
|
reader.book = new ePub(reader.ebookUrl, {
|
||||||
width: this.readerWidth,
|
width: this.readerWidth,
|
||||||
height: this.readerHeight - 50,
|
height: this.readerHeight - 50,
|
||||||
openAs: 'epub',
|
openAs: 'epub',
|
||||||
requestMethod: customRequest
|
requestHeaders: {
|
||||||
|
Authorization: `Bearer ${this.userToken}`
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
/** @type {ePub.Rendition} */
|
/** @type {ePub.Rendition} */
|
||||||
|
|
@ -347,8 +337,7 @@ export default {
|
||||||
this.applyTheme()
|
this.applyTheme()
|
||||||
})
|
})
|
||||||
|
|
||||||
reader.book.ready
|
reader.book.ready.then(() => {
|
||||||
.then(() => {
|
|
||||||
// set up event listeners
|
// set up event listeners
|
||||||
reader.rendition.on('relocated', reader.relocated)
|
reader.rendition.on('relocated', reader.relocated)
|
||||||
reader.rendition.on('keydown', reader.keyUp)
|
reader.rendition.on('keydown', reader.keyUp)
|
||||||
|
|
@ -371,9 +360,6 @@ export default {
|
||||||
}
|
}
|
||||||
this.getChapters()
|
this.getChapters()
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
|
||||||
console.error('EpubReader.initEpub failed:', error)
|
|
||||||
})
|
|
||||||
},
|
},
|
||||||
getChapters() {
|
getChapters() {
|
||||||
// Load the list of chapters in the book. See https://github.com/futurepress/epub.js/issues/759
|
// Load the list of chapters in the book. See https://github.com/futurepress/epub.js/issues/759
|
||||||
|
|
|
||||||
|
|
@ -206,11 +206,6 @@ class LibraryItemScanner {
|
||||||
async scanPotentialNewLibraryItem(libraryItemPath, library, folder, isSingleMediaItem) {
|
async scanPotentialNewLibraryItem(libraryItemPath, library, folder, isSingleMediaItem) {
|
||||||
const libraryItemScanData = await this.getLibraryItemScanData(libraryItemPath, library, folder, isSingleMediaItem)
|
const libraryItemScanData = await this.getLibraryItemScanData(libraryItemPath, library, folder, isSingleMediaItem)
|
||||||
|
|
||||||
if (!libraryItemScanData.libraryFiles.length) {
|
|
||||||
Logger.info(`[LibraryItemScanner] Library item at path "${libraryItemPath}" has no files - ignoring`)
|
|
||||||
return null
|
|
||||||
}
|
|
||||||
|
|
||||||
const scanLogger = new ScanLogger()
|
const scanLogger = new ScanLogger()
|
||||||
scanLogger.verbose = true
|
scanLogger.verbose = true
|
||||||
scanLogger.setData('libraryItem', libraryItemScanData.relPath)
|
scanLogger.setData('libraryItem', libraryItemScanData.relPath)
|
||||||
|
|
|
||||||
|
|
@ -606,11 +606,6 @@ class LibraryScanner {
|
||||||
} else if (library.settings.audiobooksOnly && !hasAudioFiles(fileUpdateGroup, itemDir)) {
|
} else if (library.settings.audiobooksOnly && !hasAudioFiles(fileUpdateGroup, itemDir)) {
|
||||||
Logger.debug(`[LibraryScanner] Folder update for relative path "${itemDir}" has no audio files`)
|
Logger.debug(`[LibraryScanner] Folder update for relative path "${itemDir}" has no audio files`)
|
||||||
continue
|
continue
|
||||||
} else if (!(await fs.pathExists(fullPath))) {
|
|
||||||
Logger.info(`[LibraryScanner] File update group "${itemDir}" does not exist - ignoring`)
|
|
||||||
|
|
||||||
itemGroupingResults[itemDir] = ScanResult.NOTHING
|
|
||||||
continue
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if a library item is a subdirectory of this dir
|
// Check if a library item is a subdirectory of this dir
|
||||||
|
|
|
||||||
|
|
@ -109,7 +109,7 @@ function getIno(path) {
|
||||||
.stat(path, { bigint: true })
|
.stat(path, { bigint: true })
|
||||||
.then((data) => String(data.ino))
|
.then((data) => String(data.ino))
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
Logger.warn(`[Utils] Failed to get ino for path "${path}"`, err)
|
Logger.error('[Utils] Failed to get ino for path', path, err)
|
||||||
return null
|
return null
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue