重构: 将油猴脚本调整为通用版本
主要改动: 1. 移除微信公众号相关配置和检测规则 2. 将 @match 改为通配符 *://*/* 支持所有网站 3. 添加注释说明如何添加自定义网站检测规则 4. 保留通义听悟作为示例 5. 强调通用性,用户可自行扩展 脚本现在是真正的通用数据同步工具,不局限于特定网站。
This commit is contained in:
@@ -4,8 +4,7 @@
|
|||||||
// @version 2.0.0
|
// @version 2.0.0
|
||||||
// @description 一键同步 Cookie/Token 到服务器(通用版),支持可视化配置管理
|
// @description 一键同步 Cookie/Token 到服务器(通用版),支持可视化配置管理
|
||||||
// @author K-hermes
|
// @author K-hermes
|
||||||
// @match https://tingwu.aliyun.com/*
|
// @match *://*/*
|
||||||
// @match https://mp.weixin.qq.com/*
|
|
||||||
// @grant GM_xmlhttpRequest
|
// @grant GM_xmlhttpRequest
|
||||||
// @grant GM_setClipboard
|
// @grant GM_setClipboard
|
||||||
// @grant GM_setValue
|
// @grant GM_setValue
|
||||||
@@ -47,17 +46,21 @@
|
|||||||
let CONFIG = loadConfig();
|
let CONFIG = loadConfig();
|
||||||
|
|
||||||
// ==================== 项目检测 ====================
|
// ==================== 项目检测 ====================
|
||||||
|
// 用户可以根据需要添加自己的检测规则
|
||||||
const PROJECT_PATTERNS = {
|
const PROJECT_PATTERNS = {
|
||||||
|
// 示例:通义听悟
|
||||||
'tingwu.aliyun.com': {
|
'tingwu.aliyun.com': {
|
||||||
project: 'tingwu',
|
project: 'tingwu',
|
||||||
accountSelector: '.user-email, [class*="email"], [class*="account"]',
|
accountSelector: '.user-email, [class*="email"], [class*="account"]',
|
||||||
loginUrl: 'https://tingwu.aliyun.com/'
|
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() {
|
function detectProject() {
|
||||||
|
|||||||
@@ -58,7 +58,9 @@
|
|||||||
let CONFIG = loadConfig();
|
let CONFIG = loadConfig();
|
||||||
|
|
||||||
// ==================== 项目检测规则 ====================
|
// ==================== 项目检测规则 ====================
|
||||||
|
// 用户可以根据需要添加自己的检测规则
|
||||||
const PROJECT_RULES = [
|
const PROJECT_RULES = [
|
||||||
|
// 示例:通义听悟
|
||||||
{
|
{
|
||||||
name: 'tingwu',
|
name: 'tingwu',
|
||||||
match: (url) => url.includes('tingwu.aliyun.com'),
|
match: (url) => url.includes('tingwu.aliyun.com'),
|
||||||
@@ -77,16 +79,17 @@
|
|||||||
},
|
},
|
||||||
loginUrl: 'https://tingwu.aliyun.com/'
|
loginUrl: 'https://tingwu.aliyun.com/'
|
||||||
},
|
},
|
||||||
{
|
// 可以在这里添加更多网站的检测规则
|
||||||
name: 'wechat',
|
// 示例格式:
|
||||||
match: (url) => url.includes('mp.weixin.qq.com'),
|
// {
|
||||||
getAccount: () => {
|
// name: '网站名称',
|
||||||
const accountElement = document.querySelector('.account_info_text');
|
// match: (url) => url.includes('example.com'),
|
||||||
return accountElement ? accountElement.textContent.trim() : 'admin';
|
// getAccount: () => {
|
||||||
},
|
// // 返回账号标识
|
||||||
loginUrl: 'https://mp.weixin.qq.com/'
|
// return 'user@example.com';
|
||||||
},
|
// },
|
||||||
// 添加更多项目...
|
// loginUrl: 'https://example.com/login'
|
||||||
|
// }
|
||||||
];
|
];
|
||||||
|
|
||||||
// ==================== 核心功能 ====================
|
// ==================== 核心功能 ====================
|
||||||
|
|||||||
Reference in New Issue
Block a user