Skip to content

Commit 3b1bfdb

Browse files
committed
update install.sh
1 parent 3478902 commit 3b1bfdb

File tree

1 file changed

+20
-8
lines changed

1 file changed

+20
-8
lines changed

install.sh

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ ${cyan}| WebSocket Path | ${yellow}$new_ws_path ${cyan}
235235

236236
# Install random site
237237
install_random_fake_site() {
238-
if ! command -v nginx &> /dev/null; then
238+
if [ ! -d "/etc/letsencrypt/live/$saved_domain" ]; then
239239
echo -e "${yellow}×××××××××××××××××××××××${rest}"
240240
echo -e "${red}Nginx is not installed.${rest}"
241241
echo -e "${yellow}×××××××××××××××××××××××${rest}"
@@ -264,10 +264,20 @@ install_random_fake_site() {
264264
}
265265

266266
# Limitation
267-
add_limit(){
267+
add_limit() {
268+
# Check if NGINX service is installed
269+
if [ ! -d "/etc/letsencrypt/live/$saved_domain" ]; then
270+
echo -e "${yellow}×××××××××××××××××××××××${rest}"
271+
echo -e "${red}N R P is not installed.${rest}"
272+
echo -e "${yellow}×××××××××××××××××××××××${rest}"
273+
exit 1
274+
fi
275+
268276
echo -e "${yellow}×××××××××××××××××××××××${rest}"
269-
echo -e "${green}Please enter the percentage increase compared to the last 24 hours: ${rest}"
270-
read -p "Enter the percentage limit: " percentage_limit
277+
echo -e "${cyan} This option adds a traffic limit to monitor increases in traffic compared to the last 24 hours.${rest}"
278+
echo -e "${cyan} If the traffic exceeds this limit, the nginx service will be stopped.${rest}"
279+
read -p "Enter the percentage limit [default: 50]: " percentage_limit
280+
percentage_limit=${percentage_limit:-50}
271281
echo -e "${yellow}×××××××××××××××××××××××${rest}"
272282

273283
if [ ! -d "/root/usage" ]; then
@@ -347,7 +357,7 @@ change_port() {
347357
echo -e "${yellow}×××××××××××××××××××××××${rest}"
348358
else
349359
echo -e "${yellow}×××××××××××××××××××××××××××××××××××${rest}"
350-
echo -e "${red}N R P is not installed or NGINX configuration file not found.${rest}"
360+
echo -e "${red}N R P is not installed.${rest}"
351361
echo -e "${yellow}×××××××××××××××××××××××××××××××××××${rest}"
352362
fi
353363
}
@@ -393,7 +403,9 @@ echo -e "${yellow} 3) ${green}Change Https Port${rest} ${purple}*${rest}"
393403
echo -e "${purple} * ${rest}"
394404
echo -e "${yellow} 4) ${green}Install Fake Site${rest} ${purple}*${rest}"
395405
echo -e "${purple} * ${rest}"
396-
echo -e "${yellow} 5) ${green}Uninstall${rest} ${purple}*${rest}"
406+
echo -e "${yellow} 5) ${green}Add Traffic Limit${rest} ${purple}*${rest}"
407+
echo -e "${purple} * ${rest}"
408+
echo -e "${yellow} 6) ${green}Uninstall${rest} ${purple}*${rest}"
397409
echo -e "${purple} * ${rest}"
398410
echo -e "${yellow} 0) ${purple}Exit${rest}${purple} *${rest}"
399411
echo -e "${purple}***********************${rest}"
@@ -412,10 +424,10 @@ case "$choice" in
412424
install_random_fake_site
413425
;;
414426
5)
415-
uninstall
427+
add_limit
416428
;;
417429
6)
418-
add_limit
430+
uninstall
419431
;;
420432
0)
421433
echo -e "${cyan}By 🖐${rest}"

0 commit comments

Comments
 (0)