2025-06-01 11:34:10 +08:00

9 lines
325 B
JavaScript

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);
});