Merge branch 'main' of git.format.hu:format/web-installer
Some checks failed
continuous-integration/drone/push Build is failing
Some checks failed
continuous-integration/drone/push Build is failing
This commit is contained in:
@@ -82,16 +82,23 @@ function check_system() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function check_redis() {
|
||||||
|
|
||||||
var url = 'scan.php?op=redis';
|
var url = 'scan.php?op=redis';
|
||||||
$.get(url, function(data){
|
$.get(url, function(data){
|
||||||
|
console.log(data);
|
||||||
if (data=='OK') {
|
if (data=='OK') {
|
||||||
$("#redis").html('Redis server - OK');
|
$("#redis").html('Redis server - OK');
|
||||||
start_system();
|
start_system();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$("#redis").html('Redis server is not available...');
|
$("#redis").html('Redis server is not available...');
|
||||||
|
setTimeout(check_redis, 1000);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
check_redis();
|
||||||
|
|
||||||
//setTimeout(redirectToManage, 10000);
|
//setTimeout(redirectToManage, 10000);
|
||||||
|
|
||||||
|
26
scan.php
26
scan.php
@@ -76,7 +76,7 @@ switch ($_GET["op"]) {
|
|||||||
else {
|
else {
|
||||||
foreach ($data["DEPLOYMENTS"] as $service_name => $content) {
|
foreach ($data["DEPLOYMENTS"] as $service_name => $content) {
|
||||||
//echo base64_decode($content);
|
//echo base64_decode($content);
|
||||||
echo '<div><a href="#" onclick="load_template(\''.$service_name.'\')">'.$service_name.'</a> - '.$content.'</div>';
|
echo '<div><a href="#" onclick="load_template(\''.$service_name.'\')">'.$service_name.'</a> - '.$content.(array_key_exists($service_name,$data["INSTALLED_SERVICES"]) ? " - INSTALLED" : "").'</div>';
|
||||||
echo '<div id="'.$service_name.'"></div>';
|
echo '<div id="'.$service_name.'"></div>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -84,6 +84,7 @@ switch ($_GET["op"]) {
|
|||||||
else echo "There are no deployments.<br>";
|
else echo "There are no deployments.<br>";
|
||||||
|
|
||||||
if (count($data["INSTALLED_SERVICES"])) {
|
if (count($data["INSTALLED_SERVICES"])) {
|
||||||
|
echo "<br>Installed services:<br>";
|
||||||
if ($data["INSTALLED_SERVICES"]["services"]=="NONE") echo "There are no installed services.<br>";
|
if ($data["INSTALLED_SERVICES"]["services"]=="NONE") echo "There are no installed services.<br>";
|
||||||
else {
|
else {
|
||||||
foreach ($data["INSTALLED_SERVICES"] as $service_name => $content) {
|
foreach ($data["INSTALLED_SERVICES"] as $service_name => $content) {
|
||||||
@@ -117,9 +118,14 @@ switch ($_GET["op"]) {
|
|||||||
$template = json_decode(base64_decode($data["TEMPLATE"]));
|
$template = json_decode(base64_decode($data["TEMPLATE"]));
|
||||||
echo "<fieldset><form action=\"#\" method=\"post\" id=\"deploy_form\"><br>";
|
echo "<fieldset><form action=\"#\" method=\"post\" id=\"deploy_form\"><br>";
|
||||||
foreach ($template->fields as $field) {
|
foreach ($template->fields as $field) {
|
||||||
|
if (isset($field->generated)) {
|
||||||
|
echo "<input type=\"hidden\" value=\"generated:{$field->generated}\" name=\"{$field->key}\" id=\"{$field->key}\" class=\"additional_field\">";
|
||||||
|
}
|
||||||
|
else {
|
||||||
echo "<div class=\"row\"><div class=\"mb-3\"><label>".$field->description."</label>
|
echo "<div class=\"row\"><div class=\"mb-3\"><label>".$field->description."</label>
|
||||||
<input ".($field->required=="true" ? "required" : "")." type=\"text\" value=\"{$field->value}\" name=\"{$field->key}\" id=\"{$field->key}\" class=\"additional_field\">
|
<input ".($field->required=="true" ? "required" : "")." type=\"text\" value=\"{$field->value}\" name=\"{$field->key}\" id=\"{$field->key}\" class=\"additional_field\">
|
||||||
</div></div>";
|
</div></div>";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
echo "
|
echo "
|
||||||
<div class=\"row\">
|
<div class=\"row\">
|
||||||
@@ -155,6 +161,24 @@ switch ($_GET["op"]) {
|
|||||||
$fields = $_GET;
|
$fields = $_GET;
|
||||||
unset($fields["op"]);
|
unset($fields["op"]);
|
||||||
unset($fields["additional"]);
|
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));
|
$payload = base64_encode(json_encode($fields, JSON_UNESCAPED_SLASHES|JSON_PRETTY_PRINT));
|
||||||
$arr = array("NAME" => $_GET["additional"], "ACTION" => "deploy", "PAYLOAD" => $payload);
|
$arr = array("NAME" => $_GET["additional"], "ACTION" => "deploy", "PAYLOAD" => $payload);
|
||||||
$json = json_encode($arr, JSON_UNESCAPED_SLASHES|JSON_PRETTY_PRINT);
|
$json = json_encode($arr, JSON_UNESCAPED_SLASHES|JSON_PRETTY_PRINT);
|
||||||
|
Reference in New Issue
Block a user