From 3ce60d00ce8dc8b50071a9adcced612646fc757c Mon Sep 17 00:00:00 2001 From: Petro1990 Date: Fri, 13 Mar 2026 15:34:17 +0300 Subject: [PATCH] =?UTF-8?q?=D1=84=D0=B8=D0=BA=D1=81:=20=D0=B8=D1=81=D0=BF?= =?UTF-8?q?=D1=80=D0=B0=D0=B2=D0=BB=D0=B5=D0=BD=D0=B0=20=D1=81=D0=B8=D0=BD?= =?UTF-8?q?=D1=82=D0=B0=D0=BA=D1=81=D0=B8=D1=87=D0=B5=D1=81=D0=BA=D0=B0?= =?UTF-8?q?=D1=8F=20=D0=BE=D1=88=D0=B8=D0=B1=D0=BA=D0=B0=20=D0=B2=20do=5Fs?= =?UTF-8?q?etup=20=D0=B8=20=D0=B4=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D0=B0=20=D1=84=D1=83=D0=BD=D0=BA=D1=86=D0=B8=D1=8F=20?= =?UTF-8?q?=D1=81=D0=B0=D0=BC=D0=BE=D0=BE=D0=B1=D0=BD=D0=BE=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D0=B8=D1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- rproxy | 77 ++++++++++++++++++++++++++++++++++++++++------------------ 1 file changed, 53 insertions(+), 24 deletions(-) diff --git a/rproxy b/rproxy index b6547eb..4de35be 100644 --- a/rproxy +++ b/rproxy @@ -171,25 +171,27 @@ main_menu() { draw_separator printf " ${BOLD}4)${NC} ▶️ Запустить туннель\n" printf " ${BOLD}5)${NC} ⏹️ Остановить туннель\n" - printf " ${BOLD}6)${NC} 🔄 Перезапустить туннель\n" - draw_separator - printf " ${BOLD}7)${NC} 🔒 Получить/Обновить SSL (Certbot)\n" - printf " ${BOLD}8)${NC} ⚙️ Настройки VPS\n" - printf " ${BOLD}0)${NC} 🚪 Выход\n" + printf " ${CYAN}${BOLD}6)${NC} 🔄 Перезапустить туннель\n" + draw_separator + printf " ${BOLD}7)${NC} 🔒 Получить/Обновить SSL (Certbot)\n" + printf " ${BOLD}8)${NC} ⚙️ Настройки VPS\n" + printf " ${BOLD}9)${NC} 🚀 Обновить rProxy\n" + printf " ${BOLD}0)${NC} 🚪 Выход\n" - prompt "Выберите действие: " + prompt "Выберите действие: " - case "$REPLY" in - 1) show_status ;; - 2) do_add_interactive ;; - 3) do_remove_interactive ;; - 4) do_start_interactive ;; - 5) do_stop_interactive ;; - 6) do_restart_interactive ;; - 7) do_ssl_interactive ;; - 8) do_setup ;; - 0|q) clear_screen; exit 0 ;; - *) ;; + case "$REPLY" in + 1) show_status ;; + 2) do_add_interactive ;; + 3) do_remove_interactive ;; + 4) do_start_interactive ;; + 5) do_stop_interactive ;; + 6) do_restart_interactive ;; + 7) do_ssl_interactive ;; + 8) do_setup ;; + 9) do_self_update ;; + 0|q) clear_screen; exit 0 ;; + *) ;; esac done } @@ -462,10 +464,8 @@ do_ssl_interactive() { fi msg "Проверяю наличие Certbot на VPS..." - ssh_cmd "command -v certbot >/dev/null 2>&1 || (apt-get update && apt-get install -y certbot python3-certbot-nginx || yum install -y certbot python3-certbot-nginx)" || { - err "Не удалось установить Certbot на VPS" - pause - return + ssh_cmd "command -v certbot >/dev/null 2>&1 || (apt-get update -qq && apt-get install -y -qq certbot python3-certbot-nginx || yum install -y certbot python3-certbot-nginx)" || { + warn "Не удалось автоматически установить Certbot на VPS" } msg "Запрашиваю сертификат для $SVC_DOMAIN..." @@ -481,6 +481,34 @@ do_ssl_interactive() { pause } +# ══════════════════════════════════════════════════════════════════════ +# ОБНОВЛЕНИЕ СКРИПТА +# ══════════════════════════════════════════════════════════════════════ +do_self_update() { + clear_screen + draw_box "Обновление rProxy" + printf "\n" + msg "Проверяю наличие обновлений..." + + local url="http://5.104.75.50:3000/Petro1990/rProxy/raw/branch/main/rproxy" + local tmp_file="/tmp/rproxy_update" + + if curl -sSL "$url" -o "$tmp_file"; then + if [ -s "$tmp_file" ]; then + mv "$tmp_file" "/opt/bin/rproxy" + chmod +x "/opt/bin/rproxy" + msg "Обновление успешно завершено!" + pause + exec /opt/bin/rproxy # Перезапуск новой версии + else + err "Файл обновления не пуст или не найден" + fi + else + err "Не удалось загрузить обновление" + fi + pause +} + # ══════════════════════════════════════════════════════════════════════ # УДАЛИТЬ СЕРВИС (интерактивно) # ══════════════════════════════════════════════════════════════════════ @@ -881,9 +909,10 @@ do_setup() { sed -i \"/http {/a\\\\ include /etc/nginx/sites-enabled/*.conf;\" /etc/nginx/nginx.conf 2>/dev/null fi - if ! ssh_cmd "command -v certbot" >/dev/null 2>&1; then - msg "Устанавливаю Certbot на VPS (может занять пару минут)..." - ssh_cmd "apt-get update -qq && apt-get install -y -qq certbot python3-certbot-nginx || yum install -y certbot python3-certbot-nginx" >/dev/null 2>&1 + if ! command -v certbot >/dev/null 2>&1; then + echo \"Устанавливаю Certbot...\" + apt-get update -qq && apt-get install -y -qq certbot python3-certbot-nginx >/dev/null 2>&1 || \ + yum install -y certbot python3-certbot-nginx >/dev/null 2>&1 fi systemctl enable nginx 2>/dev/null