From 1307c7177be9566962ab679723a904c32ea33119 Mon Sep 17 00:00:00 2001 From: Bender Date: Sat, 31 Jan 2026 10:31:08 +0000 Subject: [PATCH] fix: auto-detect cookies at default path for headless servers When cookies are copied manually to a headless server (e.g., via scp), spogo would fail with 'no cookies found' because it only checks the cookie file path if explicitly set in config. This change makes cookieSource() check for cookies at the default path even without config, enabling a simpler setup workflow: 1. Run 'spogo auth import' on a machine with browser 2. Copy cookies file to headless server 3. It just works (no config needed) This is particularly useful for: - AI assistants running on VPS/cloud servers - Raspberry Pi and home server setups - Any headless Linux environment --- internal/app/context.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/internal/app/context.go b/internal/app/context.go index 106f4b3..d586251 100644 --- a/internal/app/context.go +++ b/internal/app/context.go @@ -209,9 +209,19 @@ func (c *Context) SetSpotify(client spotify.API) { } func (c *Context) cookieSource() (cookies.Source, error) { + // Use explicit cookie path from config if set if c.Profile.CookiePath != "" { return cookies.FileSource{Path: c.Profile.CookiePath}, nil } + // Check if cookies exist at the default path (supports headless servers + // where cookies were copied manually without running auth import) + defaultPath := c.ResolveCookiePath() + if defaultPath != "" { + if _, err := os.Stat(defaultPath); err == nil { + return cookies.FileSource{Path: defaultPath}, nil + } + } + // Fall back to reading from browser browser := c.Profile.Browser if strings.TrimSpace(browser) == "" { browser = "chrome"