From 4a968f2840aa3b0fe9df28af02dfe32215abeaa8 Mon Sep 17 00:00:00 2001 From: Nirvana Date: Tue, 18 Nov 2025 13:44:02 +0100 Subject: [PATCH] Fix get_manifest --- .../providers/magenta2/provider.py | 24 ++++++++++++++----- 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/lib/streaming_providers/providers/magenta2/provider.py b/lib/streaming_providers/providers/magenta2/provider.py index e371b4c..757f92e 100644 --- a/lib/streaming_providers/providers/magenta2/provider.py +++ b/lib/streaming_providers/providers/magenta2/provider.py @@ -1277,16 +1277,28 @@ class Magenta2Provider(StreamingProvider): decoded = base64.b64decode(self.persona_token).decode('utf-8') logger.debug(f"Decoded persona token: {decoded[:100]}...") - # Split by colon to get account_uri:persona_jwt - parts = decoded.split(':', 1) + # The format is: account_uri:persona_jwt + # But account_uri contains colons (http://), so we need to split carefully - if len(parts) == 2: - persona_jwt = parts[1] + # Find the last colon (after the account URI) + last_colon_index = decoded.rfind(':') + + if last_colon_index != -1: + account_uri = decoded[:last_colon_index] + persona_jwt = decoded[last_colon_index + 1:] + + logger.debug(f"Account URI: {account_uri}") logger.debug(f"Extracted persona JWT token length: {len(persona_jwt)}") logger.debug(f"Persona JWT token preview: {persona_jwt[:50]}...") - return persona_jwt + + # Verify it's a JWT token (should start with eyJ) + if persona_jwt.startswith('eyJ'): + return persona_jwt + else: + logger.error(f"Extracted token doesn't look like a JWT: {persona_jwt[:20]}...") + return None else: - logger.error(f"Invalid persona token format - expected account_uri:persona_jwt, got {len(parts)} parts") + logger.error("No colon found in decoded persona token") logger.debug(f"Decoded token: {decoded}") return None