From ace4d2d620b73d5f57b5ad956de8339b6aeca945 Mon Sep 17 00:00:00 2001 From: xion Date: Mon, 7 Oct 2024 23:26:44 +0800 Subject: [PATCH] fix: fix no end '/' and set redirect --- src/module/index.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/module/index.ts b/src/module/index.ts index 27f9472..e1af253 100644 --- a/src/module/index.ts +++ b/src/module/index.ts @@ -76,6 +76,11 @@ export const handleRequest = async (req: http.IncomingMessage, res: http.ServerR return res.end(); } const [_, _user, _app] = urls; + if (_app && urls.length === 3) { + // 重定向到 + res.writeHead(302, { Location: `${url}/` }); + return res.end(); + } if (!_user || !_app) { res.write('Invalid URL\n'); return res.end();