Show all containers with number and uptime in main menu and bot

Made-with: Cursor
This commit is contained in:
anten-ka
2026-03-22 13:53:35 +03:00
parent 7c7364f501
commit 6fe5cf2540

36
warp.sh
View File

@@ -1333,7 +1333,12 @@ bot_main_menu() {
ws=$(get_warp_status) ws=$(get_warp_status)
is_warp_running && wip=" | WARP IP: $(get_warp_ip)" is_warp_running && wip=" | WARP IP: $(get_warp_ip)"
if has_3xui_mode; then extra+="\nSOCKS5: <code>127.0.0.1:${SOCKS_PORT}</code>"; fi if has_3xui_mode; then extra+="\nSOCKS5: <code>127.0.0.1:${SOCKS_PORT}</code>"; fi
if has_awg_mode; then extra+="\nКонтейнер: <code>${CONTAINER:-N/A}</code>"; fi if has_awg_mode; then
awg_discover_containers 2>/dev/null
for _c in "${AWG_ALL_CONTAINERS[@]}"; do
extra+="\n📦 <code>${_c}</code>"
done
fi
local mode_label="3X-UI" local mode_label="3X-UI"
[ "$MODE" = "amnezia" ] && mode_label="AmneziaWG" [ "$MODE" = "amnezia" ] && mode_label="AmneziaWG"
[ "$MODE" = "both" ] && mode_label="3X-UI + AWG" [ "$MODE" = "both" ] && mode_label="3X-UI + AWG"
@@ -1365,9 +1370,13 @@ bot_handle_callback() {
[ -n "$raw" ] && extra+="\n\n<pre>${raw}</pre>" [ -n "$raw" ] && extra+="\n\n<pre>${raw}</pre>"
fi fi
if has_awg_mode; then if has_awg_mode; then
extra+="\nКонтейнер: <code>${CONTAINER:-N/A}</code>\nПодсеть: <code>${AWG_SUBNET:-N/A}</code>" awg_discover_containers 2>/dev/null
awg_load_clients for _c in "${AWG_ALL_CONTAINERS[@]}"; do
extra+="\nКлиентов в WARP: <b>${#AWG_SELECTED_IPS[@]}</b>" 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📦 <code>${_c}</code> ${_w} (клиентов: ${_cn})"
done
fi fi
tg_edit "$chat_id" "$msg_id" "📊 <b>Статус WARP</b>\n\nСтатус: <b>${ws}</b>\nСервер: <code>${MY_IP:-N/A}</code>${wip}${extra}" "$(kbd_back)" ;; tg_edit "$chat_id" "$msg_id" "📊 <b>Статус WARP</b>\n\nСтатус: <b>${ws}</b>\nСервер: <code>${MY_IP:-N/A}</code>${wip}${extra}" "$(kbd_back)" ;;
@@ -1574,7 +1583,12 @@ bot_handle_callback() {
s+="\n<b>WARP:</b> ${ws}" s+="\n<b>WARP:</b> ${ws}"
s+="\n<b>Режим:</b> ${MODE}" s+="\n<b>Режим:</b> ${MODE}"
if has_3xui_mode; then s+="\n<b>SOCKS5:</b> 127.0.0.1:${SOCKS_PORT}"; fi if has_3xui_mode; then s+="\n<b>SOCKS5:</b> 127.0.0.1:${SOCKS_PORT}"; fi
if has_awg_mode; then s+="\n<b>Контейнер:</b> ${CONTAINER:-N/A}"; fi if has_awg_mode; then
awg_discover_containers 2>/dev/null
for _c in "${AWG_ALL_CONTAINERS[@]}"; do
s+="\n<b>📦</b> ${_c}"
done
fi
tg_edit "$chat_id" "$msg_id" "$s" "$(kbd_back)" ;; tg_edit "$chat_id" "$msg_id" "$s" "$(kbd_back)" ;;
promo) promo)
@@ -1955,8 +1969,16 @@ show_menu() {
if has_3xui_mode && is_warp_running_3xui 2>/dev/null; then 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}" echo -e " ${WHITE}SOCKS5:${NC} ${CYAN}127.0.0.1:${SOCKS_PORT}${NC}"
fi fi
if has_awg_mode && [ -n "${CONTAINER:-}" ]; then if has_awg_mode; then
echo -e " ${WHITE}Контейнер:${NC} ${CYAN}${CONTAINER}${NC}" 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 fi
echo -e "\n${CYAN}── WARP-ключ ──────────────────────────────────────────${NC}" echo -e "\n${CYAN}── WARP-ключ ──────────────────────────────────────────${NC}"