feat: 按域名授权、iframe 多帧填充、自动提交限流修正,并补齐工程规范与文档

安全与权限:
- 站点访问权限改为 optional_host_permissions,保存配置时逐域名授权;移除 host_permissions 与 tabs,安装提示不再出现全站数据访问与浏览记录
- 主口令不再写入 storage.session,改用 IndexedDB 中不可导出的 CryptoKey 句柄恢复解锁,锁定即丢弃
- content script 注入范围只注册已授权域名,并随权限变化即时收敛

自动登录:
- 支持 iframe 内的登录表单:脚本注入所有帧,逐帧按自身地址匹配配置
- 手动填充改为逐帧探测,定向发送到真正含密码框的帧
- 限流修正:只在真正触发提交后计数;判定登录成功后立即清零;达到上限时页面给出可见提示;重置判断只看启用中的配置
- SPA 重试改为 DOM 变更门控 + 退避,并单独监听已发现的 Shadow Root

工程化与文档:
- 引入 ESLint(扁平配置)与 Prettier,CI 增加 lint 与 format:check
- 信息类日志改为 debugLog(默认静默,chrome.storage.local.debugLog 开关)
- 测试 123 → 128 用例(新增权限、iframe、限流相关用例)
- README / PRIVACY / CHANGELOG 同步
This commit is contained in:
陈银军
2026-09-18 00:05:20 +08:00
parent 8883a5c506
commit 1b0c3c012c
48 changed files with 3364 additions and 680 deletions
+56
View File
@@ -0,0 +1,56 @@
// ESLint 扁平配置(flat config)
// 目标:抓住真正会出问题的东西(未使用变量、隐式 any 之外的常见错误、可选链缺失等),
// 而不与 tsc --strict 的职责重叠,也不与 Prettier 的格式化职责重叠。
import js from "@eslint/js";
import tseslint from "typescript-eslint";
import globals from "globals";
export default [
{ ignores: ["dist/**", "release/**", "node_modules/**"] },
js.configs.recommended,
...tseslint.configs.recommended,
{
// 扩展源码 + 测试:浏览器 / Worker 与扩展 API 全局量
files: ["src/**/*.ts", "tests/**/*.js"],
languageOptions: {
globals: {
...globals.browser,
...globals.node,
chrome: "readonly",
importScripts: "readonly",
},
},
rules: {
// 类型由 tsc 负责:ESLint 侧关掉会与 tsc 重复或产生大量噪音的规则
"no-undef": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-non-null-assertion": "off",
// 真正的痛点:未使用的变量 / 参数 / 导入
"@typescript-eslint/no-unused-vars": [
"error",
{
argsIgnorePattern: "^_",
varsIgnorePattern: "^_",
caughtErrors: "none", // 故意忽略异常的 catch 很常见(如探测性调用)
},
],
"no-empty": ["error", { allowEmptyCatch: true }],
"no-var": "error",
"prefer-const": "error",
"no-console": "off", // 项目统一用 debugLog / console.warn,交由 utils.initDebugLog 控制
},
},
{
// 测试文件按 CommonJS 编写(需 require dist/ 下的产物),允许 require
files: ["tests/**/*.js"],
rules: { "@typescript-eslint/no-require-imports": "off" },
},
{
files: ["scripts/**/*.mjs"],
languageOptions: { globals: { ...globals.node } },
},
];