Fix live dashboard duplication and input handling when piped
This commit is contained in:
@@ -71,7 +71,7 @@ conduit help # Show help message
|
|||||||
| Option | Default | Range | Description |
|
| Option | Default | Range | Description |
|
||||||
|--------|---------|-------|-------------|
|
|--------|---------|-------|-------------|
|
||||||
| `max-clients` | 200 | 1-1000 | Maximum concurrent proxy clients |
|
| `max-clients` | 200 | 1-1000 | Maximum concurrent proxy clients |
|
||||||
| `bandwidth` | 5 | 1-40 | Bandwidth limit per peer (Mbps) |
|
| `bandwidth` | 5 | 1-40, -1 | Bandwidth limit per peer (Mbps). Use -1 for unlimited. |
|
||||||
|
|
||||||
**Recommended values based on server CPU:**
|
**Recommended values based on server CPU:**
|
||||||
|
|
||||||
@@ -178,7 +178,7 @@ conduit help # راهنما
|
|||||||
| گزینه | پیشفرض | محدوده | توضیحات |
|
| گزینه | پیشفرض | محدوده | توضیحات |
|
||||||
|-------|---------|--------|---------|
|
|-------|---------|--------|---------|
|
||||||
| `max-clients` | 200 | 1-1000 | حداکثر کاربران همزمان |
|
| `max-clients` | 200 | 1-1000 | حداکثر کاربران همزمان |
|
||||||
| `bandwidth` | 5 | 1-40 | محدودیت پهنای باند (Mbps) |
|
| `bandwidth` | 5 | 1-40, -1 | محدودیت پهنای باند (Mbps). برای نامحدود -1 وارد کنید. |
|
||||||
|
|
||||||
**مقادیر پیشنهادی بر اساس پردازنده (CPU):**
|
**مقادیر پیشنهادی بر اساس پردازنده (CPU):**
|
||||||
|
|
||||||
|
|||||||
23
conduit.sh
23
conduit.sh
@@ -685,15 +685,21 @@ show_dashboard() {
|
|||||||
clear
|
clear
|
||||||
|
|
||||||
while [ $stop_dashboard -eq 0 ]; do
|
while [ $stop_dashboard -eq 0 ]; do
|
||||||
# Move cursor to top-left (0,0) instead of just home escape code
|
# Move cursor to top-left (0,0) and clear screen
|
||||||
tput cup 0 0 2>/dev/null || echo -ne "\033[H"
|
# Using both tput and ANSI codes for maximum compatibility
|
||||||
|
if ! tput cup 0 0 2>/dev/null; then
|
||||||
|
printf "\033[H"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Clear from cursor to end of screen (Erase Down)
|
||||||
|
if ! tput ed 2>/dev/null; then
|
||||||
|
printf "\033[J"
|
||||||
|
fi
|
||||||
|
|
||||||
print_live_stats_header
|
print_live_stats_header
|
||||||
|
|
||||||
show_status "live"
|
show_status "live"
|
||||||
|
|
||||||
# System Resource Usage is now part of show_status
|
|
||||||
|
|
||||||
# Show Node ID in its own section
|
# Show Node ID in its own section
|
||||||
local node_id=$(get_node_id)
|
local node_id=$(get_node_id)
|
||||||
if [ -n "$node_id" ]; then
|
if [ -n "$node_id" ]; then
|
||||||
@@ -704,11 +710,9 @@ show_dashboard() {
|
|||||||
|
|
||||||
echo -e "${BOLD}Refreshes every 5 seconds. Press any key to return to menu...${NC}\033[K"
|
echo -e "${BOLD}Refreshes every 5 seconds. Press any key to return to menu...${NC}\033[K"
|
||||||
|
|
||||||
# Clear any leftover content below (Erase Down)
|
|
||||||
tput ed 2>/dev/null || true
|
|
||||||
|
|
||||||
# Wait 4 seconds for keypress (compensating for processing time)
|
# Wait 4 seconds for keypress (compensating for processing time)
|
||||||
if read -t 4 -n 1; then
|
# Redirect from /dev/tty ensures it works when the script is piped
|
||||||
|
if read -t 4 -n 1 -s <> /dev/tty 2>/dev/null; then
|
||||||
stop_dashboard=1
|
stop_dashboard=1
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
@@ -802,7 +806,8 @@ show_live_stats() {
|
|||||||
local cmd_pid=$!
|
local cmd_pid=$!
|
||||||
|
|
||||||
# Wait for any key press
|
# Wait for any key press
|
||||||
read -n 1 -s -r
|
# Redirect from /dev/tty ensures it works when the script is piped
|
||||||
|
read -n 1 -s -r <> /dev/tty 2>/dev/null || true
|
||||||
|
|
||||||
# Kill the background process
|
# Kill the background process
|
||||||
kill $cmd_pid 2>/dev/null
|
kill $cmd_pid 2>/dev/null
|
||||||
|
|||||||
BIN
conduitmenu.png
BIN
conduitmenu.png
Binary file not shown.
|
Before Width: | Height: | Size: 35 KiB After Width: | Height: | Size: 38 KiB |
Reference in New Issue
Block a user