From 489666bdd2b78eaed5758c368b4e3369d6aa230a Mon Sep 17 00:00:00 2001 From: Whispering Wind <151555003+ReturnFI@users.noreply.github.com> Date: Fri, 11 Oct 2024 13:11:22 +0330 Subject: [PATCH] Create status.sh --- core/scripts/warp/status.sh | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 core/scripts/warp/status.sh diff --git a/core/scripts/warp/status.sh b/core/scripts/warp/status.sh new file mode 100644 index 0000000..6888eee --- /dev/null +++ b/core/scripts/warp/status.sh @@ -0,0 +1,34 @@ +source /etc/hysteria/core/scripts/utils.sh +source /etc/hysteria/core/scripts/path.sh + +check_warp_configuration() { + echo "${yellow}Current WARP Configuration:${NC}" + echo "--------------------------------" + + if jq -e '.acl.inline[]? | select(test("warps\\(all\\)"))' "$CONFIG_FILE" > /dev/null; then + echo -e "${cyan}All traffic:${NC} ${green}Active${NC}" + else + echo -e "${cyan}All traffic:${NC} ${red}Inactive${NC}" + fi + + if jq -e '.acl.inline[]? | select(test("warps\\(geosite:google\\)")) or select(test("warps\\(geoip:google\\)")) or select(test("warps\\(geosite:netflix\\)")) or select(test("warps\\(geosite:spotify\\)")) or select(test("warps\\(geosite:openai\\)")) or select(test("warps\\(geoip:openai\\)"))' "$CONFIG_FILE" > /dev/null; then + echo -e "${cyan}Popular sites (Google, Netflix, etc.):${NC} ${green}Active${NC}" + else + echo -e "${cyan}Popular sites (Google, Netflix, etc.):${NC} ${red}Inactive${NC}" + fi + + if jq -e '.acl.inline[]? | select(test("warps\\(geosite:ir\\)")) or select(test("warps\\(geoip:ir\\)"))' "$CONFIG_FILE" > /dev/null; then + echo -e "${cyan}Domestic sites (geosite:ir, geoip:ir):${NC} ${green}Active${NC}" + else + echo -e "${cyan}Domestic sites (geosite:ir, geoip:ir):${NC} ${red}Inactive${NC}" + fi + + if jq -e '.acl.inline[]? | select(test("reject\\(geosite:category-porn\\)"))' "$CONFIG_FILE" > /dev/null; then + echo -e "${cyan}Block adult content:${NC} ${green}Active${NC}" + else + echo -e "${cyan}Block adult content:${NC} ${red}Inactive${NC}" + fi + echo "--------------------------------" +} +define_colors +check_warp_configuration