enhance 401 page for deno

This commit is contained in:
zizifn
2022-12-18 02:49:18 +08:00
committed by zizifn
parent a811bfc72f
commit ea13ab727d
2 changed files with 32 additions and 1 deletions

View File

@@ -0,0 +1,28 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>401</title>
</head>
<body>
<h1>not set valid UUID in Environment Variables.</h1>
<h2>Please use tool to generate UUID or use this one <span style="color: blue;" id="uuidSpan"></span></h2>
<h3>Please refer to <a
href="https://github.com/zizifn/edgetunnel/blob/main/doc/edge-tunnel-deno.md#%E6%B5%81%E7%A8%8B%E6%BC%94%E7%A4%BA">deno
deploy guide</a>
</h3>
<h3>Or maybe check below GIF</h3>
<img src="https://raw.githubusercontent.com/zizifn/edgetunnel/main/doc/deno-deploy2.gif" alt="guide" srcset="">
<script>
let uuid = URL.createObjectURL(new Blob([])).substr(-36);
document.getElementById('uuidSpan').textContent = uuid
</script>
</body>
</html>

View File

@@ -11,7 +11,10 @@ if (!isVaildUser) {
const handler = async (req: Request): Promise<Response> => {
if (!isVaildUser) {
return new Response(`not set valid UUID in Environment Variables`, {
const index401 = await Deno.readFile(
`${Deno.cwd()}/apps/deno-vless/src/deno/401.html`
);
return new Response(index401, {
status: 401,
headers: {
'content-type': 'text/html; charset=utf-8',