Fix Tidal device-auth link opening SoulSync instead of link.tidal.com

The "Link Tidal Account" device-flow UI displayed a verification URL
like `link.tidal.com/XBXYT` that, when clicked, navigated back to the
SoulSync origin (e.g. `http://localhost:8889/link.tidal.com/XBXYT`)
instead of to Tidal's activation page.

Root cause: tidalapi returns `login.verification_uri_complete` as a
schemeless string. settings.js drops it straight into `<a href>`, and
browsers treat schemeless hrefs as same-origin relative URLs.

Normalize the URI in `start_device_auth` — if it doesn't already
start with `http://` or `https://`, prepend `https://`. Same
treatment for the `link.tidal.com/{user_code}` fallback so the
defensive path stays well-formed too.
pull/376/head
Broque Thomas 1 month ago
parent c4d81c0904
commit b3afed1599

@ -265,8 +265,16 @@ class TidalDownloadClient:
login, future = self.session.login_oauth()
self._device_auth_future = future
# tidalapi returns `verification_uri_complete` as a schemeless
# string like `link.tidal.com/ABCDE`. Passing that straight to
# an <a href> makes the browser treat it as a relative URL and
# route it back to the SoulSync origin, so normalize to a
# full https:// URL here.
raw_uri = login.verification_uri_complete or f"link.tidal.com/{login.user_code}"
if not raw_uri.startswith(('http://', 'https://')):
raw_uri = f"https://{raw_uri}"
self._device_auth_link = {
'verification_uri': login.verification_uri_complete or f"https://link.tidal.com/{login.user_code}",
'verification_uri': raw_uri,
'user_code': login.user_code,
}
logger.info(f"Tidal device auth started — code: {login.user_code}")

Loading…
Cancel
Save