From c8cffb6111f63c1306177b2efc07d7db8acf008e Mon Sep 17 00:00:00 2001 From: Pas <74743263+Pasithea0@users.noreply.github.com> Date: Fri, 18 Apr 2025 19:46:20 -0600 Subject: [PATCH] get feb token from auth --- src/providers/embeds/fedapi.ts | 2 +- src/providers/sources/fedapi.ts | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/providers/embeds/fedapi.ts b/src/providers/embeds/fedapi.ts index 72edc55..3c73a0f 100644 --- a/src/providers/embeds/fedapi.ts +++ b/src/providers/embeds/fedapi.ts @@ -15,7 +15,7 @@ const getRegion = (): string | null => { const parsed = JSON.parse(regionData); return parsed?.state?.region ?? null; } catch (e) { - console.warn('Unable to access or parse region from localStorage:', e); + console.warn('Unable to access localStorage or parse auth data:', e); return null; } }; diff --git a/src/providers/sources/fedapi.ts b/src/providers/sources/fedapi.ts index b4d288d..ab16b32 100644 --- a/src/providers/sources/fedapi.ts +++ b/src/providers/sources/fedapi.ts @@ -4,9 +4,13 @@ import { MovieScrapeContext, ShowScrapeContext } from '@/utils/context'; const getUserToken = (): string | null => { try { - return typeof window !== 'undefined' ? window.localStorage.getItem('febbox_ui_token') : null; + if (typeof window === 'undefined') return null; + const authData = window.localStorage.getItem('__MW::auth'); + if (!authData) return null; + const parsedAuth = JSON.parse(authData); + return parsedAuth?.state?.febboxToken || null; } catch (e) { - console.warn('Unable to access localStorage:', e); + console.warn('Unable to access localStorage or parse auth data:', e); return null; } };