diff --git a/index.html b/index.html index 3c6f02a..65f1e94 100644 --- a/index.html +++ b/index.html @@ -82,16 +82,23 @@ function check_system() { }); } +function check_redis() { + var url = 'scan.php?op=redis'; $.get(url, function(data){ + console.log(data); if (data=='OK') { $("#redis").html('Redis server - OK'); start_system(); } else { $("#redis").html('Redis server is not available...'); + setTimeout(check_redis, 1000); } }); +} + + check_redis(); //setTimeout(redirectToManage, 10000); diff --git a/scan.php b/scan.php index d819dbf..7023fd3 100644 --- a/scan.php +++ b/scan.php @@ -76,7 +76,7 @@ switch ($_GET["op"]) { else { foreach ($data["DEPLOYMENTS"] as $service_name => $content) { //echo base64_decode($content); - echo '
'.$service_name.' - '.$content.'
'; + echo '
'.$service_name.' - '.$content.(array_key_exists($service_name,$data["INSTALLED_SERVICES"]) ? " - INSTALLED" : "").'
'; echo '
'; } } @@ -84,6 +84,7 @@ switch ($_GET["op"]) { else echo "There are no deployments.
"; if (count($data["INSTALLED_SERVICES"])) { + echo "
Installed services:
"; if ($data["INSTALLED_SERVICES"]["services"]=="NONE") echo "There are no installed services.
"; else { foreach ($data["INSTALLED_SERVICES"] as $service_name => $content) { @@ -117,9 +118,14 @@ switch ($_GET["op"]) { $template = json_decode(base64_decode($data["TEMPLATE"])); echo "

"; foreach ($template->fields as $field) { + if (isset($field->generated)) { + echo "generated}\" name=\"{$field->key}\" id=\"{$field->key}\" class=\"additional_field\">"; + } + else { echo "
required=="true" ? "required" : "")." type=\"text\" value=\"{$field->value}\" name=\"{$field->key}\" id=\"{$field->key}\" class=\"additional_field\">
"; + } } echo "
@@ -155,6 +161,24 @@ switch ($_GET["op"]) { $fields = $_GET; unset($fields["op"]); unset($fields["additional"]); + $algos = hash_algos(); + foreach ($fields as $field_key => $field_value) { + $field_arr = explode(":",$field_value); + if ($field_arr[0]=="generated") { + if (intval($field_arr[3])==0) $len = 10; // default length + else $len = $field_arr[3]; + + if ($field_arr[1]=="random") $base = rand(100000,999999); + elseif ($field_arr[1]=="time") $base = time(); + elseif ($field_arr[1]!="") $base = $field_arr[1]; // fix string + else $base = rand(100000,999999); // default + + if (in_array($field_arr[2],$algos)) $base = hash($field_arr[2],$base); + else $base = hash("md5",$base); // default alg + + $fields["$field_key"] = substr($base,0,$len); + } + } $payload = base64_encode(json_encode($fields, JSON_UNESCAPED_SLASHES|JSON_PRETTY_PRINT)); $arr = array("NAME" => $_GET["additional"], "ACTION" => "deploy", "PAYLOAD" => $payload); $json = json_encode($arr, JSON_UNESCAPED_SLASHES|JSON_PRETTY_PRINT);