diff --git a/client/userscript-template.js b/client/userscript-template.js index 3d1c42a..dac92db 100644 --- a/client/userscript-template.js +++ b/client/userscript-template.js @@ -4,8 +4,7 @@ // @version 2.0.0 // @description 一键同步 Cookie/Token 到服务器(通用版),支持可视化配置管理 // @author K-hermes -// @match https://tingwu.aliyun.com/* -// @match https://mp.weixin.qq.com/* +// @match *://*/* // @grant GM_xmlhttpRequest // @grant GM_setClipboard // @grant GM_setValue @@ -47,17 +46,21 @@ let CONFIG = loadConfig(); // ==================== 项目检测 ==================== + // 用户可以根据需要添加自己的检测规则 const PROJECT_PATTERNS = { + // 示例:通义听悟 'tingwu.aliyun.com': { project: 'tingwu', accountSelector: '.user-email, [class*="email"], [class*="account"]', loginUrl: 'https://tingwu.aliyun.com/' - }, - 'mp.weixin.qq.com': { - project: 'wechat', - accountSelector: '.account__nickname, .weui-desktop-account__name', - loginUrl: 'https://mp.weixin.qq.com/' } + // 可以在这里添加更多网站的检测规则 + // 示例格式: + // 'example.com': { + // project: '网站名称', + // accountSelector: '.username, .account', + // loginUrl: 'https://example.com/' + // } }; function detectProject() { diff --git a/clients/userscript-template.js b/clients/userscript-template.js index 0c29c5e..41bb135 100644 --- a/clients/userscript-template.js +++ b/clients/userscript-template.js @@ -58,7 +58,9 @@ let CONFIG = loadConfig(); // ==================== 项目检测规则 ==================== + // 用户可以根据需要添加自己的检测规则 const PROJECT_RULES = [ + // 示例:通义听悟 { name: 'tingwu', match: (url) => url.includes('tingwu.aliyun.com'), @@ -77,16 +79,17 @@ }, loginUrl: 'https://tingwu.aliyun.com/' }, - { - name: 'wechat', - match: (url) => url.includes('mp.weixin.qq.com'), - getAccount: () => { - const accountElement = document.querySelector('.account_info_text'); - return accountElement ? accountElement.textContent.trim() : 'admin'; - }, - loginUrl: 'https://mp.weixin.qq.com/' - }, - // 添加更多项目... + // 可以在这里添加更多网站的检测规则 + // 示例格式: + // { + // name: '网站名称', + // match: (url) => url.includes('example.com'), + // getAccount: () => { + // // 返回账号标识 + // return 'user@example.com'; + // }, + // loginUrl: 'https://example.com/login' + // } ]; // ==================== 核心功能 ====================