feat: add status panels and utility functions for better diagnostics UI
This commit is contained in:
@@ -7,7 +7,7 @@ script=$(readlink "$initscript")
|
||||
NAME="$(basename ${script:-$initscript})"
|
||||
config_load "$NAME"
|
||||
|
||||
EXTRA_COMMANDS="main list_update check_proxy check_nft check_github check_logs check_sing_box_connections check_sing_box_logs check_dnsmasq show_config show_version show_sing_box_config show_luci_version show_sing_box_version show_system_info get_status get_sing_box_status get_proxy_label"
|
||||
EXTRA_COMMANDS="main list_update check_proxy check_nft check_github check_logs check_sing_box_connections check_sing_box_logs check_dnsmasq show_config show_version show_sing_box_config show_luci_version show_sing_box_version show_system_info get_status get_sing_box_status"
|
||||
EXTRA_HELP=" list_update Updating domain and subnet lists
|
||||
check_proxy Check if sing-box proxy works correctly
|
||||
check_nft Show PodkopTable nftables rules
|
||||
@@ -1780,6 +1780,7 @@ get_sing_box_status() {
|
||||
local enabled=0
|
||||
local status=""
|
||||
local version=""
|
||||
local dns_configured=0
|
||||
|
||||
# Check if service is enabled
|
||||
if [ -x /etc/rc.d/S99sing-box ]; then
|
||||
@@ -1792,6 +1793,12 @@ get_sing_box_status() {
|
||||
version=$(sing-box version | head -n 1 | awk '{print $3}')
|
||||
fi
|
||||
|
||||
# Check DNS configuration
|
||||
local dns_server=$(uci get dhcp.@dnsmasq[0].server 2>/dev/null)
|
||||
if [ "$dns_server" = "127.0.0.42" ]; then
|
||||
dns_configured=1
|
||||
fi
|
||||
|
||||
# Format status message
|
||||
if [ $running -eq 1 ]; then
|
||||
if [ $enabled -eq 1 ]; then
|
||||
@@ -1807,7 +1814,7 @@ get_sing_box_status() {
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "{\"running\":$running,\"enabled\":$enabled,\"status\":\"$status\"}"
|
||||
echo "{\"running\":$running,\"enabled\":$enabled,\"status\":\"$status\",\"dns_configured\":$dns_configured}"
|
||||
}
|
||||
|
||||
get_status() {
|
||||
@@ -1843,18 +1850,6 @@ get_status() {
|
||||
echo "{\"running\":$running,\"enabled\":$enabled,\"status\":\"$status\"}"
|
||||
}
|
||||
|
||||
get_proxy_label() {
|
||||
local section="$1"
|
||||
local proxy_string
|
||||
local label=""
|
||||
|
||||
config_get proxy_string "$section" "proxy_string"
|
||||
if [ -n "$proxy_string" ]; then
|
||||
label=$(echo "$proxy_string" | sed -n 's/.*#\(.*\)$/\1/p')
|
||||
echo "$label"
|
||||
fi
|
||||
}
|
||||
|
||||
sing_box_add_secure_dns_probe_domain() {
|
||||
local domain="httpbin.org"
|
||||
local override_address="numbersapi.com"
|
||||
|
||||
Reference in New Issue
Block a user