From da932f918ade488a9f20bd5cf1d04ff15d8c30e5 Mon Sep 17 00:00:00 2001 From: HighImKevin Date: Fri, 16 Oct 2026 13:09:10 -0400 Subject: [PATCH] Fix requests firing before user is logged in --- helpers/dataHelper.js | 5 +++++ scripts/utils.js | 7 ------- scripts/watchlist.js | 4 ++++ 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/helpers/dataHelper.js b/helpers/dataHelper.js index dea5cbe..d28277e 100644 --- a/helpers/dataHelper.js +++ b/helpers/dataHelper.js @@ -267,6 +267,11 @@ async function initialize() { ensureApiClient(); + + // Wait for login + if (window.userHelper?.waitForLogin) { + await window.userHelper.waitForLogin(); + } if (__libraries) { return; diff --git a/scripts/utils.js b/scripts/utils.js index 49c7026..e0df982 100644 --- a/scripts/utils.js +++ b/scripts/utils.js @@ -3000,13 +3000,6 @@ window.KefinTweaksConfig = ${JSON.stringify(config, null, 2)};`; const hash = String(window.location.hash || ''); let watchlistUrl = activePageWatchlistUrl || window.KefinTweaksUtils?._watchlistUrl || null; - if (!watchlistUrl) { - getWatchlistUrl().then((url) => { - activePageWatchlistUrl = url; - updateActivePage(); - }).catch(() => { /* ignore */ }); - } - let page = ''; const tabMatch = hash.match(/[?&]tab=(\d+)/); const tabIndex = tabMatch ? tabMatch[1] : null; diff --git a/scripts/watchlist.js b/scripts/watchlist.js index 245b5b1..ea61b1e 100644 --- a/scripts/watchlist.js +++ b/scripts/watchlist.js @@ -7637,6 +7637,10 @@ In the Custom Tabs plugin, add a new tab with the following HTML content: }; const run = async () => { + if (window.userHelper?.waitForLogin) { + await window.userHelper.waitForLogin(); + } + await addCustomWatchlistPage(); await addCustomMenuLink(); await addWatchlistPageHandler();