mirror of
https://github.com/lush2020/edgetunnel.git
synced 2026-03-24 09:08:16 +08:00
add default uuid
This commit is contained in:
@@ -197,15 +197,29 @@ var cf_worker_vless_default = {
|
||||
async fetch(request, env, ctx) {
|
||||
let address = "";
|
||||
let portWithRandomLog = "";
|
||||
const userID = env.UUID;
|
||||
const userID = env.UUID || "7f14e42a-f453-4c39-a762-019ee493237d";
|
||||
const isVaildUUID = validate_default(userID);
|
||||
const log = (info, event) => {
|
||||
console.log(`[${address}:${portWithRandomLog}] ${info}`, event || "");
|
||||
};
|
||||
const upgradeHeader = request.headers.get("Upgrade");
|
||||
if (!upgradeHeader || upgradeHeader !== "websocket") {
|
||||
return new Response(`Expected Upgrade: websocket--uuid--${userID}`, {
|
||||
status: 426
|
||||
});
|
||||
return new Response(
|
||||
`<html>
|
||||
<head><title>404 Not Found</title></head>
|
||||
<body>
|
||||
<center><h1>404 Not Found ${isVaildUUID ? "_-_" : ""}</h1></center>
|
||||
<hr><center>nginx/1.23.4</center>
|
||||
</body>
|
||||
</html>`,
|
||||
{
|
||||
status: 404,
|
||||
headers: {
|
||||
"content-type": "text/html; charset=utf-8",
|
||||
"WWW-Authenticate": "Basic"
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
const webSocketPair = new WebSocketPair();
|
||||
const [client, webSocket] = Object.values(webSocketPair);
|
||||
|
||||
Reference in New Issue
Block a user