save vpn fix, type select in template
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/tag Build is passing

This commit is contained in:
2025-08-28 13:59:51 +00:00
parent 0a799c9bec
commit 930d02f3f4
4 changed files with 44 additions and 17 deletions

View File

@@ -113,23 +113,13 @@ function check_vpn(service) {
method: 'GET',
success: function(data) {
console.log('check_vpn: '+data);
if (data=="1") { // save_vpn has finished or VPN ON
const vpn_div = document.getElementById("vpn");
console.log('vpn_div: '+vpn_div);
if (vpn_div) {
vpn_div.innerHTML = 'VPN start process has finished';
setTimeout(function() {
document.getElementById('installAppsBtn').click();
}, 2000);
}
else {
if (data=="1") { // VPN ON
$('#pro_off').hide();
$('#pro_on').show();
$('#vpn_off').hide();
$('#vpn_on').show();
//document.getElementById('vpnToggle').checked = true;
//document.querySelector(".switch-label").textContent = "ON";
}
}
else if (data=="2") {
$('#pro_off').hide();
@@ -152,13 +142,38 @@ function check_vpn(service) {
});
}
function check_save_vpn(service) {
var url = 'scan.php?op=check_vpn';
jQuery.ajax({
url: url,
method: 'GET',
success: function(data) {
console.log('check_save_vpn: '+data);
if (data=="1") { // save_vpn has finished or VPN ON
const vpn_div = document.getElementById("vpn");
if (vpn_div) {
vpn_div.innerHTML = '<div class="loading">VPN start process has finished</div>';
setTimeout(function() {
document.getElementById('installAppsBtn').click();
}, 2000);
}
}
else setTimeout(check_save_vpn, 1000);
},
error: function(xhr, status, error) {
console.warn('check_save_vpn error: ' + status + ' - ' + error);
setTimeout(check_save_vpn, 1000);
}
});
}
function save_vpn() {
var url = 'scan.php?op=save_vpn&vpn_domain='+jQuery('#vpn_domain').val()+'&vpn_pass='+jQuery('#vpn_pass').val()+'&letsencrypt_mail='+jQuery('#letsencrypt_mail').val()+'&letsencrypt_servername='+jQuery('#letsencrypt_servername').val();
jQuery.get(url, function(data) {
console.log('save_vpn: '+data);
if (data=="OK") {
check_vpn();
check_save_vpn();
}
//get_vpn();
});

View File

@@ -390,6 +390,6 @@
<script src="https://code.jquery.com/jquery-3.7.1.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/popper.js@1.14.6/dist/umd/popper.min.js" integrity="sha384-wHAiFfRlMFy6i5SRaxvfOCifBUQy1xHdJ/yoi7FRNXMRBu5WHdZYu1hA6ZOblgut" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@4.2.1/dist/js/bootstrap.min.js" integrity="sha384-B0UglyR+jN6CkvvICOB2joaf5I4l3gm9GU6Hc1og6Ls7i6U/mkkaduKaBhlAXv9k" crossorigin="anonymous"></script>
<script src="common.js?t=53"></script>
<script src="common.js?t=57"></script>
</body>
</html>

View File

@@ -227,9 +227,21 @@ switch ($_GET["op"]) {
}
else {
echo "<div class=\"row\">";
echo "<label>".$field->description."</label>
<div class=\"input-container\"><input ".($field->required=="true" ? "required" : "")." type=\"".(!empty($field->type) ? $field->type : "text")."\" value=\"{$field->value}\" name=\"{$field->key}\" id=\"{$template->name}_{$field->key}\" class=\"additional_{$template->name}\"></div>
<div class=\"info-container\">
echo "<label>".$field->description."</label>";
if ($field->type=="select") {
echo "<div class=\"input-container\">
<select ".($field->required=="true" ? "required" : "")." name=\"{$field->key}\" id=\"{$template->name}_{$field->key}\" class=\"additional_{$template->name}\">";
$values = explode(",",$field->value);
foreach ($values as $value) {
$v_arr = explode(":",$value);
if (empty($v_arr[1])) $v_arr[1] = $v_arr[0];
echo "<option value=\"{$v_arr[0]}\">{$v_arr[1]}</option>";
}
echo " </select>
</div>";
}
else echo "<div class=\"input-container\"><input ".($field->required=="true" ? "required" : "")." type=\"".(!empty($field->type) ? $field->type : "text")."\" value=\"{$field->value}\" name=\"{$field->key}\" id=\"{$template->name}_{$field->key}\" class=\"additional_{$template->name}\"></div>";
echo "<div class=\"info-container\">
";
if (!empty($field->info)) echo "
<span class=\"info-icon\">i</span>

View File

@@ -1 +1 @@
1.1.18
1.1.19