read vnc password and port from user home instead of env vars
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import type { ServerWebSocket } from 'bun';
|
||||
import type { Socket } from 'bun';
|
||||
import { getVncPort } from './vnc-config';
|
||||
|
||||
type WSData = { userId: number; email: string; username: string; role: string; sandboxed: boolean; sessionId?: string };
|
||||
|
||||
@@ -8,8 +9,6 @@ type VncSession = {
|
||||
pendingMessages: Buffer[];
|
||||
};
|
||||
|
||||
const VNC_PORT = Number(process.env.VNC_PORT || 5901);
|
||||
|
||||
const sessions = new Map<ServerWebSocket<WSData>, VncSession>();
|
||||
|
||||
export const desktopWebsocket = {
|
||||
@@ -19,13 +18,14 @@ export const desktopWebsocket = {
|
||||
return;
|
||||
}
|
||||
|
||||
const port = await getVncPort(ws.data.email, ws.data.role);
|
||||
const session: VncSession = { tcpSocket: null, pendingMessages: [] };
|
||||
sessions.set(ws, session);
|
||||
|
||||
try {
|
||||
const tcpSocket = await Bun.connect({
|
||||
hostname: '127.0.0.1',
|
||||
port: VNC_PORT,
|
||||
port,
|
||||
socket: {
|
||||
data(_socket, data) {
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user