Add the Config view: edit and save the settings, applied without a restart

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-20 23:31:13 +02:00
co-authored by Claude Sonnet 5.5
parent 0ccd02b3c5
commit a4ec9ad71e
25 changed files with 1168 additions and 54 deletions
+7 -4
View File
@@ -26,7 +26,8 @@ func (c *Client) Poster(images []Image, inLibrary bool) (key string, fetch func(
}
if inLibrary && img.URL != "" {
local := img.URL
return c.baseURL + "|" + local, func(ctx context.Context) ([]byte, error) {
base, _ := c.settings()
return base + "|" + local, func(ctx context.Context) ([]byte, error) {
// MediaCover has poster-250.jpg next to poster.jpg; fall back to the original.
if small := smallVariant(local); small != local {
if data, err := c.GetBytes(ctx, small); err == nil {
@@ -68,21 +69,23 @@ func (c *Client) GetBytes(ctx context.Context, ref string) ([]byte, error) {
if err != nil {
return nil, err
}
req.Header.Set("X-Api-Key", c.apiKey)
_, apiKey := c.settings()
req.Header.Set("X-Api-Key", apiKey)
return doImage(c.http, req)
}
// resolve joins a server-relative path to the base URL. Radarr/Sonarr include
// their URL base in image paths, so it must not be added twice.
func (c *Client) resolve(ref string) (string, error) {
base, err := url.Parse(c.baseURL)
baseURL, _ := c.settings()
base, err := url.Parse(baseURL)
if err != nil {
return "", err
}
if base.Path != "" && base.Path != "/" && strings.HasPrefix(ref, strings.TrimRight(base.Path, "/")+"/") {
return base.Scheme + "://" + base.Host + ref, nil
}
return c.baseURL + ref, nil
return baseURL + ref, nil
}
var imageClient = &http.Client{Timeout: 20 * time.Second}