mirror of
https://github.com/lush2020/edgetunnel.git
synced 2026-03-23 16:38:34 +08:00
@@ -27,7 +27,7 @@ export default {
|
|||||||
if (!upgradeHeader || upgradeHeader !== 'websocket') {
|
if (!upgradeHeader || upgradeHeader !== 'websocket') {
|
||||||
if (url.protocol === 'http:') return Response.redirect(url.href.replace(`http://${url.hostname}`, `https://${url.hostname}`), 301);
|
if (url.protocol === 'http:') return Response.redirect(url.href.replace(`http://${url.hostname}`, `https://${url.hostname}`), 301);
|
||||||
if (!管理员密码) return fetch(Pages静态页面 + '/noADMIN').then(r => { const headers = new Headers(r.headers); headers.set('Cache-Control', 'no-store, no-cache, must-revalidate, proxy-revalidate'); headers.set('Pragma', 'no-cache'); headers.set('Expires', '0'); return new Response(r.body, { status: 404, statusText: r.statusText, headers }); });
|
if (!管理员密码) return fetch(Pages静态页面 + '/noADMIN').then(r => { const headers = new Headers(r.headers); headers.set('Cache-Control', 'no-store, no-cache, must-revalidate, proxy-revalidate'); headers.set('Pragma', 'no-cache'); headers.set('Expires', '0'); return new Response(r.body, { status: 404, statusText: r.statusText, headers }); });
|
||||||
if (!env.KV) return fetch(Pages静态页面 + '/noKV').then(r => { const headers = new Headers(r.headers); headers.set('Cache-Control', 'no-store, no-cache, must-revalidate, proxy-revalidate'); headers.set('Pragma', 'no-cache'); headers.set('Expires', '0'); return new Response(r.body, { status: 404, statusText: r.statusText, headers }); });
|
if (env.KV && typeof env.KV.get === 'function') {
|
||||||
const 访问路径 = url.pathname.slice(1).toLowerCase();
|
const 访问路径 = url.pathname.slice(1).toLowerCase();
|
||||||
const 区分大小写访问路径 = url.pathname.slice(1);
|
const 区分大小写访问路径 = url.pathname.slice(1);
|
||||||
if (访问路径 === 加密秘钥 && 加密秘钥 !== '勿动此默认密钥,有需求请自行通过添加变量KEY进行修改') {//快速订阅
|
if (访问路径 === 加密秘钥 && 加密秘钥 !== '勿动此默认密钥,有需求请自行通过添加变量KEY进行修改') {//快速订阅
|
||||||
@@ -225,6 +225,10 @@ export default {
|
|||||||
? 'singbox'
|
? 'singbox'
|
||||||
: url.searchParams.has('surge') || ua.includes('surge')
|
: url.searchParams.has('surge') || ua.includes('surge')
|
||||||
? 'surge&ver=4'
|
? 'surge&ver=4'
|
||||||
|
: url.searchParams.has('quanx') || ua.includes('quantumult')
|
||||||
|
? 'quanx'
|
||||||
|
: url.searchParams.has('loon') || ua.includes('loon')
|
||||||
|
? 'loon'
|
||||||
: 'mixed';
|
: 'mixed';
|
||||||
|
|
||||||
if (!ua.includes('mozilla')) responseHeaders["Content-Disposition"] = `attachment; filename*=utf-8''${encodeURIComponent(config_JSON.优选订阅生成.SUBNAME)}`;
|
if (!ua.includes('mozilla')) responseHeaders["Content-Disposition"] = `attachment; filename*=utf-8''${encodeURIComponent(config_JSON.优选订阅生成.SUBNAME)}`;
|
||||||
@@ -332,6 +336,7 @@ export default {
|
|||||||
const authCookie = cookies.split(';').find(c => c.trim().startsWith('auth='))?.split('=')[1];
|
const authCookie = cookies.split(';').find(c => c.trim().startsWith('auth='))?.split('=')[1];
|
||||||
if (authCookie && authCookie == await MD5MD5(UA + 加密秘钥 + 管理员密码)) return fetch(new Request('https://speed.cloudflare.com/locations', { headers: { 'Referer': 'https://speed.cloudflare.com/' } }));
|
if (authCookie && authCookie == await MD5MD5(UA + 加密秘钥 + 管理员密码)) return fetch(new Request('https://speed.cloudflare.com/locations', { headers: { 'Referer': 'https://speed.cloudflare.com/' } }));
|
||||||
}
|
}
|
||||||
|
} else if (!envUUID) return fetch(Pages静态页面 + '/noKV').then(r => { const headers = new Headers(r.headers); headers.set('Cache-Control', 'no-store, no-cache, must-revalidate, proxy-revalidate'); headers.set('Pragma', 'no-cache'); headers.set('Expires', '0'); return new Response(r.body, { status: 404, statusText: r.statusText, headers }); });
|
||||||
} else if (管理员密码) {// ws代理
|
} else if (管理员密码) {// ws代理
|
||||||
await 反代参数获取(request);
|
await 反代参数获取(request);
|
||||||
return await 处理WS请求(request, userID);
|
return await 处理WS请求(request, userID);
|
||||||
@@ -786,7 +791,7 @@ function surge(content, url, config_JSON) {
|
|||||||
const 每行内容 = content.includes('\r\n') ? content.split('\r\n') : content.split('\n');
|
const 每行内容 = content.includes('\r\n') ? content.split('\r\n') : content.split('\n');
|
||||||
|
|
||||||
let 输出内容 = "";
|
let 输出内容 = "";
|
||||||
let realSurgePath = config_JSON.启用0RTT ? config_JSON.PATH + '?ed=2560' : config_JSON.PATH;
|
const realSurgePath = config_JSON.启用0RTT ? config_JSON.PATH + '?ed=2560' : config_JSON.PATH;
|
||||||
for (let x of 每行内容) {
|
for (let x of 每行内容) {
|
||||||
if (x.includes('= tro' + 'jan,')) {
|
if (x.includes('= tro' + 'jan,')) {
|
||||||
const host = x.split("sni=")[1].split(",")[0];
|
const host = x.split("sni=")[1].split(",")[0];
|
||||||
|
|||||||
Reference in New Issue
Block a user