From 930d02f3f4c619d2b7b9ddbc476a1d6c005296bb Mon Sep 17 00:00:00 2001 From: hael Date: Thu, 28 Aug 2025 13:59:51 +0000 Subject: [PATCH] save vpn fix, type select in template --- common.js | 39 +++++++++++++++++++++++++++------------ manage.html | 2 +- scan.php | 18 +++++++++++++++--- version.html | 2 +- 4 files changed, 44 insertions(+), 17 deletions(-) diff --git a/common.js b/common.js index f131eb2..5fcbf41 100644 --- a/common.js +++ b/common.js @@ -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 = '
VPN start process has finished
'; + 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(); }); diff --git a/manage.html b/manage.html index 1a7e346..4395e2a 100644 --- a/manage.html +++ b/manage.html @@ -390,6 +390,6 @@ - + diff --git a/scan.php b/scan.php index 68ee9f5..2a52cd5 100644 --- a/scan.php +++ b/scan.php @@ -227,9 +227,21 @@ switch ($_GET["op"]) { } else { echo "
"; - echo " -
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}\">
-
+ echo ""; + if ($field->type=="select") { + echo "
+ +
"; + } + else echo "
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}\">
"; + echo "
"; if (!empty($field->info)) echo " i diff --git a/version.html b/version.html index 852ed67..4e03659 100644 --- a/version.html +++ b/version.html @@ -1 +1 @@ -1.1.18 +1.1.19