重构: 将油猴脚本调整为通用版本
主要改动: 1. 移除微信公众号相关配置和检测规则 2. 将 @match 改为通配符 *://*/* 支持所有网站 3. 添加注释说明如何添加自定义网站检测规则 4. 保留通义听悟作为示例 5. 强调通用性,用户可自行扩展 脚本现在是真正的通用数据同步工具,不局限于特定网站。
This commit is contained in:
@@ -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() {
|
||||
|
||||
@@ -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'
|
||||
// }
|
||||
];
|
||||
|
||||
// ==================== 核心功能 ====================
|
||||
|
||||
Reference in New Issue
Block a user