bash - minor change

This commit is contained in:
mhsanaei 2024-10-07 17:21:32 +02:00
parent 41d39dfaa8
commit 8404b33232
No known key found for this signature in database
GPG Key ID: 4DACC0663B5986F5

21
x-ui.sh
View File

@ -181,7 +181,7 @@ update_menu() {
chmod +x /usr/local/x-ui/x-ui.sh chmod +x /usr/local/x-ui/x-ui.sh
chmod +x /usr/bin/x-ui chmod +x /usr/bin/x-ui
if [[ $? == 0 ]]; then if [[ $? == 0 ]]; then
echo -e "${green}Update successful. The panel has automatically restarted.${plain}" echo -e "${green}Update successful. The panel has automatically restarted.${plain}"
exit 0 exit 0
else else
@ -216,7 +216,7 @@ custom_version() {
# Function to handle the deletion of the script file # Function to handle the deletion of the script file
delete_script() { delete_script() {
rm "$0" # Remove the script file itself rm "$0" # Remove the script file itself
exit 1 exit 1
} }
@ -796,7 +796,7 @@ install_acme() {
fi fi
LOGI "Installing acme.sh..." LOGI "Installing acme.sh..."
cd ~ || return 1 # Ensure you can change to the home directory cd ~ || return 1 # Ensure you can change to the home directory
curl -s https://get.acme.sh | sh curl -s https://get.acme.sh | sh
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
@ -833,7 +833,7 @@ ssl_cert_issue_main() {
echo "Existing domains:" echo "Existing domains:"
echo "$domains" echo "$domains"
read -p "Please enter a domain from the list to revoke the certificate: " domain read -p "Please enter a domain from the list to revoke the certificate: " domain
if [[ " $domains " =~ " $domain " ]]; then if echo "$domains" | grep -qw "$domain"; then
~/.acme.sh/acme.sh --revoke -d ${domain} ~/.acme.sh/acme.sh --revoke -d ${domain}
LOGI "Certificate revoked for domain: $domain" LOGI "Certificate revoked for domain: $domain"
else else
@ -849,7 +849,7 @@ ssl_cert_issue_main() {
echo "Existing domains:" echo "Existing domains:"
echo "$domains" echo "$domains"
read -p "Please enter a domain from the list to renew the SSL certificate: " domain read -p "Please enter a domain from the list to renew the SSL certificate: " domain
if [[ " $domains " =~ " $domain " ]]; then if echo "$domains" | grep -qw "$domain"; then
~/.acme.sh/acme.sh --renew -d ${domain} --force ~/.acme.sh/acme.sh --renew -d ${domain} --force
LOGI "Certificate forcefully renewed for domain: $domain" LOGI "Certificate forcefully renewed for domain: $domain"
else else
@ -884,13 +884,13 @@ ssl_cert_issue_main() {
echo "Available domains:" echo "Available domains:"
echo "$domains" echo "$domains"
read -p "Please choose a domain to set the panel paths: " domain read -p "Please choose a domain to set the panel paths: " domain
if [[ " $domains " =~ " $domain " ]]; then
if echo "$domains" | grep -qw "$domain"; then
local webCertFile="/root/cert/${domain}/fullchain.pem" local webCertFile="/root/cert/${domain}/fullchain.pem"
local webKeyFile="/root/cert/${domain}/privkey.pem" local webKeyFile="/root/cert/${domain}/privkey.pem"
if [[ -f "${webCertFile}" && -f "${webKeyFile}" ]]; then if [[ -f "${webCertFile}" && -f "${webKeyFile}" ]]; then
/usr/local/x-ui/x-ui cert -webCert "$webCertFile" /usr/local/x-ui/x-ui cert -webCert "$webCertFile" -webCertKey "$webKeyFile"
/usr/local/x-ui/x-ui cert -webCertKey "$webKeyFile"
echo "Panel paths set for domain: $domain" echo "Panel paths set for domain: $domain"
echo " - Certificate File: $webCertFile" echo " - Certificate File: $webCertFile"
echo " - Private Key File: $webKeyFile" echo " - Private Key File: $webKeyFile"
@ -902,6 +902,7 @@ ssl_cert_issue_main() {
fi fi
fi fi
;; ;;
*) *)
echo "Invalid choice" echo "Invalid choice"
;; ;;
@ -1023,8 +1024,7 @@ ssl_cert_issue() {
local webKeyFile="/root/cert/${domain}/privkey.pem" local webKeyFile="/root/cert/${domain}/privkey.pem"
if [[ -f "$webCertFile" && -f "$webKeyFile" ]]; then if [[ -f "$webCertFile" && -f "$webKeyFile" ]]; then
/usr/local/x-ui/x-ui cert -webCert "$webCertFile" /usr/local/x-ui/x-ui cert -webCert "$webCertFile" -webCertKey "$webKeyFile"
/usr/local/x-ui/x-ui cert -webCertKey "$webKeyFile"
LOGI "Panel paths set for domain: $domain" LOGI "Panel paths set for domain: $domain"
LOGI " - Certificate File: $webCertFile" LOGI " - Certificate File: $webCertFile"
LOGI " - Private Key File: $webKeyFile" LOGI " - Private Key File: $webKeyFile"
@ -1146,7 +1146,6 @@ run_speedtest() {
# Run Speedtest # Run Speedtest
speedtest speedtest
} }
create_iplimit_jails() { create_iplimit_jails() {
# Use default bantime if not passed => 15 minutes # Use default bantime if not passed => 15 minutes
local bantime="${1:-15}" local bantime="${1:-15}"