From 30e0cc4c07f6cfbdc408a1cb9f5b4d1c358cd2a2 Mon Sep 17 00:00:00 2001 From: advplyr Date: Thu, 10 Feb 2022 17:05:15 -0600 Subject: [PATCH 1/5] Cleanup & start of abs metadata file --- server/objects/Book.js | 1 + server/utils/absFileGenerator.js | 37 ++++++++++++++++++++++++++++++++ server/utils/filePerms.js | 6 +++--- server/utils/fileUtils.js | 10 --------- 4 files changed, 41 insertions(+), 13 deletions(-) create mode 100644 server/utils/absFileGenerator.js diff --git a/server/objects/Book.js b/server/objects/Book.js index 3bf149ac2..6023feea8 100644 --- a/server/objects/Book.js +++ b/server/objects/Book.js @@ -47,6 +47,7 @@ class Book { get _language() { return this.language || '' } get _isbn() { return this.isbn || '' } get _asin() { return this.asin || '' } + get genresCommaSeparated() { return this._genres.join(', ') } get shouldSearchForCover() { if (this.cover) return false diff --git a/server/utils/absFileGenerator.js b/server/utils/absFileGenerator.js new file mode 100644 index 000000000..a74d78e2d --- /dev/null +++ b/server/utils/absFileGenerator.js @@ -0,0 +1,37 @@ +const fs = require('fs-extra') +const filePerms = require('./filePerms') +const package = require('../../package.json') +const Logger = require('../Logger') + +const bookKeyMap = { + title: 'title', + subtitle: 'subtitle', + author: 'authorFL', + narrator: 'narratorFL', + series: 'series', + volumeNumber: 'volumeNumber', + publishYear: 'publishYear', + publisher: 'publisher', + description: 'description', + isbn: 'isbn', + asin: 'asin', + language: 'language', + genres: 'genresCommaSeparated' +} + +function generate(audiobook, outputPath, uid, gid) { + var fileString = `[audiobookshelf v${package.version}]\n` + + for (const key in bookKeyMap) { + const value = audiobook.book[bookKeyMap[key]] || '' + fileString += `${key}=${value}\n` + } + + return fs.writeFile(outputPath, fileString).then(() => { + return filePerms(outputPath, 0o774, uid, gid).then(() => true) + }).catch((error) => { + Logger.error(`[absMetaFileGenerator] Failed to save abs file`, error) + return false + }) +} +module.exports.generate = generate \ No newline at end of file diff --git a/server/utils/filePerms.js b/server/utils/filePerms.js index 531e224d1..4b64851ad 100644 --- a/server/utils/filePerms.js +++ b/server/utils/filePerms.js @@ -77,9 +77,9 @@ const chmodr = (p, mode, uid, gid, cb) => { }) } -module.exports = (p, mode, uid, gid) => { +module.exports = (path, mode, uid, gid) => { return new Promise((resolve) => { - Logger.debug(`[FilePerms] Setting permission "${mode}" for uid ${uid} and gid ${gid} | "${p}"`) - chmodr(p, mode, uid, gid, resolve) + Logger.debug(`[FilePerms] Setting permission "${mode}" for uid ${uid} and gid ${gid} | "${path}"`) + chmodr(path, mode, uid, gid, resolve) }) } \ No newline at end of file diff --git a/server/utils/fileUtils.js b/server/utils/fileUtils.js index 2876a5620..44288e816 100644 --- a/server/utils/fileUtils.js +++ b/server/utils/fileUtils.js @@ -51,16 +51,6 @@ function bytesPretty(bytes, decimals = 0) { } module.exports.bytesPretty = bytesPretty -function setFileOwner(path, uid, gid) { - try { - return fs.chown(path, uid, gid).then(() => true) - } catch (err) { - console.error('Failed set file owner', err) - return false - } -} -module.exports.setFileOwner = setFileOwner - async function recurseFiles(path, relPathToReplace = null) { path = path.replace(/\\/g, '/') if (!path.endsWith('/')) path = path + '/' From 0dca8472de2106e6091ae4edf3295786c0ba1636 Mon Sep 17 00:00:00 2001 From: advplyr Date: Fri, 11 Feb 2022 08:50:28 -0600 Subject: [PATCH 2/5] Fix:Mobile flag max size --- client/package-lock.json | 2 +- client/pages/config.vue | 9 ++++++--- client/store/globals.js | 2 +- package-lock.json | 2 +- 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/client/package-lock.json b/client/package-lock.json index 19491c4da..c8235912e 100644 --- a/client/package-lock.json +++ b/client/package-lock.json @@ -1,6 +1,6 @@ { "name": "audiobookshelf-client", - "version": "1.6.65", + "version": "1.6.66", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/client/pages/config.vue b/client/pages/config.vue index 2ebc3c246..db2c48ecc 100644 --- a/client/pages/config.vue +++ b/client/pages/config.vue @@ -2,7 +2,7 @@
-
+
more_vert

{{ currentPage }}

@@ -35,6 +35,9 @@ export default { } }, computed: { + isMobile() { + return this.$store.state.globals.isMobile + }, streamAudiobook() { return this.$store.state.streamAudiobook }, @@ -78,12 +81,12 @@ export default { .configContent.page-library-stats { width: 1200px; } -@media (max-width: 1024px) { +@media (max-width: 1240px) { .configContent { margin-left: 176px; } } -@media (max-width: 768px) { +@media (max-width: 640px) { .configContent { margin-left: 0px; width: 100%; diff --git a/client/store/globals.js b/client/store/globals.js index 786e6e014..afacd6fa9 100644 --- a/client/store/globals.js +++ b/client/store/globals.js @@ -13,7 +13,7 @@ export const getters = {} export const mutations = { updateWindowSize(state, { width, height }) { - state.isMobile = width < 768 || height < 768 + state.isMobile = width < 640 || height < 640 state.isMobileLandscape = state.isMobile && height > width }, setShowUserCollectionsModal(state, val) { diff --git a/package-lock.json b/package-lock.json index 96793248c..f835c8f90 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "audiobookshelf", - "version": "1.6.62", + "version": "1.6.66", "lockfileVersion": 1, "requires": true, "dependencies": { From 43b5b87799036fbe7b3602ef7a20e83e690c0343 Mon Sep 17 00:00:00 2001 From: advplyr Date: Fri, 11 Feb 2022 17:08:33 -0600 Subject: [PATCH 3/5] Update readme with nginx proxy manager setup --- readme.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/readme.md b/readme.md index bdeec5059..a4314d185 100644 --- a/readme.md +++ b/readme.md @@ -121,6 +121,14 @@ Ffmpeg static build: `/usr/lib/audiobookshelf-ffmpeg/` ## Reverse Proxy Set Up +#### Important! Audiobookshelf requires a websocket connection. + +### NGINX Proxy Manager + +Toggle websockets support. + +NGINX Web socket + ### NGINX Reverse Proxy Add this to the site config file on your nginx server after you have changed the relevant parts in the <> brackets, and inserted your certificate paths. From 38668ec17ba24f346e55c449209adab33fee1212 Mon Sep 17 00:00:00 2001 From: advplyr Date: Fri, 11 Feb 2022 17:17:27 -0600 Subject: [PATCH 4/5] Update readme with synology reverse proxy setup --- readme.md | 29 +++++++++++++++++++++++------ 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/readme.md b/readme.md index a4314d185..57c455aa1 100644 --- a/readme.md +++ b/readme.md @@ -12,7 +12,7 @@

-## About +# About Audiobookshelf is a self-hosted audiobook server for managing and playing your audiobooks. @@ -34,14 +34,16 @@ iOS early beta available using Test Flight: https://testflight.apple.com/join/wi Library Screenshot -## Organizing your audiobooks +# Organizing your audiobooks #### Directory structure and folder names are important to Audiobookshelf! See [documentation](https://audiobookshelf.org/docs) for supported directory structure, folder naming conventions, and audio file metadata usage. +
+
-## Installation +# Installation ** Default username is "root" with no password @@ -119,7 +121,9 @@ System Service: `/lib/systemd/system/audiobookshelf.service` Ffmpeg static build: `/usr/lib/audiobookshelf-ffmpeg/` -## Reverse Proxy Set Up +
+
+# Reverse Proxy Set Up #### Important! Audiobookshelf requires a websocket connection. @@ -199,10 +203,23 @@ For this to work you must enable at least the following mods using `a2enmod`: [See this solution](https://forums.unraid.net/topic/112698-support-audiobookshelf/?do=findComment&comment=1049637) -## Run from source +### Synology Reverse Proxy + +1. Open Control Panel > Application Portal +2. Change to the Reverse Proxy tab +3. Select the proxy rule for which you want to enable Websockets and click on Edit +4. Change to the "Custom Header" tab +5. Click Create > WebSocket +6. Click Save + +[from @silentArtifact](https://github.com/advplyr/audiobookshelf/issues/241#issuecomment-1036732329) + + + +# Run from source [See discussion](https://github.com/advplyr/audiobookshelf/discussions/259#discussioncomment-1869729) -## Contributing / How to Support +# Contributing / How to Support [See the incomplete "How to Support" page](https://www.audiobookshelf.org/support) From 7658433d728fa94700bf3e39bae902bd92d24527 Mon Sep 17 00:00:00 2001 From: advplyr Date: Fri, 11 Feb 2022 17:18:56 -0600 Subject: [PATCH 5/5] Fix readme header and spacing --- readme.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/readme.md b/readme.md index 57c455aa1..077aabf98 100644 --- a/readme.md +++ b/readme.md @@ -34,6 +34,8 @@ iOS early beta available using Test Flight: https://testflight.apple.com/join/wi Library Screenshot +
+ # Organizing your audiobooks #### Directory structure and folder names are important to Audiobookshelf! @@ -41,7 +43,6 @@ iOS early beta available using Test Flight: https://testflight.apple.com/join/wi See [documentation](https://audiobookshelf.org/docs) for supported directory structure, folder naming conventions, and audio file metadata usage.
-
# Installation @@ -122,7 +123,7 @@ System Service: `/lib/systemd/system/audiobookshelf.service` Ffmpeg static build: `/usr/lib/audiobookshelf-ffmpeg/`
-
+ # Reverse Proxy Set Up #### Important! Audiobookshelf requires a websocket connection. @@ -214,7 +215,7 @@ For this to work you must enable at least the following mods using `a2enmod`: [from @silentArtifact](https://github.com/advplyr/audiobookshelf/issues/241#issuecomment-1036732329) - +
# Run from source