From a590e795e321800a5e3586e4c5f4518d97d4ed65 Mon Sep 17 00:00:00 2001 From: advplyr Date: Sat, 2 Oct 2021 15:36:33 -0500 Subject: [PATCH] Fix ebook url, add opus to uploader, set chapters after track updates --- client/components/app/Appbar.vue | 5 +++++ client/components/app/Reader.vue | 2 +- client/pages/upload/index.vue | 4 ++-- client/tailwind.config.js | 3 ++- server/Server.js | 13 ++++++++----- server/objects/Audiobook.js | 1 + 6 files changed, 19 insertions(+), 9 deletions(-) diff --git a/client/components/app/Appbar.vue b/client/components/app/Appbar.vue index 2e3d8710..b04ec7f5 100644 --- a/client/components/app/Appbar.vue +++ b/client/components/app/Appbar.vue @@ -17,6 +17,8 @@
+ logo_dev + upload @@ -117,6 +119,9 @@ export default { }, processingBatch() { return this.$store.state.processingBatch + }, + showExperimentalFeatures() { + return this.$store.state.showExperimentalFeatures } }, methods: { diff --git a/client/components/app/Reader.vue b/client/components/app/Reader.vue index fb1c2ddb..851ca79d 100644 --- a/client/components/app/Reader.vue +++ b/client/components/app/Reader.vue @@ -70,7 +70,7 @@ export default { } }, fullUrl() { - var serverUrl = process.env.serverUrl + var serverUrl = process.env.serverUrl || '/local' return `${serverUrl}/${this.url}` } }, diff --git a/client/pages/upload/index.vue b/client/pages/upload/index.vue index 30afb57c..62d552e7 100644 --- a/client/pages/upload/index.vue +++ b/client/pages/upload/index.vue @@ -120,9 +120,9 @@ export default { title: null, author: null, series: null, - acceptedAudioFormats: ['.mp3', '.m4b', '.m4a', '.flac'], + acceptedAudioFormats: ['.mp3', '.m4b', '.m4a', '.flac', '.opus'], acceptedImageFormats: ['.png', '.jpg', '.jpeg', '.webp'], - inputAccept: '.png, .jpg, .jpeg, .webp, .mp3, .m4b, .m4a, .flac', + inputAccept: '.png, .jpg, .jpeg, .webp, .mp3, .m4b, .m4a, .flac, .opus', isDragOver: false, showUploader: true, validAudioFiles: [], diff --git a/client/tailwind.config.js b/client/tailwind.config.js index 943bd4e4..15265f28 100644 --- a/client/tailwind.config.js +++ b/client/tailwind.config.js @@ -6,7 +6,8 @@ module.exports = { safelist: [ 'bg-success', 'bg-red-600', - 'py-1.5' + 'py-1.5', + 'bg-info' ] } }, diff --git a/server/Server.js b/server/Server.js index e9b97421..7b52c9fa 100644 --- a/server/Server.js +++ b/server/Server.js @@ -439,18 +439,21 @@ class Server { }) } - testFileSystem(req, res) { + async testFileSystem(req, res) { Logger.debug(`[Server] Running fs test`) - var paths = fs.readdir(global.appRoot) + var paths = await fs.readdir(global.appRoot) Logger.debug(paths) var pathMap = {} if (paths && paths.length) { for (let i = 0; i < paths.length; i++) { var fullPath = Path.join(global.appRoot, paths[i]) Logger.debug('Checking path', fullPath) - var _paths = fs.readdir(fullPath) - Logger.debug(_paths) - pathMap[paths[i]] = _paths + var isDirectory = fs.lstatSync(fullPath).isDirectory() + if (isDirectory) { + var _paths = await fs.readdir(fullPath) + Logger.debug(_paths) + pathMap[paths[i]] = _paths + } } } Logger.debug('Finished fs test') diff --git a/server/objects/Audiobook.js b/server/objects/Audiobook.js index 90109891..ab79099e 100644 --- a/server/objects/Audiobook.js +++ b/server/objects/Audiobook.js @@ -390,6 +390,7 @@ class Audiobook { this.addTrack(file) } }) + this.setChapters() this.lastUpdate = Date.now() }