diff --git a/bin/vmm-lib.php b/bin/vmm-lib.php index e192046..483458e 100644 --- a/bin/vmm-lib.php +++ b/bin/vmm-lib.php @@ -1021,9 +1021,9 @@ function vmm_console_start(string $vm, string $bindHost = ''): array $bindHost = vmm_vnc_host_for_vm($vm); } - $existing = vmm_console_status($vm); - if ($existing !== null) { - return ['ok' => true] + $existing; + // always start fresh (old instances may use the credential-based layout) + if (vmm_console_status($vm) !== null) { + vmm_console_stop($vm); } $port = 0; @@ -1039,19 +1039,20 @@ function vmm_console_start(string $vm, string $bindHost = ''): array return ['ok' => false, 'error' => 'no free port in 7681-7699']; } - $user = 'vmm'; - $pass = bin2hex(random_bytes(6)); + // ttyd has no session integration, so the base path acts as a bearer token. + // This avoids the browser's basic-auth dialog blocking the embedded frame. + $token = bin2hex(random_bytes(8)); $dir = VMM_ROOT . '/state/console'; if (!is_dir($dir)) { @mkdir($dir, 0750, true); } $log = $dir . '/' . $vm . '.log'; $cmd = sprintf( - '/usr/bin/nohup %s -p %d -i %s -c %s -W /usr/bin/cu -l %s > %s 2>&1 &', + '/usr/bin/nohup %s -p %d -i %s -b %s -W /usr/bin/cu -l %s > %s 2>&1 &', escapeshellarg($ttyd['path']), $port, escapeshellarg($bindHost), - escapeshellarg($user . ':' . $pass), + escapeshellarg('/' . $token . '/'), escapeshellarg($dev), escapeshellarg($log) ); @@ -1076,10 +1077,10 @@ function vmm_console_start(string $vm, string $bindHost = ''): array 'pid' => $pid, 'port' => $port, 'host' => $bindHost, - 'user' => $user, - 'pass' => $pass, + 'token' => $token, 'device' => $dev, 'started' => time(), + 'url' => sprintf('http://%s:%d/%s/', $bindHost, $port, $token), ]; file_put_contents(vmm_console_state_file($vm), json_encode($st, JSON_PRETTY_PRINT)); return ['ok' => true] + $st; diff --git a/gui/ext/vmmngr/vmmngr.conf b/gui/ext/vmmngr/vmmngr.conf index 500b191..ae56749 100644 --- a/gui/ext/vmmngr/vmmngr.conf +++ b/gui/ext/vmmngr/vmmngr.conf @@ -1,6 +1,6 @@ { "appname": "VM Manager", - "version": "0.6.0", + "version": "0.6.1", "rootfolder": "/mnt/Daten/extensions/vmmngr", "vm_source": "auto", "bridges": ["ix0bridge"], diff --git a/gui/vmmngr_vm.php b/gui/vmmngr_vm.php index 6a123b6..6a3f87d 100644 --- a/gui/vmmngr_vm.php +++ b/gui/vmmngr_vm.php @@ -193,9 +193,10 @@ vmm_nav('dashboard'); - console öffnen - / + + +
@@ -206,18 +207,15 @@ vmm_nav('dashboard'); - + diff --git a/version.txt b/version.txt index a918a2a..ee6cdce 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -0.6.0 +0.6.1
-
- - , - - · +
+