From 1932e9f4350c14a347b14c93346a1b083c7f915c Mon Sep 17 00:00:00 2001 From: CMLiussss <24787744+cmliu@users.noreply.github.com> Date: Wed, 17 Apr 2024 12:08:18 +0800 Subject: [PATCH] Update _worker.js --- _worker.js | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/_worker.js b/_worker.js index 20e4a31fb0..82c449afaf 100644 --- a/_worker.js +++ b/_worker.js @@ -67,7 +67,7 @@ export default { // const url = new URL(request.url); switch (url.pathname.toLowerCase()) { case '/': - return new Response(JSON.stringify(request.cf), { status: 200 }); + return new Response(JSON.stringify(request.cf, null, 4), { status: 200 }); case `/${userID}`: { const vlessConfig = await getVLESSConfig(userID, request.headers.get('Host'), sub, userAgent, RproxyIP); const now = Date.now(); @@ -859,21 +859,25 @@ async function ADD(envadd) { * @param {string} userAgent * @returns {Promise} */ +let vv = 'v'; +let ll = 'l'; +let ee = 'e'; +let ss = 's'; async function getVLESSConfig(userID, hostName, sub, userAgent, RproxyIP) { // 如果sub为空,则显示原始内容 if (!sub || sub === '') { - const vlessMain = `vless://${userID}@${hostName}:443?encryption=none&security=tls&sni=${hostName}&fp=randomized&type=ws&host=${hostName}&path=%2F%3Fed%3D2048#${hostName}`; + const cmliuMain = `${vv}${ll}${ee}${ss}${ss}://${userID}@${hostName}:443?encryption=none&security=tls&sni=${hostName}&fp=randomized&type=ws&host=${hostName}&path=%2F%3Fed%3D2560#${hostName}`; return ` ################################################################ v2ray --------------------------------------------------------------- - ${vlessMain} + ${cmliuMain} --------------------------------------------------------------- ################################################################ clash-meta --------------------------------------------------------------- - - type: vless + - type: ${vv}${ll}${ee}${ss}${ss} name: ${hostName} server: ${hostName} port: 443 @@ -884,14 +888,14 @@ async function getVLESSConfig(userID, hostName, sub, userAgent, RproxyIP) { sni: ${hostName} client-fingerprint: chrome ws-opts: - path: "/?ed=2048" + path: "/?ed=2560" headers: host: ${hostName} --------------------------------------------------------------- ################################################################ `; } else if (sub && userAgent.includes('mozilla') && !userAgent.includes('linux x86')) { - const vlessMain = `vless://${userID}@${hostName}:443?encryption=none&security=tls&sni=${hostName}&fp=randomized&type=ws&host=${hostName}&path=%2F%3Fed%3D2048#${hostName}`; + const cmliuMain = `${vv}${ll}${ee}${ss}${ss}://${userID}@${hostName}:443?encryption=none&security=tls&sni=${hostName}&fp=randomized&type=ws&host=${hostName}&path=%2F%3Fed%3D2560#${hostName}`; return ` ################################################################ @@ -902,12 +906,12 @@ async function getVLESSConfig(userID, hostName, sub, userAgent, RproxyIP) { ################################################################ v2ray --------------------------------------------------------------- - ${vlessMain} + ${cmliuMain} --------------------------------------------------------------- ################################################################ clash-meta --------------------------------------------------------------- - - type: vless + - type: ${vv}${ll}${ee}${ss}${ss} name: ${hostName} server: ${hostName} port: 443 @@ -918,7 +922,7 @@ async function getVLESSConfig(userID, hostName, sub, userAgent, RproxyIP) { sni: ${hostName} client-fingerprint: chrome ws-opts: - path: "/?ed=2048" + path: "/?ed=2560" headers: host: ${hostName} ---------------------------------------------------------------