Skip to content

Commit b283c77

Browse files
committed
Fix alerts to read steamId from betterAuthUser like watchlist
REAL ROOT CAUSE: - Watchlist reads: chrome.storage.local.get(['betterAuthUser']).steamId - Alerts tried to read: g_steamID from page (always null on market pages) FIX: - Changed content.js to read from betterAuthUser.steamId - Now matches watchlist implementation exactly (line 109-113) - Uses the SAME auth data that watchlist uses Console logs prove this: - Watchlist: 'Found Steam ID from stored auth: 76561199094452064' ✅ - Alerts (before): 'Steam ID from page: null' ❌ - Alerts (after): Will read from betterAuthUser ✅
1 parent ff5b13a commit b283c77

1 file changed

Lines changed: 11 additions & 4 deletions

File tree

content.js

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1727,12 +1727,19 @@ function showPriceAlertDialog(floatData) {
17271727
async function setPriceAlert(itemName, targetPrice, alertType, maxFloat, floatData) {
17281728
const alertKey = `alert_${itemName}_${Date.now()}`;
17291729

1730-
// Get Steam ID from page (same as watchlist does)
1730+
// Get Steam ID from stored auth (SAME as watchlist does - line 109-113 in watchlistButton.js)
17311731
let steamId = null;
1732-
if (typeof g_steamID !== 'undefined' && g_steamID) {
1733-
steamId = g_steamID;
1732+
try {
1733+
const result = await chrome.storage.local.get(['betterAuthUser']);
1734+
if (result.betterAuthUser && result.betterAuthUser.steamId) {
1735+
steamId = result.betterAuthUser.steamId;
1736+
console.log('[Alert] Found Steam ID from stored auth:', steamId);
1737+
} else {
1738+
console.warn('[Alert] No Steam ID found in stored auth');
1739+
}
1740+
} catch (e) {
1741+
console.error('[Alert] Could not access extension storage:', e);
17341742
}
1735-
console.log('[Alert] Steam ID from page:', steamId);
17361743

17371744
try {
17381745
// Wrap chrome.runtime.sendMessage in a try-catch to handle context invalidation

0 commit comments

Comments
 (0)