Skip to content

Commit

Permalink
Update _worker.js
Browse files Browse the repository at this point in the history
  • Loading branch information
cmliu committed Apr 3, 2024
1 parent 400ef13 commit c5ba488
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions _worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ export default {
if (links.charAt(0) == '|') links = links.slice(1);
if (links.charAt(links.length -1) == '|') links = links.slice(0, links.length - 1);
//console.log(links);
if (!subconverter.includes(".workers.dev") && !subconverter.includes(".pages.dev"))links = request.url;
//检测订阅转换后端非自设隐私后端将隐藏订阅源头

if ( !(token == mytoken || url.pathname == ("/"+ mytoken) || url.pathname.includes("/"+ mytoken + "?")) ) {
if ( TG == 1 && url.pathname !== "/" && url.pathname !== "/favicon.ico" ) await sendMessage("#异常访问", request.headers.get('CF-Connecting-IP'), `UA: ${userAgent}</tg-spoiler>\n域名: ${url.hostname}\n<tg-spoiler>入口: ${url.pathname + url.search}</tg-spoiler>`);
Expand Down Expand Up @@ -88,8 +90,8 @@ export default {
}

if (userAgent.includes('clash')) {

const subconverterUrl = `https://${subconverter}/sub?target=clash&url=${encodeURIComponent(links)}&insert=false&config=${encodeURIComponent(subconfig)}&emoji=true&list=false&tfo=false&scv=false&fdn=false&sort=false&new_name=true`;
//const subconverterUrl = `https://${subconverter}/sub?target=clash&url=${encodeURIComponent(request.url)}&insert=false&config=${encodeURIComponent(subconfig)}&emoji=true&list=false&tfo=false&scv=false&fdn=false&sort=false&new_name=true`;

try {
const subconverterResponse = await fetch(subconverterUrl);
Expand All @@ -114,7 +116,6 @@ export default {
}
} else if (userAgent.includes('sing-box') || userAgent.includes('singbox')) {
const subconverterUrl = `https://${subconverter}/sub?target=singbox&url=${encodeURIComponent(links)}&insert=false&config=${encodeURIComponent(subconfig)}&emoji=true&list=false&tfo=false&scv=false&fdn=false&sort=false&new_name=true`;
//const subconverterUrl = `https://${subconverter}/sub?target=singbox&url=${encodeURIComponent(request.url)}&insert=false&config=${encodeURIComponent(subconfig)}&emoji=true&list=false&tfo=false&scv=false&fdn=false&sort=false&new_name=true`;

try {
const subconverterResponse = await fetch(subconverterUrl);
Expand Down

0 comments on commit c5ba488

Please sign in to comment.