0.6.0: noVNC graphical console (websockify + novnc, iframe, auto-stop)

This commit is contained in:
Claw committed 2026-11-17 20:56:06 +01:00
1 parent 53332d9a07
commit 21c259ec4f
5 files changed
+177 -2

No files matched your search

+1 -1
View File
@@ -1,6 +1,6 @@
{
"appname": "VM Manager",
"version": "0.5.1",
"version": "0.6.0",
"rootfolder": "/mnt/Daten/extensions/vmmngr",
"vm_source": "auto",
"bridges": ["ix0bridge"],
+45
View File
@@ -24,6 +24,20 @@ if (strtoupper((string)($_SERVER['REQUEST_METHOD'] ?? '')) === 'POST' && isset($
$vmName = $name;
}
if ($verb === 'novnc_start' || $verb === 'novnc_stop') {
if ($verb === 'novnc_stop') {
vmm_novnc_stop($name);
$_SESSION['vmmngr_error'] = gettext('noVNC stopped.');
} else {
$res = vmm_novnc_start($name);
$_SESSION['vmmngr_error'] = $res['ok']
? sprintf(gettext('noVNC on http://%s:%d'), $res['host'], $res['port'])
: (string)$res['error'];
}
header('Location: vmmngr_vm.php?name=' . urlencode($name));
exit;
}
if ($verb === 'console_start') {
$res = vmm_console_start($name);
$_SESSION['vmmngr_error'] = $res['ok']
@@ -211,6 +225,37 @@ vmm_nav('dashboard');
</tbody>
</table>
<?php endif; ?>
<?php $nv = vmm_novnc_ready(); $nvSt = vmm_novnc_status($name); ?>
<table class="area_data_settings" style="width:100%;border-collapse:collapse;">
<colgroup><col class="area_data_settings_col_tag"><col class="area_data_settings_col_data"></colgroup>
<thead><?php html_separator2(); html_titleline2(gettext('Graphical console (noVNC)'), 2); ?></thead>
<tbody>
<tr>
<td class="celltag"><?=gettext('Status');?></td>
<td class="celldata">
<?php if (!$nv['ok']): ?>
<span class="vmm-miss"><?=gettext('not installed');?></span>
<span class="vmm-mono" style="margin-left:8px;">pkg install novnc py312-websockify</span>
<?php elseif ($nvSt !== null): ?>
<a class="formbtn" href="<?=vmm_h('http://' . $nvSt['host'] . ':' . (int)$nvSt['port'] . '/vnc.html?autoconnect=1&resize=scale&path=websockify');?>" target="_blank"><?=gettext('open in a tab');?></a>
<button type="submit" class="formbtn" name="act" value="novnc_stop:<?=vmm_h($name);?>" style="margin-left:8px;"><?=gettext('Stop');?></button>
<div style="opacity:.75;margin-top:4px;"><?=gettext('Serves the VNC screen of this VM through websockify. No password - same exposure as the VNC port itself.');?></div>
<?php else: ?>
<button type="submit" class="formbtn" name="act" value="novnc_start:<?=vmm_h($name);?>"><?=gettext('Start noVNC');?></button>
<?php endif; ?>
</td>
</tr>
<?php if ($nvSt !== null): ?>
<tr>
<td colspan="2" class="celldata">
<iframe src="<?=vmm_h('http://' . $nvSt['host'] . ':' . (int)$nvSt['port'] . '/vnc.html?autoconnect=1&resize=scale&path=websockify');?>"
style="width:100%;height:520px;border:1px solid rgba(127,127,127,.4);border-radius:4px;background:#000;"></iframe>
</td>
</tr>
<?php endif; ?>
</tbody>
</table>
<?php endif; ?>
<?php