feat: Normalize Audiobookshelf base URL input and update placeholder instructions

This commit is contained in:
JB
2025-10-30 15:20:54 -07:00
parent 0906b590a6
commit 65ec77180d
2 changed files with 8 additions and 2 deletions
+6 -1
View File
@@ -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:
+2 -1
View File
@@ -432,7 +432,8 @@
</div>
<div class="field">
<label for="audiobookshelf_base_url">Base URL</label>
<input type="url" id="audiobookshelf_base_url" name="audiobookshelf_base_url" value="{{ integrations.audiobookshelf.base_url }}" placeholder="https://abs.local:13378/api">
<input type="url" id="audiobookshelf_base_url" name="audiobookshelf_base_url" value="{{ integrations.audiobookshelf.base_url }}" placeholder="https://abs.local:13378">
<p class="hint">Use the server root (no trailing <code>/api</code>); the upload requests add it automatically.</p>
</div>
<div class="field field--inline">
<div class="field__group">