This commit is contained in:
luke 2025-05-26 15:28:25 +08:00
parent 494ec867a1
commit d691e1ce85
2 changed files with 24 additions and 6 deletions

View File

@ -1,7 +1,7 @@
{ {
"manifest_version": 3, "manifest_version": 3,
"name": "渠道应用开发部知识库", "name": "渠道应用开发部知识库",
"version": "1.2", "version": "1.2.1",
"description": "通过关键词快速搜索内部文档", "description": "通过关键词快速搜索内部文档",
"permissions": ["storage"], "permissions": ["storage"],
"host_permissions": [ "host_permissions": [
@ -12,11 +12,11 @@
"service_worker": "background.js" "service_worker": "background.js"
}, },
"action": { "action": {
"default_popup": "./pages/login.html", "default_popup": "pages/index.html",
"default_icon": { "default_icon": {
"16": "./assets/icon.png", "16": "assets/icon.png",
"48": "./assets/icon.png", "48": "assets/icon.png",
"128": "./assets/icon.png" "128": "assets/icon.png"
} }
} }
} }

18
pages/index.html Normal file
View File

@ -0,0 +1,18 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8" />
<title>加载中...</title>
<script>
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);
});
</script>
</head>
<body></body>
</html>