From 6fe5cf2540f9c4166d2ab897803bb284e7e69a32 Mon Sep 17 00:00:00 2001 From: anten-ka Date: Sun, 22 Mar 2026 13:53:35 +0300 Subject: [PATCH] Show all containers with number and uptime in main menu and bot Made-with: Cursor --- warp.sh | 36 +++++++++++++++++++++++++++++------- 1 file changed, 29 insertions(+), 7 deletions(-) diff --git a/warp.sh b/warp.sh index 19f1915..1bdc92a 100644 --- a/warp.sh +++ b/warp.sh @@ -1333,7 +1333,12 @@ bot_main_menu() { ws=$(get_warp_status) is_warp_running && wip=" | WARP IP: $(get_warp_ip)" if has_3xui_mode; then extra+="\nSOCKS5: 127.0.0.1:${SOCKS_PORT}"; fi - if has_awg_mode; then extra+="\nКонтейнер: ${CONTAINER:-N/A}"; fi + if has_awg_mode; then + awg_discover_containers 2>/dev/null + for _c in "${AWG_ALL_CONTAINERS[@]}"; do + extra+="\n📦 ${_c}" + done + fi local mode_label="3X-UI" [ "$MODE" = "amnezia" ] && mode_label="AmneziaWG" [ "$MODE" = "both" ] && mode_label="3X-UI + AWG" @@ -1365,9 +1370,13 @@ bot_handle_callback() { [ -n "$raw" ] && extra+="\n\n
${raw}
" fi if has_awg_mode; then - extra+="\nКонтейнер: ${CONTAINER:-N/A}\nПодсеть: ${AWG_SUBNET:-N/A}" - awg_load_clients - extra+="\nКлиентов в WARP: ${#AWG_SELECTED_IPS[@]}" + awg_discover_containers 2>/dev/null + for _c in "${AWG_ALL_CONTAINERS[@]}"; do + local _w="☐" + docker exec "$_c" sh -c "ip addr show warp >/dev/null 2>&1" 2>/dev/null && _w="✅" + local _cn; _cn=$(docker exec "$_c" sh -c "cat /opt/warp/clients.list 2>/dev/null | grep -c '.' || echo 0" 2>/dev/null | tr -d '\r\n') + extra+="\n📦 ${_c} ${_w} (клиентов: ${_cn})" + done fi tg_edit "$chat_id" "$msg_id" "📊 Статус WARP\n\nСтатус: ${ws}\nСервер: ${MY_IP:-N/A}${wip}${extra}" "$(kbd_back)" ;; @@ -1574,7 +1583,12 @@ bot_handle_callback() { s+="\nWARP: ${ws}" s+="\nРежим: ${MODE}" if has_3xui_mode; then s+="\nSOCKS5: 127.0.0.1:${SOCKS_PORT}"; fi - if has_awg_mode; then s+="\nКонтейнер: ${CONTAINER:-N/A}"; fi + if has_awg_mode; then + awg_discover_containers 2>/dev/null + for _c in "${AWG_ALL_CONTAINERS[@]}"; do + s+="\n📦 ${_c}" + done + fi tg_edit "$chat_id" "$msg_id" "$s" "$(kbd_back)" ;; promo) @@ -1955,8 +1969,16 @@ show_menu() { if has_3xui_mode && is_warp_running_3xui 2>/dev/null; then echo -e " ${WHITE}SOCKS5:${NC} ${CYAN}127.0.0.1:${SOCKS_PORT}${NC}" fi - if has_awg_mode && [ -n "${CONTAINER:-}" ]; then - echo -e " ${WHITE}Контейнер:${NC} ${CYAN}${CONTAINER}${NC}" + if has_awg_mode; then + awg_discover_containers 2>/dev/null + if [ ${#AWG_ALL_CONTAINERS[@]} -gt 0 ]; then + local ci=1 + for _c in "${AWG_ALL_CONTAINERS[@]}"; do + local _up; _up=$(docker ps --format '{{.Status}}' --filter "name=^${_c}$" 2>/dev/null | tr -d '\r') + echo -e " ${WHITE}Контейнер #${ci}:${NC} ${CYAN}${_c}${NC} ${DIM}(${_up})${NC}" + ((ci++)) + done + fi fi echo -e "\n${CYAN}── WARP-ключ ──────────────────────────────────────────${NC}"