add new socks5 update

This commit is contained in:
KingKDot
2026-03-15 16:14:50 -05:00
parent d4934e282d
commit de9b986972
21 changed files with 1087 additions and 717 deletions
@@ -381,22 +381,19 @@ export async function handlePageRoutes(
}
}
const proxyPageMatch = url.pathname.match(/^\/(.+)\/proxy$/);
if (req.method === "GET" && proxyPageMatch) {
if (req.method === "GET" && url.pathname === "/socks5-manager") {
const user = await authenticateRequest(req);
if (!user) {
return serveLoginOrUnauthorized(deps);
}
if (user.role === "viewer") {
return new Response("Forbidden: Viewers cannot access interactive features", { status: 403 });
}
if (!canAccessClientPage(user.userId, user.role, proxyPageMatch[1])) {
return new Response("Forbidden: Client access denied", { status: 403 });
}
const file = Bun.file(`${deps.PUBLIC_ROOT}/proxy.html`);
const maybeChange = await serveChangePasswordIfRequired(deps, user.userId);
if (maybeChange) return maybeChange;
const file = Bun.file(`${deps.PUBLIC_ROOT}/socks5-manager.html`);
if (await file.exists()) {
return new Response(file, { headers: deps.secureHeaders(deps.mimeType("proxy.html")) });
return new Response(file, { headers: deps.secureHeaders(deps.mimeType("socks5-manager.html")) });
}
}