From 65ec77180d69328bf204e64b3ff6d42422ab8dcb Mon Sep 17 00:00:00 2001 From: JB Date: Thu, 30 Oct 2025 15:20:54 -0700 Subject: [PATCH] feat: Normalize Audiobookshelf base URL input and update placeholder instructions --- abogen/integrations/audiobookshelf.py | 7 ++++++- abogen/web/templates/settings.html | 3 ++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/abogen/integrations/audiobookshelf.py b/abogen/integrations/audiobookshelf.py index 5fe8c53..f44c58a 100644 --- a/abogen/integrations/audiobookshelf.py +++ b/abogen/integrations/audiobookshelf.py @@ -32,7 +32,12 @@ class AudiobookshelfConfig: base = (self.base_url or "").strip() if not base: raise ValueError("Audiobookshelf base URL is required") - return base[:-1] if base.endswith("/") else base + normalized = base.rstrip("/") + # The web UI historically suggested including '/api' in the base URL; trim + # it here so we can safely append `/api/...` endpoints below. + if normalized.lower().endswith("/api"): + normalized = normalized[:-4] + return normalized or base class AudiobookshelfClient: diff --git a/abogen/web/templates/settings.html b/abogen/web/templates/settings.html index c3ecddb..dc721d8 100644 --- a/abogen/web/templates/settings.html +++ b/abogen/web/templates/settings.html @@ -432,7 +432,8 @@
- + +

Use the server root (no trailing /api); the upload requests add it automatically.