fixed members login and permissions issues

This commit is contained in:
2026-02-23 00:57:34 +00:00
parent ed0debfeac
commit 97da2e2736
42 changed files with 574 additions and 113 deletions
+2 -1
View File
@@ -15,6 +15,7 @@ const { PORT = '5000' } = process.env;
type WSData = {
userId: number;
email: string;
username: string;
role: string;
provider: 'terminal' | 'pi' | 'dev-server';
sandboxed: boolean;
@@ -106,7 +107,7 @@ async function upgradeWs(req: Request, server: any, provider: 'terminal' | 'pi')
const cols = url.searchParams.get('cols') ? Number(url.searchParams.get('cols')) : undefined;
const rows = url.searchParams.get('rows') ? Number(url.searchParams.get('rows')) : undefined;
const ok = server.upgrade(req, {
data: { userId: user.id, email: user.email, role: user.role, provider, sandboxed, sessionId, cwd, command, cols, rows },
data: { userId: user.id, email: user.email, username: user.username || user.email.split('@')[0]!, role: user.role, provider, sandboxed, sessionId, cwd, command, cols, rows },
});
if (!ok) return new Response('Upgrade failed', { status: 500 });
} catch {