diff --git a/.env.example b/.env.example deleted file mode 100644 index 32d6eab..0000000 --- a/.env.example +++ /dev/null @@ -1,4 +0,0 @@ -NOCODB_TOKEN= -NOCODB_LIST_URL=https://nocodb.example.com/api/v2/tables/xxx/records -NOCODB_FIELD_ID=账号ID -NOCODB_FIELD_ALIAS=_最终输出 \ No newline at end of file diff --git a/README.md b/README.md index 93b6eaa..fbbf5e3 100644 --- a/README.md +++ b/README.md @@ -2,4 +2,4 @@ 给 Microsoft Teams 好友的名称添加别名。 -使用 NocoDB 数据库获取数据。修改 .env 之后别忘了修改 manifest.json 中的 host_permissions +在插件弹窗中导入 CSV 文件作为数据源。CSV 需要包含“账号ID”和“最终输出”两列,插件会用“账号ID”匹配 Teams 用户,并显示对应的“最终输出”。 diff --git a/content.js b/content.js index 8a6088f..d3e4c88 100644 --- a/content.js +++ b/content.js @@ -397,25 +397,6 @@ function init() { subtree: true, }); - // 自动同步检查 - chrome.storage.local.get('lastSync').then(({ lastSync }) => { - const now = Date.now(); - // 24 小时 = 86400000 ms - if (!lastSync || (now - lastSync > 86400000)) { - console.log("Teams Alias: 正在进行后台同步..."); - if (typeof fetchAliasesFromDB === 'function') { - fetchAliasesFromDB().then(aliases => { - chrome.storage.local.set({ aliases, lastSync: now }); - console.log("Teams Alias: 自动同步成功"); - }).catch(err => { - console.error("Teams Alias: 自动同步失败", err); - }); - } else { - console.warn("Teams Alias: fetchAliasesFromDB 未定义,无法同步。"); - } - } - }); - applyToAll(); // 初始执行 // 兜底:每 2 秒再扫一次(避免漏掉异步更新) diff --git a/manifest.json b/manifest.json index 2ccd143..f299299 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "manifest_version": 3, "name": "Teams 别名管理", - "version": "0.2.0", + "version": "0.4.0", "icons": { "16": "icons/teams-alias-16.png", "32": "icons/teams-alias-32.png", @@ -9,15 +9,14 @@ "128": "icons/teams-alias-128.png" }, "description": "给 Teams 好友设置别名", - "permissions": ["storage", "scripting"], + "permissions": ["storage"], "host_permissions": [ - "https://teams.live.com/v2*", - "https://nocodb.example.com/*" + "https://teams.live.com/v2*" ], "content_scripts": [ { "matches": ["https://teams.live.com/v2*"], - "js": ["env.js", "utils.js", "content.js"] + "js": ["content.js"] } ], "action": { diff --git a/package-lock.json b/package-lock.json index 222a5bf..8f1847f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "teams-alias", - "version": "0.1.0", + "version": "0.4.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "teams-alias", - "version": "0.1.0", + "version": "0.4.0", "license": "GPL-3.0-only", "dependencies": { "chrome-types": "^0.1.347" diff --git a/package.json b/package.json index 88dd897..620b244 100644 --- a/package.json +++ b/package.json @@ -1,9 +1,8 @@ { "name": "teams-alias", - "version": "0.2.0", + "version": "0.4.0", "main": "index.js", "scripts": { - "build": "node scripts/generate-env.js", "test": "echo \"Error: no test specified\" && exit 1" }, "author": "", diff --git a/popup.html b/popup.html index 22e8cc7..fd3335b 100644 --- a/popup.html +++ b/popup.html @@ -8,7 +8,7 @@ background-color: #f9fafb; margin: 0; padding: 12px; - width: 120px; + width: 160px; color: #111827; } @@ -50,15 +50,25 @@ #fileInput { display: none; } + + #status { + margin-top: 8px; + min-height: 15px; + font-size: 11px; + line-height: 1.35; + color: #4b5563; + text-align: center; + word-break: break-word; + }