diff --git a/emhttp/plugins/dynamix.docker.manager/DockerSettings.page b/emhttp/plugins/dynamix.docker.manager/DockerSettings.page index 2d128ba66..91552272c 100644 --- a/emhttp/plugins/dynamix.docker.manager/DockerSettings.page +++ b/emhttp/plugins/dynamix.docker.manager/DockerSettings.page @@ -4,8 +4,8 @@ Icon="icon-docker" Tag="icon-docker" --- (_(optional)_): **_(Subnet)_:** **_(Gateway)_:** - > - **_(DHCP pool)_:**: -/ "; - echo ""; -?> @@ -421,11 +413,7 @@ _(IPv6 custom network on interface)_ (_(optional)_): **_(Subnet)_:**>/ - **_(Gateway)_:**" title="_(IPv6 address nnnn:xxxx::yyyy)_"> - > - **_(DHCP pool)_:**>/ - + **_(Gateway)_:**" title="_(IPv6 address nnnn:xxxx::yyyy)_"> @@ -528,7 +516,6 @@ if (isset($dockercfg[$docker_dhcp6]) || empty($dockercfg["DOCKER_AUTO_$net"])):? _(IPv6 custom network on interface)_ : : **_(Subnet)_:** **_(Gateway)_:** - **_(DHCP pool)_:** @@ -551,7 +538,7 @@ if (!$vlan) { _(IPv6 custom network on interface)_ : : **_(Subnet)_:** / **_(Gateway)_:** - **_(DHCP pool)_:** + diff --git a/emhttp/plugins/dynamix.docker.manager/include/DockerClient.php b/emhttp/plugins/dynamix.docker.manager/include/DockerClient.php index b30b6d331..708e50456 100644 --- a/emhttp/plugins/dynamix.docker.manager/include/DockerClient.php +++ b/emhttp/plugins/dynamix.docker.manager/include/DockerClient.php @@ -1,6 +1,6 @@ "$docroot/state/plugins/dynamix.docker.manager/docker.json" ]; -// load network variables if needed. -$ethX = 'eth0'; -if (!isset($$ethX)) extract(parse_ini_file("$docroot/state/network.ini",true)); -$host = ipaddr($ethX); - -// get network drivers -$driver = DockerUtil::driver(); - -// determine active port name -$port = file_exists('/sys/class/net/br0') ? 'BR0' : (file_exists('/sys/class/net/bond0') ? 'BOND0' : 'ETH0'); - // Docker configuration file - guaranteed to exist $docker_cfgfile = '/boot/config/docker.cfg'; if (file_exists($docker_cfgfile)) { + $port = strtoupper(DockerUtil::port()); exec("grep -Pom2 '_SUBNET_|_{$port}(_[0-9]+)?=' $docker_cfgfile",$cfg); if (isset($cfg[0]) && $cfg[0]=='_SUBNET_' && empty($cfg[1])) { # interface has changed, update configuration @@ -277,9 +267,8 @@ class DockerTemplates { } private function getControlURL(&$ct, $myIP, $WebUI) { - global $host; $port = &$ct['Ports'][0]; - $myIP = $myIP ?: $this->getTemplateValue($ct['Image'],'MyIP') ?: (_var($ct,'NetworkMode')=='host'||_var($port,'NAT') ? $host : (_var($port,'IP') ?: DockerUtil::myIP($ct['Name']))); + $myIP = $myIP ?: $this->getTemplateValue($ct['Image'],'MyIP') ?: (_var($ct,'NetworkMode')=='host'||_var($port,'NAT') ? DockerUtil::host() : (_var($port,'IP') ?: DockerUtil::myIP($ct['Name']))); // Get the WebUI address from the templates as a fallback $WebUI = preg_replace("%\[IP\]%", $myIP, $WebUI ?? $this->getTemplateValue($ct['Image'], 'WebUI')); if (preg_match("%\[PORT:(\d+)\]%", $WebUI, $matches)) { @@ -303,9 +292,11 @@ class DockerTemplates { } public function getAllInfo($reload=false,$com=true,$communityApplications=false) { - global $driver, $dockerManPaths, $host; + global $dockerManPaths; $DockerClient = new DockerClient(); $DockerUpdate = new DockerUpdate(); + $driver = DockerUtil::driver(); + $host = DockerUtil::host(); //$DockerUpdate->verbose = $this->verbose; $info = DockerUtil::loadJSON($dockerManPaths['webui-info']); $autoStart = array_map('var_split', @file($dockerManPaths['autostart-file'],FILE_IGNORE_NEW_LINES) ?: []); @@ -957,7 +948,8 @@ class DockerClient { } public function getDockerContainers() { - global $driver, $host; + $driver = DockerUtil::driver(); + $host = DockerUtil::host(); // Return cached values if (is_array($this::$containersCache)) return $this::$containersCache; $this::$containersCache = []; @@ -1158,7 +1150,7 @@ class DockerUtil { } public static function custom() { - return static::docker("network ls --filter driver='bridge' --filter driver='macvlan' --filter driver='ipvlan' --format='{{.Name}}' 2>/dev/null|grep -v '^bridge$'",true); + return static::docker("network ls --filter driver='bridge' --filter driver='macvlan' --filter driver='ipvlan' --format='{{.Name}}' 2>/dev/null | grep -v '^bridge$'",true); } public static function network($custom) { @@ -1168,11 +1160,27 @@ class DockerUtil { } public static function cpus() { - exec('cat /sys/devices/system/cpu/*/topology/thread_siblings_list|sort -nu', $cpus); + exec('cat /sys/devices/system/cpu/*/topology/thread_siblings_list | sort -nu', $cpus); return $cpus; } + public static function ctMap($ct, $type='Name') { return static::docker("inspect --format='{{.$type}}' $ct"); } + + public static function port() { + if (lan_port('br0')) return 'br0'; + if (lan_port('bond0')) return 'bond0'; + if (lan_port('eth0')) return 'eth0'; + if (lan_port('wlan0')) return 'wlan0'; + return ''; + } + + public static function host() { + $port = static::port(); + if (!$port) return ''; + $port = lan_port($port,true)==0 && lan_port('wlan0') ? 'wlan0' : $port; + return exec("ip -br -4 addr show $port scope global | sed -r 's/\/[0-9]+//g' | awk '{print $3;exit}'"); + } } ?> diff --git a/emhttp/plugins/dynamix.docker.manager/include/DockerContainers.php b/emhttp/plugins/dynamix.docker.manager/include/DockerContainers.php index 267207e9d..406464250 100644 --- a/emhttp/plugins/dynamix.docker.manager/include/DockerContainers.php +++ b/emhttp/plugins/dynamix.docker.manager/include/DockerContainers.php @@ -1,6 +1,6 @@ getAllInfo(); $docker = []; @@ -65,12 +68,12 @@ function tailscale_json_dl($file, $url) { mkdir('/tmp/tailscale', 0777, true); } if (!file_exists($file)) { - exec("wget -T 3 -q -O " . $file . " " . $url, $output, $dl_status); + exec("wget -T 3 -q -O ".$file." ".$url, $output, $dl_status); } else { $fileage = time() - filemtime($file); if ($fileage > 86400) { unlink($file); - exec("wget -T 3 -q -O " . $file . " " . $url, $output, $dl_status); + exec("wget -T 3 -q -O ".$file." ".$url, $output, $dl_status); } } if ($dl_status === 0) { @@ -144,23 +147,25 @@ foreach ($containers as $ct) { $ports_internal = []; $ports_external = []; if (isset($ct['Ports']['vlan'])) { - foreach ($ct['Ports']['vlan'] as $i) + foreach ($ct['Ports']['vlan'] as $i) { $ports_external[] = sprintf('%s', $i); + } $ports_internal[0] = sprintf('%s', 'all'); } foreach($ct['Networks'] as $netName => $netVals) { $networks[] = $netName; $network_ips[] = $running ? $netVals['IPAddress'] : null; - if (isset($ct['Networks']['host'])) { $ports_external[] = sprintf('%s', $netVals['IPAddress']); $ports_internal[0] = sprintf('%s', 'all'); - } else if (!isset($ct['Ports']['vlan']) || strpos($ct['NetworkMode'], 'container:') != 0) { + } elseif (!isset($ct['Ports']['vlan']) || strpos($ct['NetworkMode'],'container:')!==false) { foreach ($ct['Ports'] as $port) { - if (_var($port,'PublicPort') && _var($port,'Driver') == 'bridge') + if (_var($port,'PublicPort') && _var($port,'Driver') == 'bridge') { $ports_external[] = sprintf('%s:%s', $host, strtoupper(_var($port,'PublicPort'))); - if ((!isset($ct['Networks']['host'])) || (!isset($ct['Networks']['vlan']))) + } + if ((!isset($ct['Networks']['host'])) || (!isset($ct['Networks']['vlan']))) { $ports_internal[] = sprintf('%s:%s', _var($port,'PrivatePort'), strtoupper(_var($port,'Type'))); + } } } } @@ -176,7 +181,7 @@ foreach ($containers as $ct) { } else { $appname = htmlspecialchars($name); } - echo "$image$appname
"._($status).(!empty($composestack) ? '
Compose Stack: ' . $composestack : '')."
"; + echo "$image$appname
"._($status).(!empty($composestack) ? '
Compose Stack: '.$composestack : '')."
"; echo "
"._('Container ID').": $id
"; if ($ct['BaseImage']) echo "".htmlspecialchars($ct['BaseImage'])."
"; echo _('By').": "; @@ -240,27 +245,27 @@ foreach ($containers as $ct) { // Construct TSinfo from TSstats $TSinfo = ''; if (!$TSstats["Self"]["Online"]) { - $TSinfo .= "
"._("Online:")."
"._("Please check the logs!")."
"; + $TSinfo .= "
"._("Online").":
"._("Please check the logs")."!
"; } else { $TS_version = explode('-', $TSstats["Version"])[0]; if (!empty($TS_version)) { if (!empty($TS_latest_version)) { if (version_compare($TS_version, $TS_latest_version, '<')) { - $TSinfo .= "
"._("Tailscale:")."v" . $TS_version . " ➔ v" . $TS_latest_version . " "._("available!")."
"; + $TSinfo .= "
"._("Tailscale:")."v".$TS_version." ➔ v".$TS_latest_version." "._("available!")."
"; } else { - $TSinfo .= "
"._("Tailscale:")."v" . $TS_version . "
"; + $TSinfo .= "
"._("Tailscale").":v".$TS_version."
"; } } else { - $TSinfo .= "
".("Tailscale:")."v" . $TS_version . "
"; + $TSinfo .= "
".("Tailscale").":v".$TS_version."
"; } } - $TSinfo .= "
"._("Online:")."
"; + $TSinfo .= "
"._("Online").":
"; $TS_DNSName = $TSstats["Self"]["DNSName"]; $TS_HostNameActual = substr($TS_DNSName, 0, strpos($TS_DNSName, '.')); if (strcasecmp($TS_HostNameActual, $TShostname) !== 0 && !empty($TS_DNSName)) { - $TSinfo .= "
"._("Hostname:").""._("Real Hostname")." ➔ " . $TS_HostNameActual . "
"; + $TSinfo .= "
"._("Hostname").":"._("Real Hostname")." ➔ ".$TS_HostNameActual."
"; } else { - $TSinfo .= "
"._("Hostname:")."" . $TShostname . "
"; + $TSinfo .= "
"._("Hostname").":".$TShostname."
"; } // Map region relay code to cleartext region if TS_derp_list is available if (!empty($TS_derp_list)) { @@ -271,31 +276,31 @@ foreach ($containers as $ct) { } } if (!empty($TSregion)) { - $TSinfo .= "
"._("DERP Relay:")."" . $TSregion . "
"; + $TSinfo .= "
"._("DERP Relay").":".$TSregion."
"; } else { - $TSinfo .= "
"._("DERP Relay:")."" . $TSstats["Self"]["Relay"] . "
"; + $TSinfo .= "
"._("DERP Relay").":".$TSstats["Self"]["Relay"]."
"; } } else { - $TSinfo .= "
"._("DERP Relay").":" . $TSstats["Self"]["Relay"] . "
"; + $TSinfo .= "
"._("DERP Relay").":".$TSstats["Self"]["Relay"]."
"; } if (!empty($TSstats["Self"]["TailscaleIPs"])) { - $TSinfo .= "
"._("Addresses:")."" . implode("
", $TSstats["Self"]["TailscaleIPs"]) . "
"; + $TSinfo .= "
"._("Addresses").":".implode("
", $TSstats["Self"]["TailscaleIPs"])."
"; } if (!empty($TSstats["Self"]["PrimaryRoutes"])) { - $TSinfo .= "
"._("Routes:")."" . implode("
", $TSstats["Self"]["PrimaryRoutes"]) . "
"; + $TSinfo .= "
"._("Routes").":".implode("
", $TSstats["Self"]["PrimaryRoutes"])."
"; } if ($TSstats["Self"]["ExitNodeOption"]) { - $TSinfo .= "
"._("Is Exit Node:")."
"; + $TSinfo .= "
"._("Is Exit Node").":
"; } else { if (!empty($TSstats["ExitNodeStatus"])) { $TS_exit_node_status = ($TSstats["ExitNodeStatus"]["Online"]) ? "✅" : "❌"; - $TSinfo .= "
"._("Exit Node:")."" . strstr($TSstats["ExitNodeStatus"]["TailscaleIPs"][0], '/', true) . " | Status: " . $TS_exit_node_status ."
"; + $TSinfo .= "
"._("Exit Node").":".strstr($TSstats["ExitNodeStatus"]["TailscaleIPs"][0], '/', true)." | Status: ".$TS_exit_node_status ."
"; } else { - $TSinfo .= "
"._("Is Exit Node:")."
"; + $TSinfo .= "
"._("Is Exit Node").":
"; } } if (!empty($TSwebGui)) { - $TSinfo .= "
"._("URL:")."" . $TSwebGui . "
"; + $TSinfo .= "
"._("URL").":".$TSwebGui."
"; } if (!empty($TSstats["Self"]["KeyExpiry"])) { $TS_expiry = new DateTime($TSstats["Self"]["KeyExpiry"]); @@ -303,17 +308,17 @@ foreach ($containers as $ct) { $TS_expiry_formatted = $TS_expiry->format('Y-m-d'); $TS_expiry_diff = $current_Date->diff($TS_expiry); if ($TS_expiry_diff->invert) { - $TSinfo .= "
"._("Key Expiry:")."❌ "._("Expired! Renew/Disable key expiry!")."
"; + $TSinfo .= "
"._("Key Expiry").":❌ "._("Expired! Renew/Disable key expiry!")."
"; } else { - $TSinfo .= "
"._("Key Expiry:")."" . $TS_expiry_formatted . " (" . $TS_expiry_diff->days . " days)
"; + $TSinfo .= "
"._("Key Expiry").":".$TS_expiry_formatted." (".$TS_expiry_diff->days." days)
"; } } } // Display TSinfo if data was fetched correctly - $TS_status = "
Tailscale
"; + $TS_status = "
Tailscale
"; } else { // Display message to refresh page if Tailscale in the container wasn't maybe ready to get the data - $TS_status = "
Tailscale
"; + $TS_status = "
Tailscale
"; } } else { // Display message that container isn't running diff --git a/emhttp/plugins/dynamix.docker.manager/include/Helpers.php b/emhttp/plugins/dynamix.docker.manager/include/Helpers.php index 28dab85c6..706790bee 100644 --- a/emhttp/plugins/dynamix.docker.manager/include/Helpers.php +++ b/emhttp/plugins/dynamix.docker.manager/include/Helpers.php @@ -1,6 +1,6 @@ getDockerContainers() as $ct) { $list = $port = []; diff --git a/emhttp/plugins/dynamix.docker.manager/system/Docker b/emhttp/plugins/dynamix.docker.manager/system/Docker index 9aa6220e0..236ef3d7f 100755 --- a/emhttp/plugins/dynamix.docker.manager/system/Docker +++ b/emhttp/plugins/dynamix.docker.manager/system/Docker @@ -3,7 +3,7 @@ ACTIVE_CONTAINERS="$(docker ps -q --no-trunc 2>/dev/null)" # Exit if no containers are active and return zero -if [ -z "${ACTIVE_CONTAINERS}" ]; then +if [[ -z $ACTIVE_CONTAINERS ]]; then echo "0" exit fi diff --git a/emhttp/plugins/dynamix.vm.manager/templates/Custom.formold.php b/emhttp/plugins/dynamix.vm.manager/templates/Custom.formold.php index 7fec53f24..681b423ff 100644 --- a/emhttp/plugins/dynamix.vm.manager/templates/Custom.formold.php +++ b/emhttp/plugins/dynamix.vm.manager/templates/Custom.formold.php @@ -42,7 +42,7 @@ if (is_file($templateslocation)){ $arrAllTemplates["User-templates"] = ""; - $ut = json_decode(file_get_contents($templateslocation),true) ; + $ut = json_decode(file_get_contents($templateslocation),true); $arrAllTemplates = array_merge($arrAllTemplates, $ut); } @@ -152,7 +152,7 @@ $protocol = $lv->domain_get_vmrc_protocol($dom); $reply = ['success' => true]; if ($vmrcport > 0) { - $reply['vmrcurl'] = autov('/plugins/dynamix.vm.manager/'.$protocol.'.html',true).'&autoconnect=true&host=' . $_SERVER['HTTP_HOST'] ; + $reply['vmrcurl'] = autov('/plugins/dynamix.vm.manager/'.$protocol.'.html',true).'&autoconnect=true&host=' . $_SERVER['HTTP_HOST']; if ($protocol == "spice") $reply['vmrcurl'] .= '&port=/wsproxy/'.$vmrcport.'/'; else $reply['vmrcurl'] .= '&port=&path=/wsproxy/' . $wsport . '/'; } } else { @@ -185,9 +185,9 @@ // hot-attach any new usb devices foreach ($arrNewUSBIDs as $strNewUSBID) { - if (strpos($strNewUSBID,"#remove")) continue ; - $remove = explode('#', $strNewUSBID) ; - $strNewUSBID2 = $remove[0] ; + if (strpos($strNewUSBID,"#remove")) continue; + $remove = explode('#', $strNewUSBID); + $strNewUSBID2 = $remove[0]; foreach ($arrExistingConfig['usb'] as $arrExistingUSB) { if ($strNewUSBID2 == $arrExistingUSB['id']) continue 2; } @@ -240,7 +240,7 @@ // XML view $xml = $_POST['xmldesc']; $arrExistingConfig = custom::createArray('domain',$xml); - $newuuid = $arrExistingConfig['uuid'] ; + $newuuid = $arrExistingConfig['uuid']; $xml = str_replace($olduuid,$newuuid,$xml); } else { // form view @@ -250,7 +250,7 @@ array_update_recursive($arrExistingConfig, $arrUpdatedConfig); $arrConfig = array_replace_recursive($arrExistingConfig, $arrUpdatedConfig); $xml = custom::createXML('domain',$arrConfig)->saveXML(); - $xml = $lv->appendqemucmdline($xml,$_POST["qemucmdline"]) ; + $xml = $lv->appendqemucmdline($xml,$_POST["qemucmdline"]); } else { echo json_encode(['error' => $error]); exit; @@ -283,24 +283,24 @@ $strXML = $lv->domain_get_xml($dom); $boolNew = false; $arrConfig = array_replace_recursive($arrConfigDefaults, domain_to_config($uuid)); - $arrVMUSBs = getVMUSBs($strXML) ; + $arrVMUSBs = getVMUSBs($strXML); } else { // edit new VM $boolRunning = false; $strXML = ''; $boolNew = true; $arrConfig = $arrConfigDefaults; - $arrVMUSBs = getVMUSBs($strXML) ; + $arrVMUSBs = getVMUSBs($strXML); } // Add any custom metadata field defaults (e.g. os) if (!$arrConfig['template']['os']) { $arrConfig['template']['os'] = ($arrConfig['domain']['clock']=='localtime' ? 'windows' : 'linux'); } $os_type = ((empty($arrConfig['template']['os']) || stripos($arrConfig['template']['os'], 'windows') === false) ? 'other' : 'windows'); - if (isset($arrConfig['clocks'])) $arrClocks = json_decode($arrConfig['clocks'],true) ; else { + if (isset($arrConfig['clocks'])) $arrClocks = json_decode($arrConfig['clocks'],true); else { if ($os_type == "windows") { - if ($arrConfig['domain']['hyperv'] == 1) $arrClocks = $arrDefaultClocks['hyperv'] ; else $arrClocks = $arrDefaultClocks['windows'] ; - } else $arrClocks = $arrDefaultClocks['other'] ; + if ($arrConfig['domain']['hyperv'] == 1) $arrClocks = $arrDefaultClocks['hyperv']; else $arrClocks = $arrDefaultClocks['windows']; + } else $arrClocks = $arrDefaultClocks['other']; } if (strpos($arrConfig['template']['name'],"User-") !== false) { @@ -356,7 +356,7 @@ @@ -407,10 +407,9 @@

- @@ -425,7 +424,7 @@ @@ -493,8 +492,8 @@ } ?> - - _(Max)_ _(Memory)_: + + _(Max)_ _(Memory)_:
@@ -567,8 +566,8 @@ >_(Enable USB boot)_: @@ -778,9 +777,7 @@ } } } - } - echo mk_option($default_option, 'manual', _('Manual')); ?>
@@ -932,9 +929,7 @@ } } } - } - echo mk_option('', 'manual', _('Manual')); ?>
@@ -980,7 +975,7 @@ $arrShare) { $strLabel = ($i > 0) ? appendOrdinalSuffix($i + 1) : ''; @@ -996,11 +991,11 @@ _(Unraid Share)_: @@ -1114,7 +1109,7 @@ ?> _(Multifunction)_: @@ -1128,10 +1123,10 @@ @@ -1164,11 +1159,11 @@ >_(VM Console Port)_: - > + > >_(VM Console WS Port)_: - > + > @@ -1329,7 +1324,7 @@ 'network' => $domain_bridge, 'mac' => "", 'model' => 'virtio-net' - ] ; + ]; } foreach ($arrConfig['nic'] as $i => $arrNic) { $strLabel = ($i > 0) ? appendOrdinalSuffix($i + 1) : ''; @@ -1419,9 +1414,7 @@
_(Machine)_:
@@ -1559,7 +1548,7 @@ @@ -1576,8 +1565,8 @@ - $arrTimer) { - if ($i =="offset") continue ; - if ($clockcount == 0) $clocksourcetext = _("Timer Source").":" ;else $clocksourcetext = "" ; + if ($i =="offset") continue; + if ($clockcount == 0) $clocksourcetext = _("Timer Source").":"; else $clocksourcetext = ""; ?> @@ -1678,8 +1667,6 @@ - -
_(QEMU Command Line)_:
_(Clocks)_
_(Clocks Offset)_: - - id="clockoffset" class="narrow" title="_(Clock Offset)_" >
: _(Present)_: - id="clock[][present]" class="narrow" title="_(Clock Offset)_" > _(Tickpolicy)_: - id="clock[][tickpolicy]" class="narrow" title="_(Clock Offset)_" >
@@ -1696,15 +1683,15 @@

Grab
- All grabs all input devices instead of just one + All grabs all input devices instead of just one

Repeat
- Repeat with value 'on'/'off' to enable/disable auto-repeat events + Repeat with value 'on'/'off' to enable/disable auto-repeat events

-

+

GrabToggle
GrabToggle with values ctrl-ctrl, alt-alt, shift-shift, meta-meta, scrolllock or ctrl-scrolllock to change the grab key combination

@@ -1758,7 +1745,6 @@ - @@ -1819,82 +1805,82 @@
@@ -753,8 +759,8 @@ String.prototype.md5 = function(){ return rh(a)+rh(b)+rh(c)+rh(d); } jQuery.prototype.hideMe = function() { - var hidden = $.cookie('hidden_content'); - hidden = hidden==null ? [] : hidden.split(';'); + var hidden = cookie.hidden_content; + hidden = hidden ? hidden.split(';') : []; if (hidden.indexOf(this.attr('sort'))>=0) this.find('tr:gt(0)').hide(); } jQuery.prototype.mixedView = function(s) { @@ -779,29 +785,12 @@ jQuery.prototype.mixedView = function(s) { }); } } -function sanitizeMultiCookie(cookieName, delimiter, removeDuplicates = false) { - // Some browser states leave multi-value cookies with nulls, empties or duplicates. - // This function cleans up any such cookies so that they do not break functionality. - try { - var uncleanCookie = $.cookie(cookieName); - if (uncleanCookie) { - uncleanCookie = uncleanCookie.split(delimiter); - var cleanCookie = uncleanCookie.filter(n => n); - if (removeDuplicates) { cleanCookie = [...new Set(cleanCookie)]; } - if (JSON.stringify(uncleanCookie) !== JSON.stringify(cleanCookie)) { - $.cookie(cookieName,cleanCookie.join(delimiter),{expires:3650}); - return true; - } else { - return false; - } - } else { - return false; - } - } catch (ex) { - return false; - } -} + +var cookie = JSON.parse(''); + +var cookie = {}; + var colors = ['','','#d77e0d','#d4ac0d','#cd5c5c','#ffc0cb','#e6e6fa','#9370db','#7cfc00','#228b22','#00ffff','#4682b4']; var blue = '#486dba'; // fallback color when too many graph elements exist var ports = []; @@ -810,8 +799,8 @@ var rxd = []; var txd = []; var cputime = 0; var nettime = 0; -var cpuline = $.cookie('cpuline')||30; -var netline = $.cookie('netline')||30; +var cpuline = cookie.cpuline||30; +var netline = cookie.netline||30; var update2 = true; var box = null; var startup = true; @@ -849,8 +838,38 @@ var options_net = { var cpuchart = new ApexCharts(document.querySelector('#cpuchart'), options_cpu); var netchart = new ApexCharts(document.querySelector('#netchart'), options_net); -if ($.cookie('port_select')!=null && !ports.includes($.cookie('port_select'))) $.removeCookie('port_select'); -var port_select = $.cookie('port_select')||ports[0]; +if (cookie.port_select && !ports.includes(cookie.port_select)) { + delete cookie.port_select; + saveCookie(); +} +var port_select = cookie.port_select||ports[0]; + +function saveCookie() { + $.post('/webGui/include/InitCharts.php',{cmd:'cookie',data:JSON.stringify(cookie)}); +} + +function sanitizeMultiCookie(cookieName, delimiter, removeDuplicates=false) { + // Some browser states leave multi-value cookies with nulls, empties or duplicates. + // This function cleans up any such cookies so that they do not break functionality. + try { + var uncleanCookie = $.cookie(cookieName); + if (uncleanCookie) { + uncleanCookie = uncleanCookie.split(delimiter); + var cleanCookie = uncleanCookie.filter(n => n); + if (removeDuplicates) { cleanCookie = [...new Set(cleanCookie)]; } + if (JSON.stringify(uncleanCookie) !== JSON.stringify(cleanCookie)) { + $.cookie(cookieName,cleanCookie.join(delimiter),{expires:3650}); + return true; + } else { + return false; + } + } else { + return false; + } + } catch (ex) { + return false; + } +} function initCharts(clear) { $.post('/webGui/include/InitCharts.php',{cmd:'get'},function(data) { @@ -879,12 +898,14 @@ function initCharts(clear) { nettime = x + 1; }); } + function resetCharts() { // prevent unlimited graph growing cpu = cpu.slice(-cpuline); rxd = rxd.slice(-netline); txd = txd.slice(-netline); } + function addChartCpu(load) { cputime++; var i = cpu.length - cpuline; @@ -895,6 +916,7 @@ function addChartCpu(load) { } cpu.push({x:cputime, y:load}); } + function addChartNet(rx, tx) { nettime++; var i = rxd.length - netline; @@ -908,6 +930,7 @@ function addChartNet(rx, tx) { rxd.push({x:nettime, y:rx}); txd.push({x:nettime, y:tx}); } + function toggleVPN(id,vtun) { var up = $('#vpn-active'); @@ -928,23 +951,28 @@ function toggleVPN(id,vtun) { } } + function noApps() { if ($('span.outer.apps:visible').length==0) $('#no_apps').show(); else $('#no_apps').hide(); } + function noVMs() { if ($('span.outer.vms:visible').length==0) $('#no_vms').show(); else $('#no_vms').hide(); } + function loadlist(init) { if (init) { - $('#apps').switchButton({labels_placement:'right', off_label:"_(All Apps)_", on_label:"_(Started only)_", checked:$.cookie('my_apps')=='startedOnly'}); - $('#vms').switchButton({labels_placement:'right', off_label:"_(All VMs)_", on_label:"_(Started only)_", checked:$.cookie('my_vms')=='startedOnly'}); + $('#apps').switchButton({labels_placement:'right', off_label:"_(All Apps)_", on_label:"_(Started only)_", checked:cookie.my_apps=='startedOnly'}); + $('#vms').switchButton({labels_placement:'right', off_label:"_(All VMs)_", on_label:"_(Started only)_", checked:cookie.my_vms=='startedOnly'}); $('#apps').change(function(){ $('span.outer.apps.stopped').finish().toggle('fast',function(){noApps();}) - $('#apps').is(':checked') ? $.cookie('my_apps','startedOnly',{expires:3650}) : $.removeCookie('my_apps'); + $('#apps').is(':checked') ? cookie.my_apps = 'startedOnly' : delete cookie.my_apps; + saveCookie(); }); $('#vms').change(function(){ $('span.outer.vms.stopped').finish().toggle('fast',function(){noVMs();}); - $('#vms').is(':checked') ? $.cookie('my_vms','startedOnly',{expires:3650}) : $.removeCookie('my_vms'); + $('#vms').is(':checked') ? cookie.my_vms = 'startedOnly' : delete cookie.my_vms; + saveCookie(); }); } $.post('/webGui/include/DashboardApps.php',{docker:'',vms:'',vmusage:''},function(d) { @@ -963,10 +991,11 @@ function loadlist(init) { $('#vm_view_usage').append(data[2]).hideMe(); $('.apps.switch').html("_(Containers)_ -- _(Started)_: "+started_apps+", _(Stopped)_: "+stopped_apps+", _(Paused)_: "+paused_apps); $('.vms.switch').html("_(VMs)_ -- _(Started)_: "+started_vms+", _(Stopped)_: "+stopped_vms+", _(Paused)_: "+paused_vms); - if ($.cookie('my_apps')!=null) $('span.apps.stopped').hide(0,noApps()); - if ($.cookie('my_vms')!=null) $('span.vms.stopped').hide(0,noVMs()); + if (cookie.my_apps!=null) $('span.apps.stopped').hide(0,noApps()); + if (cookie.my_vms!=null) $('span.vms.stopped').hide(0,noVMs()); }); } + function getCase() { $.post('/webGui/include/SelectCase.php',{mode:'get',file:''},function(model){ if (!model) { @@ -979,8 +1008,10 @@ function getCase() { } }); } + function changeMode(item) { - if (item==0) $.removeCookie('enter_share'); else $.cookie('enter_share',item,{expires:3650}); + if (item==0) delete cookie.enter_share; else cookie.enter_share = item; + if (!startup) saveCookie(); if (startup || $('.smb.share1').parent().find('tr:eq(1)').is(':visible')) { if (item==0) $('.smb.share1').show(); else $('.smb.share1').hide(); @@ -999,23 +1030,30 @@ function changeMode(item) { $('select[name="enter_user"]').val(item); } + function changeView(item) { - if (item==0) $.removeCookie('enter_view'); else $.cookie('enter_view',item,{expires:3650}); + if (item==0) delete cookie.enter_view; else cookie.enter_view = item; + if (!startup) saveCookie(); if (item==0) $('.view1').show(); else $('.view1').hide(); if (item==1) $('.view2').show(); else $('.view2').hide(); if (item==2) $('.view3').show(); else $('.view3').hide(); if (item==3) $('.view4').show(); else $('.view4').hide(); } + function changeCPUline(val) { cpuline = val; - if (val==30) $.removeCookie('cpuline'); else $.cookie('cpuline',val,{expires:3650}); + if (val==30) delete cookie.cpuline; else cookie.cpuline = val; + saveCookie(); cpuchart.updateOptions({xaxis:{range:cpuline-1}}); } + function changeNetline(val) { netline = val; - if (val==30) $.removeCookie('netline'); else $.cookie('netline',val,{expires:3650}); + if (val==30) delete cookie.netline; else cookie.netline = val; + saveCookie(); netchart.updateOptions({xaxis:{range:netline-1}}); } + function smartMenu(table) { $(table).find('[id^="smart-"]').each(function() { var opts = []; @@ -1037,6 +1075,7 @@ function smartMenu(table) { context.attach(id,opts); }); } + function portMenu() { var select = 'select[name="port_select"]'; var option = $(select+' option'); @@ -1044,11 +1083,14 @@ function portMenu() { if (option[i].value == port_select) {option[i].selected = true; break;} } } + function portSelect(name) { - $.cookie('port_select',name,{expires:3650}); + cookie.port_select = name; + saveCookie(); initCharts(true); port_select = name; } + function moreInfo(data,table) { var info = []; if (data[1]>0) info.push(data[1]+' '+(data[1]==1 ? "_(device warning)_" : "_(device warnings)_")); @@ -1057,6 +1099,7 @@ function moreInfo(data,table) { if (data[4]>0) info.push(data[4]+' '+(data[4]==1 ? "_(utilization warning)_" : "_(utilization warnings)_")); return info.length ? "
"+table+" _(has)_ "+info.join('. ')+".
" : ""; } + function autoscale(value,text,size,kilo) { if (kilo==null) kilo = 1000; var unit = kilo==1024 ? ['','ki','Mi','Gi','Ti','Pi','Ei'] : ['','k','M','G','T','P','E']; @@ -1066,42 +1109,52 @@ function autoscale(value,text,size,kilo) { if (data==0) base=0; return ((Math.round(scale*data)/scale)+' '+unit[base]+text).replace(".",""); } + function update900() { // prevent chart overflowing, reset every 15 minutes resetCharts(); setTimeout(update900,900000); } + function attributes(page,disk) { var tab = page=='New' ? 'tab2' : 'tab3'; $.cookie('one',tab); location.replace('/Dashboard/'+page+'?name='+disk); } + function capabilities(page,disk) { var tab = page=='New' ? 'tab3' : 'tab4'; $.cookie('one',tab); location.replace('/Dashboard/'+page+'?name='+disk); } + function identity(page,disk) { var tab = page=='New' ? 'tab4' : 'tab5'; $.cookie('one',tab); location.replace('/Dashboard/'+page+'?name='+disk); } + function acknowledge(id,disk) { $.post('/webGui/include/Acknowledge.php',{disk:disk},function(){ $(id).removeClass('fa-thumbs-o-down orange-text').addClass('fa-thumbs-o-up green-text');$(id.replace('smart','text')).text(""); }); } + function dropdown(menu) { var select = 'select[name="'+menu+'"]'; var size = $(select+' option').length; - var option = $.cookie(menu)||0; + var option = cookie[menu]||0; if (option >= size) option = 0; $(select+' option')[option].selected = true; $(select).change(); } + function toggleCPU(init) { - if (!init) {if ($.cookie('cpu')==null) $.cookie('cpu','close',{expires:3650}); else $.removeCookie('cpu');} - if ($.cookie('cpu')==null) { + if (!init) { + if (!cookie.cpu) cookie.cpu = 'close'; else delete cookie.cpu; + saveCookie(); + } + if (!cookie.cpu) { $('.cpu_open').show(); $('.cpu_close').text("_(Hide details)_"); } else { @@ -1110,13 +1163,17 @@ function toggleCPU(init) { } setTimeout(function(){toggleChart(true);}); } + function toggleChart(init) { - if (!init) {if ($.cookie('cpu-chart')==null) $.cookie('cpu-chart','close',{expires:3650}); else $.removeCookie('cpu-chart');} + if (!init) { + if (!cookie.cpu_chart) cookie.cpu_chart = 'close'; else delete cookie.cpu_chart; + saveCookie(); + } $('#cpu_main').removeClass('last'); $('.cpu_open:last').removeClass('last'); - if ($.cookie('cpu-chart')==null) { - var hidden = $.cookie('hidden_content'); - hidden = hidden==null ? [] : hidden.split(';'); + if (!cookie.cpu_chart) { + var hidden = cookie.hidden_content; + hidden = hidden ? hidden.split(';') : []; if (hidden.indexOf($('#cpu_main').parent().attr('sort'))==-1) { $('#cpu_chart').show(); $('#cpuline').show(); @@ -1130,6 +1187,7 @@ function toggleChart(init) { if ($('.cpu_open').is(':visible')) $('.cpu_open:last').addClass('last'); else $('#cpu_main').addClass('last'); } } + function StopArray() { swal({title:"_(Proceed)_?",text:"_(This will stop the array)_",type:'warning',html:true,showCancelButton:true,confirmButtonText:"_(Proceed)_",cancelButtonText:"_(Cancel)_"},function(){StopArrayNow();}); @@ -1137,10 +1195,12 @@ function StopArray() { StopArrayNow(); } + function StopArrayNow() { $('span.hand').prop('onclick',null).off('click').addClass('busy').css({'cursor':'default'}); $.post('/update.htm',{startState:'', cmdStop:'Stop'},function(){refresh();}); } + function StartArray() { swal({title:"_(Proceed)_?",text:"_(This will start the array)_",type:'warning',html:true,showCancelButton:true,confirmButtonText:"_(Proceed)_",cancelButtonText:"_(Cancel)_"},function(){StartArrayNow();}); @@ -1148,10 +1208,12 @@ function StartArray() { StartArrayNow(); } + function StartArrayNow() { $('span.hand').prop('onclick',null).off('click').addClass('busy').css({'cursor':'default'}); $.post('/update.htm',{startState:'', cmdStart:'Start'},function(){refresh();}); } + function Reboot() { swal({title:"_(Proceed)_?",text:"_(This will reboot the system)_",type:'warning',html:true,showCancelButton:true,confirmButtonText:"_(Proceed)_",cancelButtonText:"_(Cancel)_"},function(){RebootNow();}); @@ -1159,10 +1221,12 @@ function Reboot() { RebootNow(); } + function RebootNow() { document.boot.cmd.value = 'reboot'; document.boot.submit(); } + function Shutdown() { swal({title:"_(Proceed)_?",text:"_(This will shutdown the system)_",type:'warning',html:true,showCancelButton:true,confirmButtonText:"_(Proceed)_",cancelButtonText:"_(Cancel)_"},function(){ShutdownNow();}); @@ -1170,10 +1234,12 @@ function Shutdown() { ShutdownNow(); } + function ShutdownNow() { document.boot.cmd.value = 'shutdown'; document.boot.submit(); } + function Sleep() { @@ -1182,16 +1248,17 @@ function Sleep() { SleepNow(); } + function SleepNow() { $('#statusraid').append(' • System in sleep mode'); $.get('/plugins/dynamix.s3.sleep/include/SleepMode.php',function(){refresh();}); } + function sortTables() { $('table.dashboard').each(function(){ var table = $(this); - sanitizeMultiCookie(table.prop('id'), ';', true); - var index = $.cookie(table.prop('id')); + var index = cookie[table.prop('id')]; // sorting list exists if (index != null) { index = index.split(';'); @@ -1211,6 +1278,7 @@ function sortTables() { }); $('table.dashboard tbody').before(stopgap); } + function addProperties() { $('div.frame tbody.system').addClass('sortable').attr('sort','_system_information_'.md5()); $('div.frame tbody.system').find('td:first').prepend(""); @@ -1233,10 +1301,10 @@ function addProperties() { function(){if ($(this)[0].offsetWidth < $(this)[0].scrollWidth) {recall.html(recover); recall=null;}} ); } + function showContent() { - var count = {'db-box1':$('table#db-box1 tbody').length, 'db-box2':$('table#db-box2 tbody').length, 'db-box3':$('table#db-box3 tbody').length} - sanitizeMultiCookie('inactive_content', ';', true); - var inactive = $.cookie('inactive_content'); + var count = {'db_box1':$('table#db_box1 tbody').length, 'db_box2':$('table#db_box2 tbody').length, 'db_box3':$('table#db_box3 tbody').length} + var inactive = cookie.inactive_content; if (inactive) { inactive = inactive.split(';'); for (let n=0,md5; md5=inactive[n]; n++) { @@ -1247,8 +1315,7 @@ function showContent() { tbody.prev().hide(); } } - sanitizeMultiCookie('hidden_content', ';', true); - var hidden = $.cookie('hidden_content'); + var hidden = cookie.hidden_content; if (hidden) { hidden = hidden.split(';'); for (let n=0,md5; md5=hidden[n]; n++) { @@ -1259,25 +1326,28 @@ function showContent() { tbody.find('span.button').hide(); } } - if (count['db-box1']>0) $('div#tile1').show(); - if (count['db-box2']>0) $('div#tile2').show(); - if (count['db-box3']>0) $('div#tile3').show(); + if (count['db_box1']>0) $('div#tile1').show(); + if (count['db_box2']>0) $('div#tile2').show(); + if (count['db_box3']>0) $('div#tile3').show(); } + function setColor(l, t1, t2) { switch (true) { case (t1 > 0 && l >= t1): return 'redbar'; case (t2 > 0 && l >= t2): return 'orangebar'; default: return '';} } + function fontColor(l, t1, t2) { switch (true) { case (t1 > 0 && l >= t1): return '#f0000c'; case (t2 > 0 && l >= t2): return '#e68a00'; default: return '#4f8a10';} } + function openClose(button) { - var hidden = $.cookie('hidden_content'); - hidden = hidden==null ? [] : hidden.split(';'); + var hidden = cookie.hidden_content; + hidden = hidden ? hidden.split(';') : []; if (button) { // show/hide single tile content var tbody = button.closest('tbody'); @@ -1290,7 +1360,7 @@ function openClose(button) { tbody.mixedView(1); hidden.splice(hidden.indexOf(tbody.attr('sort')),1); } - $.cookie('hidden_content',hidden.join(';'),{expires:3650}); + cookie.hidden_content = hidden.join(';'); } else { // show/hide all tiles content if (hidden.length==0) { @@ -1299,34 +1369,39 @@ function openClose(button) { $(this).mixedView(0); hidden.push($(this).attr('sort')); }); - $.cookie('hidden_content',hidden.join(';'),{expires:3650}); + cookie.hidden_content = hidden.join(';'); } else { $('div.frame tbody').each(function(){ $(this).find('.openclose').removeClass('fa-chevron-up fa-chevron-down').addClass('fa-chevron-up'); $(this).mixedView(1); }); - $.removeCookie('hidden_content'); + delete cookie.hidden_content; } } + saveCookie(); } + function dismiss(button) { var tbody = button.closest('tbody'); var table = tbody.parent(); var tile = table.parent(); - var inactive = $.cookie('inactive_content'); + var inactive = cookie.inactive_content; tbody.hide(); tbody.prev().hide(); if (table.find('tbody:visible').length>0) tile.show(); else tile.hide(); - inactive = inactive==null ? [] : inactive.split(';'); + inactive = inactive ? inactive.split(';') : []; inactive.push(tbody.attr('sort')); - $.cookie('inactive_content',inactive.join(';'),{expires:3650}); + cookie.inactive_content = inactive.join(';'); + saveCookie(); } + function dialogStyle() { $('.ui-dialog-titlebar-close').css({'display':'none'}); $('.ui-dialog-title').css({'text-align':'center','width':'100%','font-size':'1.8rem'}); $('.ui-dialog-content').css({'padding-top':'15px','vertical-align':'bottom'}); $('.ui-button-text').css({'padding':'0px 5px'}); } + function contentMgmt() { box = $("#iframe-popup"); box.html($("#templateContentMgmt").html().build()); @@ -1338,11 +1413,12 @@ function contentMgmt() { modal: true, buttons: { "_(Reset)_": function(){ - $.removeCookie('db-box1'); - $.removeCookie('db-box2'); - $.removeCookie('db-box3'); - $.removeCookie('inactive_content'); - $.removeCookie('hidden_content'); + delete cookie.db_box1; + delete cookie.db_box2; + delete cookie.db_box3; + delete cookie.inactive_content; + delete cookie.hidden_content; + saveCookie(); box.dialog('close'); location.reload(); }, @@ -1363,6 +1439,7 @@ function contentMgmt() { }); dialogStyle(); } + function VMClone(uuid, name){ box = $("#iframe-popup"); box.html($("#templateClone").html()); @@ -1399,6 +1476,7 @@ function VMClone(uuid, name){ }); dialogStyle(); } + function selectsnapshot(uuid, name ,snaps, opt, getlist, state,fstype){ box = $("#iframe-popup"); box.html($("#templatesnapshot"+opt).html()); @@ -1486,7 +1564,7 @@ function LockButton() { $('i.tile').show(); $('tbody.sortable').css({'cursor':'move'}); $('div.nav-item.LockButton span').text("_(Lock sortable items)_"); - $('#db-box1,#db-box2,#db-box3').sortable({connectWith:'#db-box1,#db-box2,#db-box3'}); + $('#db_box1,#db_box2,#db_box3').sortable({connectWith:'#db_box1,#db_box2,#db_box3'}); $('table.dashboard').sortable({helper:sortableHelper,items:'.sortable',cursor:'grab',opacity:0.6,placeholder:'dashboard-sortable',zIndex:9999,forceHelperSize:true,forcePlaceholderSize:true, receive:function(e,ui){ var table = ui.sender, index = []; @@ -1500,13 +1578,14 @@ function LockButton() { gap.hide(); } table.find('tbody').each(function(){index.push($(this).attr('sort'));}); - $.cookie(table.prop('id'),index.join(';'),{expires:3650}); + cookie[table.prop('id')] = index.join(';'); }, stop:function(e,ui){ var table = ui.item.parent(), index = []; if (ui.item.prev().html().search('stopgap')>0) ui.item.after(stopgap); else ui.item.before(stopgap); table.find('tbody').each(function(){index.push($(this).attr('sort'));}); - $.cookie(table.prop('id'),index.join(';'),{expires:3650}); + cookie[table.prop('id')] = index.join(';'); + saveCookie(); }}); } else { $.removeCookie('lockbutton'); @@ -1690,6 +1769,7 @@ dashboard.on('message',function(msg,meta) { break; } }); + var apcups = new NchanSubscriber('/sub/apcups',{subscriber:'websocket'}); apcups.on('message',function(msg) { diff --git a/emhttp/plugins/dynamix/DateTime.page b/emhttp/plugins/dynamix/DateTime.page index 3c1c13f5a..6edddfdeb 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)_: : _(Date format)_: : _(Time format)_: : _(Time zone)_: : :timezone_help: -_(Use NTP)_: -: + + + + _(No suitable interfaces found for PTP)_ -:use_ntp_help: - +
_(NTP interval)_: -: _(Use DEFAULT setting when public NTP servers are defined)_ +: + _(Use DEFAULT setting when public NTP servers are defined)_ _(NTP server)_ 1: : - -:ntp_server1_help: + _(Input a NTP server name, NTP pool name or IP address)_ _(NTP server)_ 2: : -:ntp_server2_help: - _(NTP server)_ 3: : -:ntp_server3_help: - _(NTP server)_ 4: : -:ntp_server4_help: +
+
+_(PTP profile)_: +: PTPv2 (IEEE 1588) +_(PTP transport)_: +: + +_(PTP mode)_: +: + +
+_(PTP server)_ 1: +: + _(Input a IPv4 address)__(Input a IPv6 address)__(Input a MAC address)_ + +_(PTP server)_ 2: +: + +_(PTP server)_ 3: +: + +_(PTP server)_ 4: +: + +
+_(PTP interface)_: +: + +_(PTP clock)_: +: + +
+
_(New date and time)_: -: "> +: "> + _(Input the correct date and time manually)_ :current_time_help: +
  -: +: diff --git a/emhttp/plugins/dynamix/Eth0.page b/emhttp/plugins/dynamix/Eth0.page index c7f1de5f9..f7ea8b6cb 100644 --- a/emhttp/plugins/dynamix/Eth0.page +++ b/emhttp/plugins/dynamix/Eth0.page @@ -3,8 +3,8 @@ Title="_(Interface)_ eth0" Tag="icon-ethernet" --- '8', '255.255.0.0' => '16', '255.255.128.0' => '17', '255.255.192.0' => '18', + '255.255.224.0' => '19', '255.255.240.0' => '20', '255.255.248.0' => '21', '255.255.252.0' => '22', + '255.255.254.0' => '23', '255.255.255.0' => '24', '255.255.255.128' => '25', '255.255.255.192' => '26', + '255.255.255.224' => '27', '255.255.255.240' => '28', '255.255.255.248' => '29', '255.255.255.252' => '30' +]; // get available ethernet ports (excluding eth0) exec("ls --indicator-style=none /sys/class/net|grep -P '^eth[1-9][0-9]*$'",$ports); @@ -71,13 +77,49 @@ $vlan_eth0 = $sort_eth0 = []; if (isset($eth0)) foreach (vlanID($eth0) as $key => $val) {$vlan_eth0[] = index($key); $sort_eth0[] = (int)$val;} array_multisort($sort_eth0,$vlan_eth0); ?> + - + +
 
+
+ +
+_(IPv4 DNS server assignment)_: +: + +:eth_ipv4_dns_server_assignment_help: + +
+_(IPv4 DNS server)_ 1: +: + +:eth_ipv4_dns_server_help: + +_(IPv4 DNS server)_ 2: +: + +:eth_ipv4_dns_server2_help: + +_(IPv4 DNS server)_ 3: +: + +:eth_ipv4_dns_server3_help: + +
+
+
+_(IPv6 DNS server assignment)_: +: + +:eth_ipv6_dns_server_assignment_help: + +
+_(IPv6 DNS server)_ 1: +: + +:eth_ipv6_dns_server_help: + +_(IPv6 DNS server)_ 2: +: + +:eth_ipv6_dns_server2_help: + +_(IPv6 DNS server)_ 3: +: + +:eth_ipv6_dns_server3_help: + +
+
+ +
+ + @@ -433,29 +527,37 @@ $(function() { + + + + + + + + + _(Interface description)_: -: - " oninput="noRun(this.form)"> +: "> + :eth_interface_description_help: -
@@ -93,4 +71,3 @@ _(Enter route + gateway + metric)_: : - diff --git a/emhttp/plugins/dynamix/Settings.page b/emhttp/plugins/dynamix/Settings.page index 16cc0c12d..017f7876a 100644 --- a/emhttp/plugins/dynamix/Settings.page +++ b/emhttp/plugins/dynamix/Settings.page @@ -7,7 +7,7 @@ Code="e924" if (!isset($display['favorites'])) { $favorites = true; } else { - $favorites = $display['favorites'] == "yes" ? true : false; + $favorites = $display['favorites'] == "yes" ? 'true' : 'false'; } ?> diff --git a/emhttp/plugins/dynamix/default.cfg b/emhttp/plugins/dynamix/default.cfg index 500f5fa32..9096beced 100644 --- a/emhttp/plugins/dynamix/default.cfg +++ b/emhttp/plugins/dynamix/default.cfg @@ -34,6 +34,7 @@ rtl="" headermetacolor="" headerdescription="yes" showBannerGradient="yes" +favorites="yes" [parity] mode="0" hour="0 0" diff --git a/emhttp/plugins/dynamix/include/DashboardApps.php b/emhttp/plugins/dynamix/include/DashboardApps.php index 871d29abb..aa49190a6 100644 --- a/emhttp/plugins/dynamix/include/DashboardApps.php +++ b/emhttp/plugins/dynamix/include/DashboardApps.php @@ -1,6 +1,6 @@ 0) { $wsport = $lv->domain_get_ws_port($res); - $vmrcprotocol = $lv->domain_get_vmrc_protocol($res) ; + $vmrcprotocol = $lv->domain_get_vmrc_protocol($res); if ($vmrcprotocol == "vnc") $vmrcscale = "&resize=scale"; else $vmrcscale = ""; - $vmrcurl = autov('/plugins/dynamix.vm.manager/'.$vmrcprotocol.'.html',true).$vmrcscale.'&autoconnect=true&host=' . $_SERVER['HTTP_HOST'] ; - if ($vmrcprotocol == "spice") $vmrcurl .= '&vmname='. urlencode($vm) . '&port=/wsproxy/'.$vmrcport.'/' ; else $vmrcurl .= '&port=&path=/wsproxy/' . $wsport . '/'; + $vmrcurl = autov('/plugins/dynamix.vm.manager/'.$vmrcprotocol.'.html',true).$vmrcscale.'&autoconnect=true&host=' . $_SERVER['HTTP_HOST']; + if ($vmrcprotocol == "spice") $vmrcurl .= '&vmname='. urlencode($vm) . '&port=/wsproxy/'.$vmrcport.'/'; else $vmrcurl .= '&port=&path=/wsproxy/' . $wsport . '/'; } elseif ($vmrcport == -1 || $autoport) { - $vmrcprotocol = $lv->domain_get_vmrc_protocol($res) ; - if ($autoport == "yes") $auto = "auto" ; else $auto="manual" ; + $vmrcprotocol = $lv->domain_get_vmrc_protocol($res); + $auto = ($autoport == "yes") ? "auto" : "manual"; } elseif (!empty($arrConfig['gpu'])) { $arrValidGPUDevices = getValidGPUDevices(); foreach ($arrConfig['gpu'] as $arrGPU) { foreach ($arrValidGPUDevices as $arrDev) { if ($arrGPU['id'] == $arrDev['id']) { if (count(array_filter($arrValidGPUDevices, function($v) use ($arrDev) { return $v['name'] == $arrDev['name']; })) > 1) { - $vmrcprotocol = "VGA" ; + $vmrcprotocol = "VGA"; } else { - $vmrcprotocol = "VGA" ; + $vmrcprotocol = "VGA"; } } } } - } + } $template = $lv->_get_single_xpath_result($res, '//domain/metadata/*[local-name()=\'vmtemplate\']/@name'); if (empty($template)) $template = 'Custom'; $log = (is_file("/var/log/libvirt/qemu/$vm.log") ? "libvirt/qemu/$vm.log" : ''); - if (!isset($domain_cfg["CONSOLE"])) $vmrcconsole = "web" ; else $vmrcconsole = $domain_cfg["CONSOLE"] ; - if (!isset($domain_cfg["RDPOPT"])) $vmrcconsole .= ";no" ; else $vmrcconsole .= ";".$domain_cfg["RDPOPT"] ; + if (!isset($domain_cfg["CONSOLE"])) $vmrcconsole = "web"; else $vmrcconsole = $domain_cfg["CONSOLE"]; + if (!isset($domain_cfg["RDPOPT"])) $vmrcconsole .= ";no"; else $vmrcconsole .= ";".$domain_cfg["RDPOPT"]; $WebUI = html_entity_decode($arrConfig["template"]["webui"]); $menu = sprintf("onclick=\"addVMContext('%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s')\"", addslashes($vm), addslashes($uuid), addslashes($template), $state, addslashes($vmrcurl), strtoupper($vmrcprotocol), addslashes($log),addslashes($fstype), $vmrcconsole,false,addslashes(str_replace('"',"'",$WebUI))); $icon = $lv->domain_get_icon_url($res); @@ -153,7 +183,7 @@ if ($_POST['vms']) { #Build VM Usage array. $menuusage = sprintf("onclick=\"addVMContext('%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s')\"", addslashes($vm), addslashes($uuid), addslashes($template), $state, addslashes($vmrcurl), strtoupper($vmrcprotocol), addslashes($log),addslashes($fstype), $vmrcconsole,true,addslashes(str_replace('"',"'",$WebUI))); $vmusagehtml[] = "$image$vm
"._($status)."
"; - $vmusagehtml[] = "

"._("Loading")."...."; + $vmusagehtml[] = "

"._("Loading")."...."; $vmusagehtml[] = "
"._("Loading")."...."; $vmusagehtml[] = "
"._("Loading")."...."; $vmusagehtml[] = "
"._("Loading")."...."; diff --git a/emhttp/plugins/dynamix/include/DefaultPageLayout.php b/emhttp/plugins/dynamix/include/DefaultPageLayout.php index 6cb750a5c..b8f39ce4a 100644 --- a/emhttp/plugins/dynamix/include/DefaultPageLayout.php +++ b/emhttp/plugins/dynamix/include/DefaultPageLayout.php @@ -20,6 +20,7 @@ $themes2 = in_array($theme,['gray','azure']); $config = "/boot/config"; $entity = $notify['entity'] & 1 == 1; $alerts = '/tmp/plugins/my_alerts.txt'; +$wlan0 = file_exists('/sys/class/net/wlan0'); // adjust the text color in docker log window $fgcolor = in_array($theme,['white','azure']) ? '#1c1c1c' : '#f2f2f2'; @@ -77,6 +78,7 @@ html{font-size:%} _(Please try a different browser)_",type:'error',html:true,confirmButtonText:"_(Ok)_"}); + swal({title:"_(Unsupported Feature)_",text:"_(Sorry, this feature is not supported by MSIE/Edge)_.
_(Please try a different browser)_",type:'error',html:true,animation:'none',confirmButtonText:"_(Ok)_"}); return; } // open terminal window (run in background) @@ -409,7 +411,7 @@ function openDone(data) { if (data == '_DONE_') { $('div.spinner.fixed').hide(); $('button.confirm').text("").prop('disabled',false).show(); - if ( typeof ca_done_override !== 'undefined' ) { + if (typeof ca_done_override !== 'undefined') { if (ca_done_override == true) { $("button.confirm").trigger("click"); ca_done_override = false; @@ -529,7 +531,7 @@ function hideUpgrade(set) { /** @note can likely be removed, not used in webgui } function confirmUpgrade(confirm) { if (confirm) { - swal({title:" Unraid OS",text:"?",type:'warning',html:true,showCancelButton:true,closeOnConfirm:false,confirmButtonText:"",cancelButtonText:""},function(){ + swal({title:" Unraid OS",text:"?",type:'warning',html:true,animation:'none',showCancelButton:true,closeOnConfirm:false,confirmButtonText:"",cancelButtonText:""},function(){ openPlugin("plugin update unRAIDServer.plg"," Unraid OS"); }); } else { @@ -654,6 +656,7 @@ $.ajaxPrefilter(function(s, orig, xhr){ + 0) echo "\n
_(Protocol)__(Route)__(Gateway)__(Metric)__(Delete)_