fix(ssl): prompt before setting IP cert path for panel

The IP certificate flow auto-set the panel cert path silently, unlike the
domain and Cloudflare flows which ask first. Add the same
"Would you like to set this certificate for the panel? (y/n)" prompt so
the IP flow is consistent and only configures the panel on confirmation.
This commit is contained in:
MHSanaei
2026-05-29 02:52:57 +02:00
parent 7ea88e3e37
commit 90a64a1b22
+19 -13
View File
@@ -1371,24 +1371,30 @@ ssl_cert_issue_for_ip() {
chmod 600 $certPath/privkey.pem 2> /dev/null chmod 600 $certPath/privkey.pem 2> /dev/null
chmod 644 $certPath/fullchain.pem 2> /dev/null chmod 644 $certPath/fullchain.pem 2> /dev/null
# Set certificate paths for the panel # Prompt user to set panel paths after successful certificate installation
local webCertFile="${certPath}/fullchain.pem" local webCertFile="${certPath}/fullchain.pem"
local webKeyFile="${certPath}/privkey.pem" local webKeyFile="${certPath}/privkey.pem"
if [[ -f "$webCertFile" && -f "$webKeyFile" ]]; then read -rp "Would you like to set this certificate for the panel? (y/n): " setPanel
${xui_folder}/x-ui cert -webCert "$webCertFile" -webCertKey "$webKeyFile" if [[ "$setPanel" == "y" || "$setPanel" == "Y" ]]; then
LOGI "Certificate configured for panel" if [[ -f "$webCertFile" && -f "$webKeyFile" ]]; then
LOGI " - Certificate File: $webCertFile" ${xui_folder}/x-ui cert -webCert "$webCertFile" -webCertKey "$webKeyFile"
LOGI " - Private Key File: $webKeyFile" LOGI "Panel paths set for IP: $server_ip"
LOGI " - Validity: ~6 days (auto-renews via acme.sh cron)" LOGI " - Certificate File: $webCertFile"
echo -e "${green}Access URL: https://${server_ip}:${existing_port}${existing_webBasePath}${plain}" LOGI " - Private Key File: $webKeyFile"
LOGI "Panel will restart to apply SSL certificate..." LOGI " - Validity: ~6 days (auto-renews via acme.sh cron)"
restart echo -e "${green}Access URL: https://${server_ip}:${existing_port}${existing_webBasePath}${plain}"
return 0 LOGI "Panel will restart to apply SSL certificate..."
restart
else
LOGE "Error: Certificate or private key file not found for IP: $server_ip."
return 1
fi
else else
LOGE "Certificate files not found after installation" LOGI "Skipping panel path setting."
return 1
fi fi
return 0
} }
ssl_cert_issue() { ssl_cert_issue() {