gistfile1.txt
· 1.0 KiB · Text
Raw
function cmd::list::_render_row() {
local client_name="$1" ip="$2" type="$3"
local pubkey="${p_pubkeys[$client_name]:-}"
local handshake_ts="${wg_handshakes[$pubkey]:-0}"
local is_blocked="${p_blocked[$client_name]:-false}"
local is_restricted="${p_restricted[$client_name]:-false}"
local last_ts="${p_last_ts[$client_name]:-}"
# Apply status filters
if $online_only; then cmd::list::_is_connected "$handshake_ts" || return 0; fi
if $offline_only; then cmd::list::_is_connected "$handshake_ts" && return 0; fi
if $restricted_only && [[ "$is_restricted" != "true" ]]; then return 0; fi
if $blocked_only && [[ "$is_blocked" != "true" ]]; then return 0; fi
if $allowed_only && { [[ "$is_blocked" == "true" ]] || \
[[ "$is_restricted" == "true" ]]; }; then return 0; fi
if [[ -n "$filter_rule" && "$rule" != "$filter_rule" ]]; then return 0; fi
if [[ -n "$filter_group" ]]; then
local peer_group="${peer_group_map[$client_name]:-}"
[[ "$peer_group" != "$filter_group" ]] && return 0
fi
| 1 | function cmd::list::_render_row() { |
| 2 | local client_name="$1" ip="$2" type="$3" |
| 3 | |
| 4 | local pubkey="${p_pubkeys[$client_name]:-}" |
| 5 | local handshake_ts="${wg_handshakes[$pubkey]:-0}" |
| 6 | local is_blocked="${p_blocked[$client_name]:-false}" |
| 7 | local is_restricted="${p_restricted[$client_name]:-false}" |
| 8 | local last_ts="${p_last_ts[$client_name]:-}" |
| 9 | |
| 10 | # Apply status filters |
| 11 | if $online_only; then cmd::list::_is_connected "$handshake_ts" || return 0; fi |
| 12 | if $offline_only; then cmd::list::_is_connected "$handshake_ts" && return 0; fi |
| 13 | if $restricted_only && [[ "$is_restricted" != "true" ]]; then return 0; fi |
| 14 | if $blocked_only && [[ "$is_blocked" != "true" ]]; then return 0; fi |
| 15 | if $allowed_only && { [[ "$is_blocked" == "true" ]] || \ |
| 16 | [[ "$is_restricted" == "true" ]]; }; then return 0; fi |
| 17 | |
| 18 | if [[ -n "$filter_rule" && "$rule" != "$filter_rule" ]]; then return 0; fi |
| 19 | if [[ -n "$filter_group" ]]; then |
| 20 | local peer_group="${peer_group_map[$client_name]:-}" |
| 21 | [[ "$peer_group" != "$filter_group" ]] && return 0 |
| 22 | fi |