mirror of
https://github.com/gSpotx2f/ruantiblock_openwrt.git
synced 2026-05-14 22:50:58 +00:00
luci-app-ruantiblock: info.js - ipset dnsmasq
This commit is contained in:
@@ -6,7 +6,7 @@ include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=ruantiblock
|
||||
PKG_VERSION:=0.9.4
|
||||
PKG_RELEASE:=0
|
||||
PKG_RELEASE:=1
|
||||
PKG_MAINTAINER:=gSpot <https://github.com/gSpotx2f/ruantiblock_openwrt>
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
@@ -25,19 +25,41 @@ Info() {
|
||||
printf "\"_dummy\":false},";
|
||||
}'
|
||||
printf "\"ipset\":{";
|
||||
for _set in "$IPSET_ALLOWED_HOSTS" "$IPSET_ONION" "$IPSET_CIDR_TMP" "$IPSET_CIDR" "$IPSET_IP_TMP" "$IPSET_IP" "$IPSET_DNSMASQ"
|
||||
for _set in "$IPSET_ALLOWED_HOSTS" "$IPSET_ONION" "$IPSET_CIDR_TMP" "$IPSET_CIDR" "$IPSET_IP_TMP" "$IPSET_IP"
|
||||
do
|
||||
$IPSET_CMD list "$_set" -terse | $AWK_CMD -F ": " '
|
||||
{
|
||||
if($1 ~ /^Name/)
|
||||
if($1 ~ /^Name/) {
|
||||
printf "\""$2"\":[";
|
||||
else if($1 ~ /^Size in memory/)
|
||||
}
|
||||
else if($1 ~ /^Size in memory/) {
|
||||
printf "\""$2"\",";
|
||||
else if($1 ~ /^Number of entries/)
|
||||
}
|
||||
else if($1 ~ /^Number of entries/) {
|
||||
printf "\""$2"\"],";
|
||||
};
|
||||
}'
|
||||
done
|
||||
printf "\"_dummy\":false}}"
|
||||
$IPSET_CMD list "$IPSET_DNSMASQ" | $AWK_CMD -F ": " '
|
||||
{
|
||||
if($1 ~ /^Name/) {
|
||||
printf "\""$2"\":[";
|
||||
}
|
||||
else if($1 ~ /^Size in memory/) {
|
||||
printf "\""$2"\",";
|
||||
}
|
||||
else if($1 ~ /^Number of entries/) {
|
||||
printf "\""$2"\"]},\"dnsmasq\":[";
|
||||
}
|
||||
else if($0 ~ /^[0-9]/) {
|
||||
split($0, a, " ");
|
||||
printf "[\"" a[1] "\",\"" a[3] "\"],";
|
||||
};
|
||||
}
|
||||
END {
|
||||
printf "false],";
|
||||
}'
|
||||
printf "\"_dummy\":false}"
|
||||
else
|
||||
printf "{\"status\": \"disabled\"}"
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user