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