diff --git a/_worker.js b/_worker.js index 43fd9ea..a731b0e 100644 --- a/_worker.js +++ b/_worker.js @@ -126,6 +126,18 @@ export default { console.log(请求订阅响应内容); req_data += 请求订阅响应内容[0].join('\n'); 订阅转换URL += "|" + 请求订阅响应内容[1]; + if (订阅格式 == 'base64' && !userAgent.includes('subconverter') && 请求订阅响应内容[1].includes('://')) { + subConverterUrl = `${subProtocol}://${subConverter}/sub?target=mixed&url=${encodeURIComponent(请求订阅响应内容[1])}&insert=false&config=${encodeURIComponent(subConfig)}&emoji=true&list=false&tfo=false&scv=true&fdn=false&sort=false&new_name=true`; + try { + const subConverterResponse = await fetch(subConverterUrl); + if (subConverterResponse.ok) { + const subConverterContent = await subConverterResponse.text(); + req_data += '\n' + atob(subConverterContent); + } + } catch (error) { + console.log('订阅转换请回base64失败,检查订阅转换后端是否正常运行'); + } + } } if (env.WARP) 订阅转换URL += "|" + (await ADD(env.WARP)).join("|"); @@ -138,22 +150,9 @@ export default { //去重 const uniqueLines = new Set(text.split('\n')); - let result = [...uniqueLines].join('\n'); + const result = [...uniqueLines].join('\n'); //console.log(result); - if (订阅格式 == 'base64' && !userAgent.includes('subconverter') && 订阅转换URL.includes('://')) { - subConverterUrl = `${subProtocol}://${subConverter}/sub?target=mixed&url=${encodeURIComponent(订阅转换URL)}&insert=false&config=${encodeURIComponent(subConfig)}&emoji=true&list=false&tfo=false&scv=true&fdn=false&sort=false&new_name=true`; - try { - const subConverterResponse = await fetch(subConverterUrl); - if (subConverterResponse.ok) { - const subConverterContent = await subConverterResponse.text(); - result += '\n' + atob(subConverterContent); - } - } catch (error) { - console.log('订阅转换请回base64失败,检查订阅转换后端是否正常运行'); - } - } - let base64Data; try { base64Data = btoa(result); diff --git a/wrangler.toml b/wrangler.toml index b9e2690..40cccef 100644 --- a/wrangler.toml +++ b/wrangler.toml @@ -1,4 +1,4 @@ name = "sub-worker" main = "_worker.js" -compatibility_date = "2025-07-07" +compatibility_date = "2025-07-23" keep_vars = true \ No newline at end of file