remove seed directory, clean up provisioning and sync modules

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-08 00:07:50 +00:00
co-authored by Claude Opus 4.6
parent 9578110e8b
commit 56f8da8907
86 changed files with 182 additions and 12061 deletions
+5 -19
View File
@@ -1,7 +1,7 @@
import { existsSync, mkdirSync } from 'node:fs';
import { join } from 'node:path';
import type { VncStartParams, VncSessionInfo } from '../protocol';
import { getHomeDirForRole, toShellUsername } from '@@/data-path';
import { getHomeDirForRole } from '@@/data-path';
type VncSession = {
email: string;
@@ -87,7 +87,6 @@ export async function startSession(params: VncStartParams): Promise<{ port: numb
sessions.delete(params.email);
}
const shellUsername = toShellUsername(params.username, params.email);
const homeDir = getHomeDirForRole(params.email, params.role);
const resolution = params.resolution ?? '1920x1080';
const display = findFreeDisplay();
@@ -96,21 +95,9 @@ export async function startSession(params: VncStartParams): Promise<{ port: numb
// Lazy-provision VNC environment if missing
await ensureVncEnv(homeDir);
// Spawn VNC server as the target user
// Spawn VNC server
const proc = Bun.spawn({
cmd: [
'sudo',
'-u',
shellUsername,
'vncserver',
`:${display}`,
'-geometry',
resolution,
'-depth',
'24',
'-localhost',
'yes',
],
cmd: ['vncserver', `:${display}`, '-geometry', resolution, '-depth', '24', '-localhost', 'yes'],
env: { ...process.env, HOME: homeDir },
stdout: 'pipe',
stderr: 'pipe',
@@ -130,7 +117,7 @@ export async function startSession(params: VncStartParams): Promise<{ port: numb
pid = parseInt(content.trim(), 10) || 0;
}
sessions.set(params.email, { email: params.email, username: params.username, display, port, pid });
sessions.set(params.email, { email: params.email, username: params.username ?? '', display, port, pid });
console.log(`[vnc] started session for ${params.email} on :${display} (port ${port}, pid ${pid})`);
return { port, display };
@@ -140,11 +127,10 @@ export function stopSession(email: string): void {
const session = sessions.get(email);
if (!session) return;
const shellUsername = toShellUsername(session.username, email);
const homeDir = getHomeDirForRole(email, null);
Bun.spawnSync({
cmd: ['sudo', '-u', shellUsername, 'vncserver', '-kill', `:${session.display}`],
cmd: ['vncserver', '-kill', `:${session.display}`],
env: { ...process.env, HOME: homeDir },
stdout: 'ignore',
stderr: 'ignore',