diff --git a/bin/vmm-lib.php b/bin/vmm-lib.php index 7fdd587..b8c9a99 100644 --- a/bin/vmm-lib.php +++ b/bin/vmm-lib.php @@ -826,6 +826,27 @@ function vmm_delete_data_file(string $dir, string $name): array : ['ok' => false, 'error' => 'cannot delete']; } +/** + * Turn a bhyve VNC bind address ("0.0.0.0:5901") into something a human can + * actually connect to. 0.0.0.0 is a listen address, not a destination. + */ +function vmm_vnc_connect(string $bind): string +{ + $bind = trim($bind); + if ($bind === '' || $bind === '-') { + return ''; + } + [$host, $port] = array_pad(explode(':', $bind, 2), 2, ''); + $port = (int)$port; + if ($port <= 0) { + return ''; + } + if ($host === '0.0.0.0' || $host === '' || $host === '*') { + $host = trim((string)@shell_exec('hostname -f 2>/dev/null')) ?: (gethostname() ?: 'localhost'); + } + return $host . ':' . $port; +} + function vmm_vm_conf_path(string $name): string { $dir = vmm_data_dir(''); diff --git a/gui/ext/vmmngr/vmmngr.conf b/gui/ext/vmmngr/vmmngr.conf index 83827cf..fae2e02 100644 --- a/gui/ext/vmmngr/vmmngr.conf +++ b/gui/ext/vmmngr/vmmngr.conf @@ -1,6 +1,6 @@ { "appname": "VM Manager", - "version": "0.4.1", + "version": "0.4.2", "rootfolder": "/mnt/Daten/extensions/vmmngr", "vm_source": "auto", "bridges": ["ix0bridge"], diff --git a/gui/vmmngr_vm.php b/gui/vmmngr_vm.php index 067348d..9fb0a21 100644 --- a/gui/vmmngr_vm.php +++ b/gui/vmmngr_vm.php @@ -133,6 +133,36 @@ vmm_nav('dashboard'); + + + + + + + + + + + + + + + +
VNC + vnc:// + : +
+
cu -l /dev/nmdm-.1B
+ +