diff --git a/src/worker-vless.js b/src/worker-vless.js index 846129ba7..d482e5d36 100644 --- a/src/worker-vless.js +++ b/src/worker-vless.js @@ -31,11 +31,32 @@ export default { case '/': return new Response(JSON.stringify(request.cf), { status: 200 }); case `/${userID}`: { - const vlessConfig = getVLESSConfig(userID, request.headers.get('Host')); - return new Response(`${vlessConfig}`, { + const [vlessMain, vlessConfig] = getVLESSConfig(userID, request.headers.get('Host')); + const html = ` + + connect info + + + +

scan qrcode to connect.

+ +
+ +
+ + + +
+ +
${vlessConfig}
+ + `; + return new Response(`${html}`, { status: 200, headers: { - "Content-Type": "text/plain;charset=utf-8", + "content-type": "text/html;charset=UTF-8", } }); } @@ -600,8 +621,8 @@ async function handleUDPOutBound(webSocket, vlessResponseHeader, log) { * @returns {string} */ function getVLESSConfig(userID, hostName) { - const vlessMain = `vless://${userID}\u0040${hostName}:443?encryption=none&security=tls&sni=${hostName}&fp=randomized&type=ws&host=${hostName}&path=%2F%3Fed%3D2048#${hostName}` - return ` + const vlessMain = `vless://${userID}@${hostName}:443?encryption=none&security=tls&sni=${hostName}&fp=randomized&type=ws&host=${hostName}&path=%2F%3Fed%3D2048#${hostName}`; + const result = ` ################################################################ v2ray --------------------------------------------------------------- @@ -611,21 +632,21 @@ ${vlessMain} clash-meta --------------------------------------------------------------- - type: vless - name: ${hostName} - server: ${hostName} - port: 443 - uuid: ${userID} - network: ws - tls: true - udp: false - sni: ${hostName} - client-fingerprint: chrome - ws-opts: - path: "/?ed=2048" - headers: - host: ${hostName} +name: ${hostName} +server: ${hostName} +port: 443 +uuid: ${userID} +network: ws +tls: true +udp: false +sni: ${hostName} +client-fingerprint: chrome +ws-opts: + path: "/?ed=2048" + headers: + host: ${hostName} --------------------------------------------------------------- ################################################################ `; + return [vlessMain, result]; } -