loadMergedConfig().then(config => { chrome.storage.local.get(["token", "loginAt"], (res) => { const expireMs = config.tokenExpireHours * 60 * 60 * 1000; const now = Date.now(); const popup = (!res.token || !res.loginAt || (now - res.loginAt > expireMs)) ? "pages/login.html" : "pages/popup.html"; window.location.href = chrome.runtime.getURL(popup); }); });