1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
| function main(params) {
const mustHaveKeywords = ['美国', '日本', '台湾', '新加坡', 'US', 'JP', 'TW', 'SG']; const mustNotHaveKeywords = ['实验性', '香港'];
const regexParts = []; mustHaveKeywords.forEach(keyword => { const mustNotHavePart = mustNotHaveKeywords.map(k => `(?!.*${k})`).join(''); regexParts.push(`(?=.*${keyword}${mustNotHavePart}).*`); }); const regex = new RegExp(`^(${regexParts.join('|')})$`, 'i'); const rules = [ "DOMAIN-KEYWORD,cloudfare,ChatGPT", "DOMAIN-KEYWORD,openai,ChatGPT", "DOMAIN-KEYWORD,sentry,ChatGPT", "DOMAIN-SUFFIX,ai.com,ChatGPT", "DOMAIN-SUFFIX,auth0.com,ChatGPT", "DOMAIN-SUFFIX,challenges.cloudflare.com,ChatGPT", "DOMAIN-SUFFIX,client-api.arkoselabs.com,ChatGPT", "DOMAIN-SUFFIX,events.statsigapi.net,ChatGPT", "DOMAIN-SUFFIX,featuregates.org,ChatGPT", "DOMAIN-SUFFIX,identrust.com,ChatGPT", "DOMAIN-SUFFIX,ingest.sentry.io,ChatGPT", "DOMAIN-SUFFIX,intercom.io,ChatGPT", "DOMAIN-SUFFIX,intercomcdn.com,ChatGPT", "DOMAIN-SUFFIX,openai.com,ChatGPT", "DOMAIN-SUFFIX,openaiapi-site.azureedge.net,ChatGPT", "DOMAIN-SUFFIX,stripe.com,ChatGPT" ];
const proxies = params.proxies .filter(i => regex.test(i.name)) .map(e => e.name);
const groups = params["proxy-groups"];
const newGroup = { name: "ChatGPT", type: "url-test", proxies, };
if (groups.length > 1) { groups.splice(1, 0, newGroup); params.rules = rules.concat(params.rules); }
return params; }
|