From 8e0ccf59e0de018a4eae8c1b8d79274bcb1be1d3 Mon Sep 17 00:00:00 2001 From: Vylyne <94922829+Vylyne@users.noreply.github.com> Date: Wed, 1 Oct 2025 12:35:14 -0400 Subject: [PATCH 01/23] added PUID and GUID Args For buildtime UID and GID specification, Add User and Group with those ids and set User at entrypiont call. there will be permission errors. --- Dockerfile | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 816bdd3c3..8239e4761 100644 --- a/Dockerfile +++ b/Dockerfile @@ -25,7 +25,7 @@ RUN apk add --no-cache --update \ unzip WORKDIR /server -COPY index.js package* /server +COPY index.js package* /server/ COPY /server /server/server RUN case "$TARGETPLATFORM" in \ @@ -45,12 +45,18 @@ FROM node:20-alpine ARG NUSQLITE3_DIR ARG NUSQLITE3_PATH +ARG PUID=1000 +ARG PGID=1000 # Install only runtime dependencies RUN apk add --no-cache --update \ tzdata \ ffmpeg \ - tini + tini \ + shadow \ + && addgroup -g ${PGID} audiobookshelf \ + && adduser -u ${PUID} -G audiobookshelf -D audiobookshelf \ + && apk del --purge shadow WORKDIR /app @@ -69,5 +75,6 @@ ENV SOURCE="docker" ENV NUSQLITE3_DIR=${NUSQLITE3_DIR} ENV NUSQLITE3_PATH=${NUSQLITE3_PATH} +USER audiobookshelf ENTRYPOINT ["tini", "--"] CMD ["node", "index.js"] From 7403a0199eb7e93d4c0e224c5ae3b23ef2dd0aab Mon Sep 17 00:00:00 2001 From: Vylyne <94922829+Vylyne@users.noreply.github.com> Date: Wed, 1 Oct 2025 12:46:59 -0400 Subject: [PATCH 02/23] updated build yaml to allow builds in other repos, and build on dev branches --- .github/workflows/docker-build.yml | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/.github/workflows/docker-build.yml b/.github/workflows/docker-build.yml index fdb57fbc5..77d71c736 100644 --- a/.github/workflows/docker-build.yml +++ b/.github/workflows/docker-build.yml @@ -10,7 +10,10 @@ on: required: true default: 'latest' push: - branches: [main, master] + branches: + - main + - master + - dev/* tags: - 'v*.*.*' # Only build when files in these directories have been changed @@ -22,7 +25,7 @@ on: jobs: build: - if: ${{ !contains(github.event.head_commit.message, 'skip ci') && github.repository == 'advplyr/audiobookshelf' }} + if: ${{ !contains(github.event.head_commit.message, 'skip ci') }} runs-on: ubuntu-24.04 steps: @@ -33,8 +36,11 @@ jobs: id: meta uses: docker/metadata-action@v5 with: - images: advplyr/audiobookshelf,ghcr.io/${{ github.repository_owner }}/audiobookshelf + images: | + name:${{ secrets.DOCKERHUB_USERNAME }}/audiobookshelf,enable=${{ github.ref == 'refs/heads/main' && secrets.DOCKER_HUB_USERNAME != '' && secrets.DOCKER_HUB_TOKEN != '' }} + name:ghcr.io/${{ github.repository }},enable=true tags: | + type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' }} type=edge,branch=master type=semver,pattern={{version}} @@ -54,6 +60,10 @@ jobs: - name: Login to Dockerhub uses: docker/login-action@v3 + env: # secrets for Docker hub username and token should be in the registry settings if not docker hub push will be skipped. + DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME || '' }} + DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN || '' }} + if: ${{ github.ref == 'refs/heads/main' && env.DOCKERHUB_USERNAME != '' && env.DOCKERHUB_TOKEN != '' }} with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_PASSWORD }} From d4e807a86c29a5f6a8040befade4dc8666b9a27c Mon Sep 17 00:00:00 2001 From: Vylyne <94922829+Vylyne@users.noreply.github.com> Date: Wed, 1 Oct 2025 13:11:06 -0400 Subject: [PATCH 03/23] changed default uid and group id to 5000 --- Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 8239e4761..9dd933cc5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -45,8 +45,8 @@ FROM node:20-alpine ARG NUSQLITE3_DIR ARG NUSQLITE3_PATH -ARG PUID=1000 -ARG PGID=1000 +ARG PUID=5000 +ARG PGID=5000 # Install only runtime dependencies RUN apk add --no-cache --update \ From aa3a0d7bff8fab241d88fd0b160aea045101785e Mon Sep 17 00:00:00 2001 From: Vylyne <94922829+Vylyne@users.noreply.github.com> Date: Wed, 1 Oct 2025 13:12:51 -0400 Subject: [PATCH 04/23] remove --purge from apt del --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 9dd933cc5..882ebfef2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -56,7 +56,7 @@ RUN apk add --no-cache --update \ shadow \ && addgroup -g ${PGID} audiobookshelf \ && adduser -u ${PUID} -G audiobookshelf -D audiobookshelf \ - && apk del --purge shadow + && apk del shadow WORKDIR /app From 3d5eaa6577dceba313001397460d6a48e3b92890 Mon Sep 17 00:00:00 2001 From: Vylyne <94922829+Vylyne@users.noreply.github.com> Date: Wed, 1 Oct 2025 13:26:31 -0400 Subject: [PATCH 05/23] changed to reuse node user, renaming and re-iding. --- Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 882ebfef2..624d36dbb 100644 --- a/Dockerfile +++ b/Dockerfile @@ -54,8 +54,8 @@ RUN apk add --no-cache --update \ ffmpeg \ tini \ shadow \ - && addgroup -g ${PGID} audiobookshelf \ - && adduser -u ${PUID} -G audiobookshelf -D audiobookshelf \ + && groupmod -g ${PGID} -n audiobookshelf node\ + && usermod -u ${PUID} -l audiobookshelf -m node \ && apk del shadow WORKDIR /app From 71b4f70034e8d9787a3fa6b398e1461b707cf244 Mon Sep 17 00:00:00 2001 From: Vylyne <94922829+Vylyne@users.noreply.github.com> Date: Wed, 1 Oct 2025 13:29:05 -0400 Subject: [PATCH 06/23] added move home to user mod --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 624d36dbb..69b7d9cdc 100644 --- a/Dockerfile +++ b/Dockerfile @@ -55,7 +55,7 @@ RUN apk add --no-cache --update \ tini \ shadow \ && groupmod -g ${PGID} -n audiobookshelf node\ - && usermod -u ${PUID} -l audiobookshelf -m node \ + && usermod -u ${PUID} -l audiobookshelf -d audiobookshelf -m node \ && apk del shadow WORKDIR /app From 0eb1905d1f538d3d5d6ace7d9c8db48c74d8e636 Mon Sep 17 00:00:00 2001 From: Vylyne <94922829+Vylyne@users.noreply.github.com> Date: Wed, 1 Oct 2025 13:30:16 -0400 Subject: [PATCH 07/23] fixed homepath --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 69b7d9cdc..94d79ca62 100644 --- a/Dockerfile +++ b/Dockerfile @@ -55,7 +55,7 @@ RUN apk add --no-cache --update \ tini \ shadow \ && groupmod -g ${PGID} -n audiobookshelf node\ - && usermod -u ${PUID} -l audiobookshelf -d audiobookshelf -m node \ + && usermod -u ${PUID} -l audiobookshelf -d /home/audiobookshelf -m node \ && apk del shadow WORKDIR /app From 6c79d28329274aa6e32ed458454810d4f903a843 Mon Sep 17 00:00:00 2001 From: Vylyne <94922829+Vylyne@users.noreply.github.com> Date: Wed, 1 Oct 2025 13:36:04 -0400 Subject: [PATCH 08/23] making sure /config and /metadata and are world writable for --user support incase they're not bind mounted. --- Dockerfile | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 94d79ca62..02dac36b2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -56,7 +56,10 @@ RUN apk add --no-cache --update \ shadow \ && groupmod -g ${PGID} -n audiobookshelf node\ && usermod -u ${PUID} -l audiobookshelf -d /home/audiobookshelf -m node \ - && apk del shadow + && apk del shadow \ + && mkdir -p /config /metadata \ + && chown -R audiobookshelf:audiobookshelf /config /metadata \ + && chmod u=rwx,go=rw /config /metadata WORKDIR /app From ce1540e78116453574c77cf23309dd93315e7850 Mon Sep 17 00:00:00 2001 From: Vylyne <94922829+Vylyne@users.noreply.github.com> Date: Wed, 1 Oct 2025 13:38:19 -0400 Subject: [PATCH 09/23] reverted default IDs to 1000 which is what the node user is created as. Though this default for the container was root. Figured 1000 is a safer default then root and will fit most basic user setups. --- Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 02dac36b2..d55d565b3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -45,8 +45,8 @@ FROM node:20-alpine ARG NUSQLITE3_DIR ARG NUSQLITE3_PATH -ARG PUID=5000 -ARG PGID=5000 +ARG PUID=1000 +ARG PGID=1000 # Install only runtime dependencies RUN apk add --no-cache --update \ From d9e7db2b5c691f49e5e3d8e37b67930c6e9e6ee4 Mon Sep 17 00:00:00 2001 From: Vylyne <94922829+Vylyne@users.noreply.github.com> Date: Wed, 1 Oct 2025 14:02:54 -0400 Subject: [PATCH 10/23] Added Global Definition of PUID and GUID for ease of management only. --- Dockerfile | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/Dockerfile b/Dockerfile index d55d565b3..07e64939a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,9 @@ +# globally defining Arguments and Defaults ARG NUSQLITE3_DIR="/usr/local/lib/nusqlite3" ARG NUSQLITE3_PATH="${NUSQLITE3_DIR}/libnusqlite3.so" +# default Process user id and group id +ARG PUID=1000 +ARG PGID=1000 ### STAGE 0: Build client ### FROM node:20-alpine AS build-client @@ -45,8 +49,8 @@ FROM node:20-alpine ARG NUSQLITE3_DIR ARG NUSQLITE3_PATH -ARG PUID=1000 -ARG PGID=1000 +ARG PUID +ARG PGID # Install only runtime dependencies RUN apk add --no-cache --update \ @@ -59,14 +63,14 @@ RUN apk add --no-cache --update \ && apk del shadow \ && mkdir -p /config /metadata \ && chown -R audiobookshelf:audiobookshelf /config /metadata \ - && chmod u=rwx,go=rw /config /metadata + && chmod a=rws /config /metadata WORKDIR /app # Copy compiled frontend and server from build stages -COPY --from=build-client /client/dist /app/client/dist -COPY --from=build-server /server /app -COPY --from=build-server ${NUSQLITE3_PATH} ${NUSQLITE3_PATH} +COPY --chmod=755 --from=build-client /client/dist /app/client/dist +COPY --chmod=755 --from=build-server /server /app +COPY --chmod=755 --from=build-server ${NUSQLITE3_PATH} ${NUSQLITE3_PATH} EXPOSE 80 From df55e2f7e5c9cc429a1f35909e76df7db0696058 Mon Sep 17 00:00:00 2001 From: Vylyne <94922829+Vylyne@users.noreply.github.com> Date: Wed, 1 Oct 2025 14:11:42 -0400 Subject: [PATCH 11/23] rwx not rws.... --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 07e64939a..37f1879a3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -63,7 +63,7 @@ RUN apk add --no-cache --update \ && apk del shadow \ && mkdir -p /config /metadata \ && chown -R audiobookshelf:audiobookshelf /config /metadata \ - && chmod a=rws /config /metadata + && chmod a=rwx /config /metadata WORKDIR /app From fd20fb17b2c337cd17c8516b819b41d419b65982 Mon Sep 17 00:00:00 2001 From: Vylyne <94922829+Vylyne@users.noreply.github.com> Date: Wed, 1 Oct 2025 14:36:13 -0400 Subject: [PATCH 12/23] Update docker-build.yml Added Permissions Directive to control token. Switched to Github_TOKEN for package. --- .github/workflows/docker-build.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/docker-build.yml b/.github/workflows/docker-build.yml index 77d71c736..7d41b4a9f 100644 --- a/.github/workflows/docker-build.yml +++ b/.github/workflows/docker-build.yml @@ -1,6 +1,8 @@ --- name: Build and Push Docker Image - +permissions: + contents: read + packages: write on: # Allows you to run workflow manually from Actions tab workflow_dispatch: @@ -72,8 +74,8 @@ jobs: uses: docker/login-action@v3 with: registry: ghcr.io - username: ${{ github.repository_owner }} - password: ${{ secrets.GHCR_PASSWORD }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} - name: Build image uses: docker/build-push-action@v6 From 89e8411ce50abcf09318904dc7653b8c1f86b3db Mon Sep 17 00:00:00 2001 From: Vylyne <94922829+Vylyne@users.noreply.github.com> Date: Wed, 1 Oct 2025 15:12:49 -0400 Subject: [PATCH 13/23] Update docker-build.yml removed manual taging as it was causing issues when no dockerhub secrets are available. --- .github/workflows/docker-build.yml | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/.github/workflows/docker-build.yml b/.github/workflows/docker-build.yml index 7d41b4a9f..fbf237a66 100644 --- a/.github/workflows/docker-build.yml +++ b/.github/workflows/docker-build.yml @@ -6,11 +6,6 @@ permissions: on: # Allows you to run workflow manually from Actions tab workflow_dispatch: - inputs: - tags: - description: 'Docker Tag' - required: true - default: 'latest' push: branches: - main @@ -39,7 +34,7 @@ jobs: uses: docker/metadata-action@v5 with: images: | - name:${{ secrets.DOCKERHUB_USERNAME }}/audiobookshelf,enable=${{ github.ref == 'refs/heads/main' && secrets.DOCKER_HUB_USERNAME != '' && secrets.DOCKER_HUB_TOKEN != '' }} + name:${{ secrets.DOCKERHUB_USERNAME }}/audiobookshelf,enable=${{ github.ref == 'refs/heads/main' && secrets.DOCKERHUB_USERNAME != '' && secrets.DOCKERHUB_TOKEN != '' }} name:ghcr.io/${{ github.repository }},enable=true tags: | type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' }} @@ -80,7 +75,7 @@ jobs: - name: Build image uses: docker/build-push-action@v6 with: - tags: ${{ github.event.inputs.tags || steps.meta.outputs.tags }} + tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} context: . platforms: linux/amd64,linux/arm64 From b7396963726a37ee0926fe5920e94c5e874e37f9 Mon Sep 17 00:00:00 2001 From: Vylyne <94922829+Vylyne@users.noreply.github.com> Date: Wed, 1 Oct 2025 19:17:58 -0400 Subject: [PATCH 14/23] Update docker-build.yml --- .github/workflows/docker-build.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/docker-build.yml b/.github/workflows/docker-build.yml index fbf237a66..657b12a13 100644 --- a/.github/workflows/docker-build.yml +++ b/.github/workflows/docker-build.yml @@ -40,6 +40,9 @@ jobs: type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' }} type=edge,branch=master type=semver,pattern={{version}} + type=ref,event=branch + type=ref,event=pr + type=sha - name: Setup QEMU uses: docker/setup-qemu-action@v3 From a164c17d38fb730e6738832a4ec9c13bcced9c20 Mon Sep 17 00:00:00 2001 From: mikiher Date: Thu, 2 Oct 2025 13:26:05 +0300 Subject: [PATCH 15/23] Reduce provider timout to 10 secs, Shorten error message --- server/finders/BookFinder.js | 2 +- server/providers/Audible.js | 6 +++--- server/providers/AudiobookCovers.js | 4 ++-- server/providers/Audnexus.js | 6 +++--- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/server/finders/BookFinder.js b/server/finders/BookFinder.js index 2d7b57f14..6b8427c05 100644 --- a/server/finders/BookFinder.js +++ b/server/finders/BookFinder.js @@ -11,7 +11,7 @@ const { levenshteinDistance, levenshteinSimilarity, escapeRegExp, isValidASIN } const htmlSanitizer = require('../utils/htmlSanitizer') class BookFinder { - #providerResponseTimeout = 30000 + #providerResponseTimeout = 10000 constructor() { this.openLibrary = new OpenLibrary() diff --git a/server/providers/Audible.js b/server/providers/Audible.js index 18879e912..2c12ffc1a 100644 --- a/server/providers/Audible.js +++ b/server/providers/Audible.js @@ -3,7 +3,7 @@ const Logger = require('../Logger') const { isValidASIN } = require('../utils/index') class Audible { - #responseTimeout = 30000 + #responseTimeout = 10000 constructor() { this.regionMap = { @@ -106,7 +106,7 @@ class Audible { return res.data }) .catch((error) => { - Logger.error('[Audible] ASIN search error', error) + Logger.error('[Audible] ASIN search error', error.message) return null }) } @@ -158,7 +158,7 @@ class Audible { return Promise.all(res.data.products.map((result) => this.asinSearch(result.asin, region, timeout))) }) .catch((error) => { - Logger.error('[Audible] query search error', error) + Logger.error('[Audible] query search error', error.message) return [] }) } diff --git a/server/providers/AudiobookCovers.js b/server/providers/AudiobookCovers.js index 8e284fea2..9bd1f367c 100644 --- a/server/providers/AudiobookCovers.js +++ b/server/providers/AudiobookCovers.js @@ -2,7 +2,7 @@ const axios = require('axios') const Logger = require('../Logger') class AudiobookCovers { - #responseTimeout = 30000 + #responseTimeout = 10000 constructor() {} @@ -24,7 +24,7 @@ class AudiobookCovers { }) .then((res) => res?.data || []) .catch((error) => { - Logger.error('[AudiobookCovers] Cover search error', error) + Logger.error('[AudiobookCovers] Cover search error', error.message) return [] }) return items.map((item) => ({ cover: item.versions.png.original })) diff --git a/server/providers/Audnexus.js b/server/providers/Audnexus.js index 4f11a2a36..9a76dc861 100644 --- a/server/providers/Audnexus.js +++ b/server/providers/Audnexus.js @@ -55,7 +55,7 @@ class Audnexus { return this._processRequest(this.limiter(() => axios.get(authorRequestUrl))) .then((res) => res.data || []) .catch((error) => { - Logger.error(`[Audnexus] Author ASIN request failed for ${name}`, error) + Logger.error(`[Audnexus] Author ASIN request failed for ${name}`, error.message) return [] }) } @@ -82,7 +82,7 @@ class Audnexus { return this._processRequest(this.limiter(() => axios.get(authorRequestUrl.toString()))) .then((res) => res.data) .catch((error) => { - Logger.error(`[Audnexus] Author request failed for ${asin}`, error) + Logger.error(`[Audnexus] Author request failed for ${asin}`, error.message) return null }) } @@ -158,7 +158,7 @@ class Audnexus { return this._processRequest(this.limiter(() => axios.get(chaptersRequestUrl.toString()))) .then((res) => res.data) .catch((error) => { - Logger.error(`[Audnexus] Chapter ASIN request failed for ${asin}/${region}`, error) + Logger.error(`[Audnexus] Chapter ASIN request failed for ${asin}/${region}`, error.message) return null }) } From 7630dbdcb7c3fb3a64a5878265d435a715863795 Mon Sep 17 00:00:00 2001 From: mikiher Date: Thu, 2 Oct 2025 13:30:03 +0300 Subject: [PATCH 16/23] Replace cover search with streaming version --- client/components/modals/item/tabs/Cover.vue | 149 +++++++++-- server/SocketAuthority.js | 104 ++++++++ server/managers/CoverSearchManager.js | 248 +++++++++++++++++++ 3 files changed, 487 insertions(+), 14 deletions(-) create mode 100644 server/managers/CoverSearchManager.js diff --git a/client/components/modals/item/tabs/Cover.vue b/client/components/modals/item/tabs/Cover.vue index 17979f708..41cac4bc3 100644 --- a/client/components/modals/item/tabs/Cover.vue +++ b/client/components/modals/item/tabs/Cover.vue @@ -59,11 +59,13 @@
- {{ $strings.ButtonSearch }} + {{ $strings.ButtonSearch }} + {{ $strings.ButtonCancel }}
-

{{ $strings.MessageNoCoversFound }}

+

{{ $strings.MessageLoading }}

+

{{ $strings.MessageNoCoversFound }}