Merge pull request #570 from bergware/master

Miscellaneous updates
This commit is contained in:
tom mortensen
2020-01-08 22:17:27 -08:00
committed by GitHub
10 changed files with 43 additions and 25 deletions

View File

@@ -39,14 +39,12 @@ $arrWhitelist = [
'/webGui/images/case-model.png',
'/webGui/images/green-on.png'
];
foreach ($arrWhitelist as $strWhitelist) {
if (strpos($_SERVER['REQUEST_URI'], $strWhitelist) === 0) {
http_response_code(200);
exit;
}
if (in_array($_SERVER['REQUEST_URI'],$arrWhitelist)) {
// authorized
http_response_code(200);
} else {
// non-authorized
//error_log(print_r($_SERVER, true));
http_response_code(401);
}
// non-authorized
//error_log(print_r($_SERVER, true));
http_response_code(401);
exit;

View File

@@ -227,7 +227,6 @@ Docker LOG number of files:
> Specifies the number of LOG files when LOG rotation is done.
</div>
Template Authoring Mode:
: <select id="DOCKER_AUTHORING_MODE" name="DOCKER_AUTHORING_MODE">
<?=mk_option($dockercfg['DOCKER_AUTHORING_MODE'], 'no', 'No')?>
@@ -236,6 +235,15 @@ Template Authoring Mode:
> If set to **Yes**, when creating/editing containers the interface will be present with some extra fields related to template authoring.
Host access to custom networks:
: <select name="DOCKER_ALLOW_ACCESS">
<?=mk_option($dockercfg['DOCKER_ALLOW_ACCESS'], '', 'Disabled')?>
<?=mk_option($dockercfg['DOCKER_ALLOW_ACCESS'], 'yes', 'Enabled')?>
</select>
> Allows direct communication between the host and containers using a custom (macvlan) network.<br>
> By default this is prohibited.
Preserve user defined networks:
: <select name="DOCKER_USER_NETWORKS">
<?=mk_option($dockercfg['DOCKER_USER_NETWORKS'], 'remove', 'No')?>
@@ -432,6 +440,12 @@ Docker LOG rotation:
> By default a single unlimited LOG file is created. Otherwise LOG file size and number of files are limited when LOG rotation is enabled.
Host access to custom networks:
: <?=$dockercfg['DOCKER_ALLOW_ACCESS']==''?'Disabled':'Enabled'?>
> Allows direct communication between the host and containers using a custom (macvlan) network.<br>
> By default this is prohibited.
Preserve user defined networks:
: <?=$dockercfg['DOCKER_USER_NETWORKS']=='preserve'?'Yes':'No'?>

View File

@@ -5,3 +5,4 @@ DOCKER_LOG_SIZE="50m"
DOCKER_LOG_FILES="1"
DOCKER_AUTHORING_MODE="no"
DOCKER_USER_NETWORKS="remove"
DOCKER_ALLOW_ACCESS=""

View File

@@ -1,7 +1,7 @@
<?PHP
/* Copyright 2005-2018, Lime Technology
* Copyright 2015-2018, Guilherme Jardim, Eric Schultz, Jon Panozzo.
* Copyright 2012-2018, Bergware International.
/* Copyright 2005-2019, Lime Technology
* Copyright 2015-2019, Guilherme Jardim, Eric Schultz, Jon Panozzo.
* Copyright 2012-2019, Bergware International.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License version 2,
@@ -20,7 +20,6 @@ require_once "$docroot/webGui/include/Helpers.php";
libxml_use_internal_errors(false); # Enable xml errors
$var = parse_ini_file('state/var.ini');
$cfg = parse_ini_file('boot/config/docker.cfg');
ignore_user_abort(true);
$DockerClient = new DockerClient();

View File

@@ -1,7 +1,7 @@
<?PHP
/* Copyright 2005-2018, Lime Technology
* Copyright 2014-2018, Guilherme Jardim, Eric Schultz, Jon Panozzo.
* Copyright 2012-2018, Bergware International.
/* Copyright 2005-2019, Lime Technology
* Copyright 2014-2019, Guilherme Jardim, Eric Schultz, Jon Panozzo.
* Copyright 2012-2019, Bergware International.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License version 2,
@@ -13,7 +13,7 @@
?>
<?
$docroot = $docroot ?? $_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
libxml_use_internal_errors(true); # Suppress any warnings from xml errors.
libxml_use_internal_errors(true); # Suppress any warnings from xml errors.
require_once "$docroot/plugins/dynamix.docker.manager/include/Helpers.php";
@@ -762,7 +762,7 @@ class DockerClient {
}
public function pullImage($image, $callback=null) {
$header = null;
$header = null;
$registryAuth = $this->getRegistryAuth( $image );
if ( $registryAuth ) {
$header = 'X-Registry-Auth: ' . base64_encode( json_encode( [
@@ -944,16 +944,19 @@ class DockerUtil {
public static function myIP($name, $version=4) {
$ipaddr = $version==4 ? 'IPAddress' : 'GlobalIPv6Address';
return static::docker("inspect --format='{{range .NetworkSettings.Networks}}{{.$ipaddr}}{{end}}' $name");
return rtrim(static::docker("inspect --format='{{range .NetworkSettings.Networks}}{{.$ipaddr}} {{end}}' $name"));
}
public static function driver() {
$list = [];
foreach (static::docker("network ls --format='{{.Name}}={{.Driver}}'",true) as $network) {list($name,$driver) = explode('=',$network); $list[$name] = $driver;}
return $list;
}
public static function custom() {
return static::docker("network ls --filter driver='bridge' --filter driver='macvlan' --format='{{.Name}}'|grep -v '^bridge$'",true);
}
public static function network($more) {
$list = ['bridge'=>'', 'host'=>'', 'none'=>''];
foreach ($more as $net) $list[$net] = substr(static::docker("network inspect --format='{{range .IPAM.Config}}{{.Subnet}}, {{end}}' $net"),0,-1);

View File

@@ -18,6 +18,10 @@ Code="e93f"
?>
<script>
function TerminalButton() {
if (/MSIE|Edge/.test(navigator.userAgent)) {
swal({title:'Unsupported Feature',text:'Sorry, this feature is not supported by MSIE/Edge.<br>Please try a different browser',html:true,type:'error'});
return;
}
var d = new Date();
var height = 600;
var width = 900;

View File

@@ -3,8 +3,8 @@ Title="Add User"
Tag="user"
---
<?PHP
/* Copyright 2005-2018, Lime Technology
* Copyright 2012-2018, Bergware International.
/* Copyright 2005-2019, Lime Technology
* Copyright 2012-2019, Bergware International.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License version 2,

View File

@@ -504,6 +504,7 @@ foreach ($pages as $page) {
unset($pages,$page,$pgs,$pg,$icon);
?>
</div></div>
<div class="spinner fixed"></div>
<iframe id="progressFrame" name="progressFrame" frameborder="0"></iframe>
<?
// Build footer

View File

@@ -43,9 +43,6 @@ foreach (glob('plugins/*', GLOB_ONLYDIR) as $plugin) {
if ($plugin != 'plugins/dynamix') build_pages("$plugin/*.page");
}
// Extract the 'querystring'
extract($_GET);
// Need the following to make php-fpm & nginx work
if (empty($path))
$path = substr(explode('?', $_SERVER['REQUEST_URI'])[0], 1);

View File

@@ -53,6 +53,7 @@ function addLog(logLine) {
}
function disablePage() {
for (var i=0,div; div=top.document.getElementsByClassName('spinner')[i]; i++) div.style.display = 'block';
for (var i=0,element; element=top.document.querySelectorAll('input,button,select')[i]; i++) element.disabled = true;
for (var i=0,link; link=top.document.getElementsByTagName('a')[i]; i++) link.style.color = "gray"; //fake disable
}