Added passeneg manager. Part 3

devel
Alexey Berezhok 4 months ago
parent 455223af4b
commit a2988a71d7

@ -184,10 +184,26 @@ $stats = json_decode(implode("", $output), true);
unset($output); unset($output);
//Check if passenger enabled //Check if passenger enabled
$passenger_state = "disabled";
exec(HESTIA_CMD . "v-ext-modules state passenger_manager json", $output, $return_var); exec(HESTIA_CMD . "v-ext-modules state passenger_manager json", $output, $return_var);
$check_passenger_enabled = json_decode(implode("", $output), true); $check_passenger_enabled = json_decode(implode("", $output), true);
unset($output);
if (($return_var == 0) && (!empty($check_passenger_enabled)) && ($check_passenger_enabled[0]["STATE"] == "enabled")){ if (($return_var == 0) && (!empty($check_passenger_enabled)) && ($check_passenger_enabled[0]["STATE"] == "enabled")){
//TODO $passenger_state = "enabled";
exec(HESTIA_CMD . "v-ext-modules-run passenger_manager get_rubys json", $output, $return_var);
$rubys = json_decode(implode("", $output), true);
unset($output);
if ($return_var != 0){
$passenger_state = "disabled";
} else {
$ruby_domain = quoteshellarg($v_domain);
exec(HESTIA_CMD . "v-ext-modules-run passenger_manager get_user_ruby " . $ruby_domain . " json", $output, $return_var);
$domain_ruby = json_decode(implode("", $output), true);
unset($output);
if ($return_var != 0){
$passenger_state = "disabled";
}
}
} }
unset($output); unset($output);
@ -431,6 +447,7 @@ if (!empty($_POST["save"])) {
if (!empty($_POST["v_proxy_template"])) { if (!empty($_POST["v_proxy_template"])) {
$v_proxy_template = $_POST["v_proxy_template"]; $v_proxy_template = $_POST["v_proxy_template"];
} }
$v_proxy_port = "0";
if (!empty($_POST["v_proxy_port"])) { if (!empty($_POST["v_proxy_port"])) {
$v_proxy_port = $_POST["v_proxy_port"]; $v_proxy_port = $_POST["v_proxy_port"];
} }

@ -42,7 +42,7 @@ if ((!empty($_GET["del"])) && ($_GET["del"] != "")) {
// Data // Data
exec(HESTIA_CMD . "v-ext-modules-run passenger_manager get_rubys json", $output, $return_var); exec(HESTIA_CMD . "v-ext-modules-run passenger_manager get_rubys json", $output, $return_var);
$rubys = []; $rubys = [];
if ($return_var != 0) { if ($return_var == 0) {
$rubys = json_decode(implode("", $output), true); $rubys = json_decode(implode("", $output), true);
ksort($rubys); ksort($rubys);
} else { } else {

@ -33,6 +33,13 @@
letsEncryptEnabled: <?= $v_letsencrypt == "yes" || $v_letsencrypt == "on" ? "true" : "false" ?>, letsEncryptEnabled: <?= $v_letsencrypt == "yes" || $v_letsencrypt == "on" ? "true" : "false" ?>,
showCertificates: <?= $v_letsencrypt == "yes" || $v_letsencrypt == "on" ? "false" : "true" ?>, showCertificates: <?= $v_letsencrypt == "yes" || $v_letsencrypt == "on" ? "false" : "true" ?>,
showAdvanced: false, showAdvanced: false,
<?php
if ($passenger_state == "enabled") {
?>
showPassenger: false,
<?php
}
?>
nginxCacheEnabled: <?= $v_nginx_cache == "yes" ? "true" : "false" ?>, nginxCacheEnabled: <?= $v_nginx_cache == "yes" ? "true" : "false" ?>,
proxySupportEnabled: <?= !empty($v_proxy) ? "true" : "false" ?>, proxySupportEnabled: <?= !empty($v_proxy) ? "true" : "false" ?>,
customDocumentRootEnabled: <?= !empty($v_custom_doc_root) ? "true" : "false" ?> customDocumentRootEnabled: <?= !empty($v_custom_doc_root) ? "true" : "false" ?>
@ -457,6 +464,43 @@
</button> </button>
<?php } ?> <?php } ?>
</div> </div>
<?php
if ($passenger_state == "enabled") {
?>
<div class="u-mt15 u-mb20">
<button x-on:click="showPassenger = !showPassenger" type="button" class="button button-secondary">
<?= _("Passenger options") ?>
</button>
</div>
<div x-cloak x-show="showPassenger">
<?php if ($_SESSION["userContext"] === "admin") { ?>
<div class="form-check u-mb10">
<input class="form-check-input" type="checkbox" name="v_passenger_enabled" id="v_passenger_enabled">
<label for="v_passenger_enabled">
<?= _("Enable passenger for domain") ?>
</label>
</div>
<div class="u-mb10">
<label for="v_ruby_path" class="form-label">
<?= _("Set ruby path for domain") ?>
</label>
<select class="form-select" name="v_ruby_path" id="v_ruby_path">
<?php
foreach ($rubys as $key => $value) {
echo "\t\t\t\t<option value=\"".htmlentities($value["RUBY"])."\"";
if ((!empty($domain_ruby)) && ( $value["RUBY"] == $domain_ruby[0]["RUBY"] )){
echo ' selected' ;
}
echo ">".htmlentities($value["RUBY"])."</option>\n";
}
?>
</select>
</div>
<?php } ?>
</div>
<?php
}
?>
</div> </div>
</form> </form>

@ -18,11 +18,11 @@
<div class="container"> <div class="container">
<?php <?php
if ($error_message != "") { if (is_array($error_message)) {
?> ?>
<div class="u-text-center inline-alert inline-alert-danger u-mb20" role="alert"> <div class="u-text-center inline-alert inline-alert-danger u-mb20" role="alert">
<i class="fas fa-circle-exclamation"></i> <i class="fas fa-circle-exclamation"></i>
<p><?= $error_message ?></p> <p><?= $error_message[0] ?></p>
</div> </div>
<?php <?php
} }

Loading…
Cancel
Save