From 8d43fc8aa55a9083dee23228d73104781390e04c Mon Sep 17 00:00:00 2001 From: bergware Date: Wed, 25 Oct 2023 09:24:16 +0200 Subject: [PATCH 01/41] Cache Devices: make style consistent --- emhttp/plugins/dynamix/CacheDevices.page | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/emhttp/plugins/dynamix/CacheDevices.page b/emhttp/plugins/dynamix/CacheDevices.page index df44dbf80..0fad46851 100644 --- a/emhttp/plugins/dynamix/CacheDevices.page +++ b/emhttp/plugins/dynamix/CacheDevices.page @@ -32,7 +32,7 @@ function isSubpool($name) { } ?> "> -"> +"> Date: Thu, 26 Oct 2023 02:06:06 +0200 Subject: [PATCH 20/41] Dashboard: update time when timezone is changed --- emhttp/plugins/dynamix/DateTime.page | 14 ++++++++----- emhttp/plugins/dynamix/include/ResetTZ.php | 23 ++++++++++++++++++++++ 2 files changed, 32 insertions(+), 5 deletions(-) create mode 100644 emhttp/plugins/dynamix/include/ResetTZ.php diff --git a/emhttp/plugins/dynamix/DateTime.page b/emhttp/plugins/dynamix/DateTime.page index f141e48c9..b3da8bdf5 100644 --- a/emhttp/plugins/dynamix/DateTime.page +++ b/emhttp/plugins/dynamix/DateTime.page @@ -4,8 +4,8 @@ Icon="icon-clock" Tag="clock-o" --- -
+ _(Current date and time)_: : _(Time zone)_: -: @@ -69,6 +69,10 @@ _(New date and time)_:
$domain_bridge, 'mac' => "", 'model' => 'virtio-net' ] ; - } + } foreach ($arrConfig['nic'] as $i => $arrNic) { $strLabel = ($i > 0) ? appendOrdinalSuffix($i + 1) : ''; @@ -1326,7 +1327,7 @@ - + - + @@ -1373,14 +1374,14 @@ if (count($pcidevice=array_filter($arrConfig['pci'], function($arr) use ($arrDev) { return ($arr['id'] == $arrDev['id']); }))) { $extra .= ' checked="checked"'; foreach ($pcidevice as $pcikey => $pcidev) $pciboot = $pcidev["boot"]; ; - + } elseif (!in_array($arrDev['driver'], ['pci-stub', 'vfio-pci'])) { //$extra .= ' disabled="disabled"'; continue; } $intAvailableOtherPCIDevices++; ?> - - \n"; // XML encoding declaratio echo mk_option($arrGPU['autoport'], 'no', _('No')); ?> - + >_(VM Console Port)_: - + > - + >_(VM Console WS Port)_: - + > @@ -800,19 +801,19 @@ $hdrXML = "\n"; // XML encoding declaratio virtual video protocol VDA/SPICE
If you wish to assign a protocol type, specify one here.

- + Graphics Card
If you wish to assign a graphics card to the VM, select it from this list, otherwise leave it set to virtual.

virtual video protocol VDC/SPICE
- If you wish to assign a protocol type, specify one here. + If you wish to assign a protocol type, specify one here.

virtual auto port
- Set it you want to specify a manual port for VNC or Spice. VNC needs two ports where Spice only requires one. Leave as auto yes for the system to set. + Set it you want to specify a manual port for VNC or Spice. VNC needs two ports where Spice only requires one. Leave as auto yes for the system to set.

@@ -898,15 +899,15 @@ $hdrXML = "\n"; // XML encoding declaratio
_(Select)_  _(Optional)_  _(Boot Order)_
_(Select)_  _(Optional)_  _(Boot Order)_
_(USB Devices)_: @@ -1336,7 +1337,7 @@ foreach($arrVMUSBs as $i => $arrDev) { ?>
_(Select)_  _(Boot Order)_
_(Select)_  _(Boot Order)_
_(Other PCI Devices)_:
- $domain_bridge, 'mac' => "", 'model' => 'virtio-net' ] ; - } + } foreach ($arrConfig['nic'] as $i => $arrNic) { $strLabel = ($i > 0) ? appendOrdinalSuffix($i + 1) : ''; @@ -951,7 +952,7 @@ $hdrXML = "\n"; // XML encoding declaratio style="width: 50px;" name="nic[][boot]" title="_(Boot order)_" value="" > - +
@@ -1025,7 +1026,7 @@ $hdrXML = "\n"; // XML encoding declaratio - + @@ -1057,7 +1058,7 @@ $hdrXML = "\n"; // XML encoding declaratio
_(Select)_  _(Optional)_  _(Boot Order)_
_(Select)_  _(Optional)_  _(Boot Order)_
_(USB Devices)_:
- + @@ -1073,14 +1074,14 @@ $hdrXML = "\n"; // XML encoding declaratio if (count($pcidevice=array_filter($arrConfig['pci'], function($arr) use ($arrDev) { return ($arr['id'] == $arrDev['id']); }))) { $extra .= ' checked="checked"'; foreach ($pcidevice as $pcikey => $pcidev) $pciboot = $pcidev["boot"]; ; - + } elseif (!in_array($arrDev['driver'], ['pci-stub', 'vfio-pci'])) { //$extra .= ' disabled="disabled"'; continue; } $intAvailableOtherPCIDevices++; ?> - - +
_(Select)_  _(Boot Order)_
_(Select)_  _(Boot Order)_
_(Other PCI Devices)_: style="width: 50px;" name="nic[][boot]" title="_(Boot order)_" value="" >
@@ -1018,7 +1019,7 @@ $hdrXML = "\n"; // XML encoding declaratio - + @@ -1029,7 +1030,7 @@ $hdrXML = "\n"; // XML encoding declaratio foreach($arrVMUSBs as $i => $arrDev) { ?>
\n"; // XML encoding declaratio
_(Select)_  _(Optional)_  _(Boot Order)_
_(Select)_  _(Optional)_  _(Boot Order)_
_(USB Devices)_:
- + @@ -1066,14 +1067,14 @@ $hdrXML = "\n"; // XML encoding declaratio if (count($pcidevice=array_filter($arrConfig['pci'], function($arr) use ($arrDev) { return ($arr['id'] == $arrDev['id']); }))) { $extra .= ' checked="checked"'; foreach ($pcidevice as $pcikey => $pcidev) $pciboot = $pcidev["boot"]; ; - + } elseif (!in_array($arrDev['driver'], ['pci-stub', 'vfio-pci'])) { //$extra .= ' disabled="disabled"'; continue; } $intAvailableOtherPCIDevices++; ?> - "; } @@ -218,7 +218,7 @@ case 't3': exec('lsusb|sort',$lsusb); foreach ($lsusb as $line) { [$bus,$id] = my_explode(':',$line); - $usbport = usb_physical_port($line) ; + $usbport = usb_physical_port($line); echo ""; } break; diff --git a/emhttp/plugins/dynamix/include/SysDrivers.php b/emhttp/plugins/dynamix/include/SysDrivers.php index f6ad7cf34..251e6e240 100644 --- a/emhttp/plugins/dynamix/include/SysDrivers.php +++ b/emhttp/plugins/dynamix/include/SysDrivers.php @@ -11,112 +11,106 @@ */ ?> "; - $html .= "" ; - - if (is_array($arrModules)) ksort($arrModules) ; - foreach($arrModules as $modname => $module) { - if ($modname == "") continue ; +case 't1load': + $list = file_get_contents($sysdrvfile); + $arrModules = json_decode($list,TRUE); + $init = false; + if (is_file($sysdrvinit)) $init = file_get_contents($sysdrvinit); + $html = ""; + $html .= ""; + if (is_array($arrModules)) ksort($arrModules); + foreach($arrModules as $modname => $module) { + if ($modname == "") continue; + if (is_file("/boot/config/modprobe.d/$modname.conf")) { + $modprobe = file_get_contents("/boot/config/modprobe.d/$modname.conf"); + $state = strpos($modprobe, "blacklist"); + $modprobe = explode(PHP_EOL,$modprobe); + if($state !== false) {$state = "Disabled";} else $state="Custom"; + $module['state'] = $state; + $module['modprobe'] = $modprobe; + } else { + if (is_file("/etc/modprobe.d/$modname.conf")) { + $modprobe = file_get_contents("/etc/modprobe.d/$modname.conf"); + $state = strpos($modprobe, "blacklist"); + $modprobe = explode(PHP_EOL,$modprobe); + if($state !== false) {$state = "Disabled";} else $state="System"; + $module['state'] = $state; + $module['modprobe'] = $modprobe; + } + } + $html .= ""; + if ($supportpage) { + if ($module['support'] == false) { + $supporthtml = ""; + } else { + $supporturl = $module['supporturl']; + $pluginname = $module['plugin']; + $supporthtml = ""; + } + } + if (isset($module["version"])) $version = " (".$module["version"].")"; else $version = ""; + $html .= ""; + $html .= ""; + $text = ""; + if (is_array($module["modprobe"])) { + $text = implode("\n",$module["modprobe"]); + $html .= ""; + } else { + $html .= ""; + } + } + $html .= ""; + $rtn = array(); + $rtn['html'] = $html; + if ($init !== false) {$init = true; unlink($sysdrvinit);} + $rtn['init'] = $init; + echo json_encode($rtn); + break; - if (is_file("/boot/config/modprobe.d/$modname.conf")) { - $modprobe = file_get_contents("/boot/config/modprobe.d/$modname.conf") ; - $state = strpos($modprobe, "blacklist"); - $modprobe = explode(PHP_EOL,$modprobe) ; - if($state !== false) {$state = "Disabled" ;} else $state="Custom" ; - $module['state'] = $state ; - $module['modprobe'] = $modprobe ; - } else { - if (is_file("/etc/modprobe.d/$modname.conf")) { - $modprobe = file_get_contents("/etc/modprobe.d/$modname.conf") ; - $state = strpos($modprobe, "blacklist"); - $modprobe = explode(PHP_EOL,$modprobe) ; - if($state !== false) {$state = "Disabled" ;} else $state="System" ; - $module['state'] = $state ; - $module['modprobe'] = $modprobe ; - } - } - - $html .= "" ; - if ($supportpage) { - if ($module['support'] == false) { - $supporthtml = "" ; - } else { - $supporturl = $module['supporturl'] ; - $pluginname = $module['plugin'] ; - $supporthtml = "" ; - } - } - if (isset($module["version"])) $version = " (".$module["version"].")" ; else $version = "" ; - - $html .= "" ; - $html .= ""; - - $text = "" ; - if (is_array($module["modprobe"])) { - $text = implode("\n",$module["modprobe"]) ; - $html .= ""; - } else { - $html .= ""; - } - - } - $html .= "" ; - $rtn = array() ; - $rtn['html'] = $html ; - if ($init !== false) {$init = true ; unlink($sysdrvinit) ;} - $rtn['init'] = $init ; - echo json_encode($rtn) ; - break; - case "update": - $conf = $_POST['conf'] ; - $module = $_POST['module'] ; - if ($conf == "") $error = unlink("/boot/config/modprobe.d/$module.conf") ; else $error = file_put_contents("/boot/config/modprobe.d/$module.conf",$conf) ; - getmodules($module) ; - $return = $arrModules[$module] ; - $return['supportpage'] = $supportpage ; - if (is_array($return["modprobe"]))$return["modprobe"] = implode("\n",$return["modprobe"]) ; - if ($error !== false) $return["error"] = false ; else $return["error"] = true ; - echo json_encode($return) ; - break ; -} + $conf = $_POST['conf']; + $module = $_POST['module']; + if ($conf == "") $error = unlink("/boot/config/modprobe.d/$module.conf"); else $error = file_put_contents("/boot/config/modprobe.d/$module.conf",$conf); + getmodules($module); + $return = $arrModules[$module]; + $return['supportpage'] = $supportpage; + if (is_array($return["modprobe"]))$return["modprobe"] = implode("\n",$return["modprobe"]); + if ($error !== false) $return["error"] = false; else $return["error"] = true; + echo json_encode($return); + break; +} ?> diff --git a/emhttp/plugins/dynamix/include/SysDriversInit.php b/emhttp/plugins/dynamix/include/SysDriversInit.php index f9a5c3971..1beae8711 100755 --- a/emhttp/plugins/dynamix/include/SysDriversInit.php +++ b/emhttp/plugins/dynamix/include/SysDriversInit.php @@ -1,5 +1,5 @@ #!/usr/bin/php - \ No newline at end of file +$modtoplgfile = "/tmp/modulestoplg.json"; +$sysdrvfile = "/tmp/sysdrivers.json"; +$arrModtoPlg = json_decode(file_get_contents("/tmp/modulestoplg.json") ,TRUE); +file_put_contents("/tmp/sysdrivers.init","1"); + +SysDriverslog("SysDrivers Build Starting"); +modtoplg(); +createlist(); +SysDriverslog("SysDrivers Build Complete"); +?> diff --git a/emhttp/plugins/dynamix/include/Syslog.php b/emhttp/plugins/dynamix/include/Syslog.php index 72fcaf814..32b7f3a5a 100644 --- a/emhttp/plugins/dynamix/include/Syslog.php +++ b/emhttp/plugins/dynamix/include/Syslog.php @@ -1,6 +1,6 @@ 1) && $argv[1] == "-v") { if ($cli && ($argc > 1) && $argv[1] == "-vv") { $verbose = true; } -$var = @parse_ini_file('/var/local/emhttp/var.ini') ?: []; -$nginx = @parse_ini_file('/var/local/emhttp/nginx.ini') ?: []; +$var = (array)@parse_ini_file('/var/local/emhttp/var.ini'); +$nginx = (array)@parse_ini_file('/var/local/emhttp/nginx.ini'); $is69 = version_compare(_var($var,'version'),"6.9.9","<"); $reloadNginx = false; $dnserr = false; @@ -189,7 +189,7 @@ $icon_warn = "⚠️ "; $icon_ok = "✅ "; $myservers_flash_cfg_path='/boot/config/plugins/dynamix.my.servers/myservers.cfg'; -$myservers = file_exists($myservers_flash_cfg_path) ? @parse_ini_file($myservers_flash_cfg_path,true) : []; +$myservers = (array)@parse_ini_file($myservers_flash_cfg_path,true); // ensure some vars are defined here so we don't have to test them later if (empty($myservers['remote']['apikey'])) { $myservers['remote']['apikey'] = ""; diff --git a/emhttp/plugins/dynamix/include/UpdateOne.php b/emhttp/plugins/dynamix/include/UpdateOne.php index d44a45b03..ebfe8539c 100644 --- a/emhttp/plugins/dynamix/include/UpdateOne.php +++ b/emhttp/plugins/dynamix/include/UpdateOne.php @@ -1,6 +1,6 @@ Date: Thu, 26 Oct 2023 17:04:48 +0200 Subject: [PATCH 26/41] Copyright update --- emhttp/plugins/dynamix.vm.manager/AddVM.page | 2 +- emhttp/plugins/dynamix.vm.manager/UpdateVM.page | 2 +- emhttp/plugins/dynamix.vm.manager/VMSettings.page | 2 +- emhttp/plugins/dynamix.vm.manager/VMs.page | 5 +++-- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/emhttp/plugins/dynamix.vm.manager/AddVM.page b/emhttp/plugins/dynamix.vm.manager/AddVM.page index 7db9d73fd..2e099b6b5 100644 --- a/emhttp/plugins/dynamix.vm.manager/AddVM.page +++ b/emhttp/plugins/dynamix.vm.manager/AddVM.page @@ -6,7 +6,7 @@ Markdown="false" /dev/null\")" --- Date: Thu, 26 Oct 2023 17:08:38 +0200 Subject: [PATCH 27/41] Copyright update --- emhttp/plugins/dynamix.docker.manager/AddContainer.page | 2 +- emhttp/plugins/dynamix.docker.manager/Docker.page | 1 + emhttp/plugins/dynamix.docker.manager/DockerContainers.page | 2 +- emhttp/plugins/dynamix.docker.manager/DockerSettings.page | 2 +- emhttp/plugins/dynamix.docker.manager/UpdateContainer.page | 2 +- 5 files changed, 5 insertions(+), 4 deletions(-) diff --git a/emhttp/plugins/dynamix.docker.manager/AddContainer.page b/emhttp/plugins/dynamix.docker.manager/AddContainer.page index 9afe0734d..e0d6efbbe 100644 --- a/emhttp/plugins/dynamix.docker.manager/AddContainer.page +++ b/emhttp/plugins/dynamix.docker.manager/AddContainer.page @@ -5,7 +5,7 @@ Markdown="false" /dev/null\ --- Date: Thu, 26 Oct 2023 17:11:36 +0200 Subject: [PATCH 28/41] Copyright update --- .../plugins/dynamix.docker.manager/include/CreateDocker.php | 2 +- emhttp/plugins/dynamix.docker.manager/include/Helpers.php | 2 +- emhttp/plugins/dynamix.docker.manager/include/PruneConfig.php | 4 ++-- emhttp/plugins/dynamix.docker.manager/include/UserPrefs.php | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/emhttp/plugins/dynamix.docker.manager/include/CreateDocker.php b/emhttp/plugins/dynamix.docker.manager/include/CreateDocker.php index 73a405ad2..35b49e0a3 100644 --- a/emhttp/plugins/dynamix.docker.manager/include/CreateDocker.php +++ b/emhttp/plugins/dynamix.docker.manager/include/CreateDocker.php @@ -1,7 +1,7 @@ Date: Thu, 26 Oct 2023 17:14:53 +0200 Subject: [PATCH 29/41] Copyright update --- emhttp/plugins/dynamix.vm.manager/include/UserPrefs.php | 6 +++--- emhttp/plugins/dynamix.vm.manager/include/libvirt.php | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/emhttp/plugins/dynamix.vm.manager/include/UserPrefs.php b/emhttp/plugins/dynamix.vm.manager/include/UserPrefs.php index 3267a636b..57169f422 100644 --- a/emhttp/plugins/dynamix.vm.manager/include/UserPrefs.php +++ b/emhttp/plugins/dynamix.vm.manager/include/UserPrefs.php @@ -1,7 +1,7 @@ Date: Thu, 26 Oct 2023 17:18:00 +0200 Subject: [PATCH 30/41] Copyright update --- emhttp/plugins/dynamix.docker.manager/include/PruneConfig.php | 1 + emhttp/plugins/dynamix.docker.manager/include/UserPrefs.php | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/emhttp/plugins/dynamix.docker.manager/include/PruneConfig.php b/emhttp/plugins/dynamix.docker.manager/include/PruneConfig.php index 8e176aeff..8f0642dea 100644 --- a/emhttp/plugins/dynamix.docker.manager/include/PruneConfig.php +++ b/emhttp/plugins/dynamix.docker.manager/include/PruneConfig.php @@ -1,6 +1,7 @@ Date: Thu, 26 Oct 2023 17:32:25 +0200 Subject: [PATCH 31/41] Dashboard: update time when timezone is changed --- emhttp/plugins/dynamix/include/ResetTZ.php | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/emhttp/plugins/dynamix/include/ResetTZ.php b/emhttp/plugins/dynamix/include/ResetTZ.php index d946a8c65..0fa61182d 100644 --- a/emhttp/plugins/dynamix/include/ResetTZ.php +++ b/emhttp/plugins/dynamix/include/ResetTZ.php @@ -13,12 +13,17 @@ /dev/null &"); +if (!is_file($pidfile)) exit; + +foreach ($scripts as $script) { + if (exec("grep -Pom1 '^$nchan/$script' $pidfile")) { + // restart selected script + exec("pkill -f $nchan/$script"); + exec("$docroot/$nchan/$script &>/dev/null &"); + } } ?> From 33a64665eab07aa6992abec1a97a8ae76785bb1a Mon Sep 17 00:00:00 2001 From: bergware Date: Thu, 26 Oct 2023 18:10:11 +0200 Subject: [PATCH 32/41] Use "null coalescing assignment" operator for $docroot --- emhttp/plugins/dynamix/include/update.trim.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/emhttp/plugins/dynamix/include/update.trim.php b/emhttp/plugins/dynamix/include/update.trim.php index b845e4fa4..8a5f7b2fc 100644 --- a/emhttp/plugins/dynamix/include/update.trim.php +++ b/emhttp/plugins/dynamix/include/update.trim.php @@ -11,7 +11,7 @@ */ ?> 0) { From d4e8617eef86080d5d77ee41beb6c26cfcfd65d7 Mon Sep 17 00:00:00 2001 From: bergware Date: Thu, 26 Oct 2023 18:17:44 +0200 Subject: [PATCH 33/41] Use "null coalescing assignment" operator for $docroot --- .../dynamix.plugin.manager/post-hooks/post_plugin_checks | 2 +- .../dynamix.plugin.manager/pre-hooks/pre_plugin_checks | 2 +- emhttp/plugins/dynamix/include/LanguageReset.php | 6 +++--- emhttp/plugins/gui.search/exec.php | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/emhttp/plugins/dynamix.plugin.manager/post-hooks/post_plugin_checks b/emhttp/plugins/dynamix.plugin.manager/post-hooks/post_plugin_checks index 272a30b3f..d681d3df3 100755 --- a/emhttp/plugins/dynamix.plugin.manager/post-hooks/post_plugin_checks +++ b/emhttp/plugins/dynamix.plugin.manager/post-hooks/post_plugin_checks @@ -12,7 +12,7 @@ */ ?> Date: Thu, 26 Oct 2023 18:22:27 +0200 Subject: [PATCH 34/41] Use "null coalescing assignment" operator for $docroot --- emhttp/plugins/dynamix/nchan/ups_status | 3 +-- emhttp/plugins/dynamix/nchan/wg_poller | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/emhttp/plugins/dynamix/nchan/ups_status b/emhttp/plugins/dynamix/nchan/ups_status index fc080effc..1d4a6c01f 100755 --- a/emhttp/plugins/dynamix/nchan/ups_status +++ b/emhttp/plugins/dynamix/nchan/ups_status @@ -13,8 +13,7 @@ */ ?> Date: Thu, 26 Oct 2023 20:08:55 +0200 Subject: [PATCH 35/41] SysDrivers: fix regression errors --- emhttp/plugins/dynamix/SysDrivers.page | 4 +-- emhttp/plugins/dynamix/include/SysDevs.php | 28 +++++++++---------- emhttp/plugins/dynamix/include/SysDrivers.php | 8 +++--- .../dynamix/include/SysDriversHelpers.php | 5 ++-- emhttp/plugins/dynamix/sheets/SysDrivers.css | 10 +++---- 5 files changed, 27 insertions(+), 28 deletions(-) diff --git a/emhttp/plugins/dynamix/SysDrivers.page b/emhttp/plugins/dynamix/SysDrivers.page index fe401b664..5316ee3ef 100644 --- a/emhttp/plugins/dynamix/SysDrivers.page +++ b/emhttp/plugins/dynamix/SysDrivers.page @@ -15,9 +15,9 @@ Tag="server" * all copies or substantial portions of the Software. */ ?> - - +
_(Select)_  _(Boot Order)_
_(Select)_  _(Boot Order)_
_(Other PCI Devices)_:
$bus Port $usbport".trim($id)."
$bus Port $usbport ".trim($id)."
"._("Driver").""._("Description").""._("State").""._("Type").""._("Modprobe.d config file")."
"._("Driver").""._("Description").""._("State").""._("Type").""._("Modprobe.d config file")."
$modname$version$supporthtml{$module['description']}{$module['state']}{$module['type']}"; + $hidden = ""; + if ($module['state'] == "System") $hidden = "hidden"; + $html .= " "; + $html .= "
"; + $html .= " "; + $html .= "
$modname$version$supporthtml{$module['description']}{$module['state']}{$module['type']}" ; - $hidden = "" ; - if ($module['state'] == "System") $hidden = "hidden" ; - $html .= " " ; - $html .= "
" ; - $html .= " " ; - $html .= "