mirror of
https://github.com/gSpotx2f/ruantiblock_openwrt.git
synced 2026-05-14 22:50:58 +00:00
v1.5. New options: USER_ENTRIES_REMOTE, ENABLE_TMP_DOWNLOADS. Fixes & improvements.
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
|
||||
UCI_SECTION="ruantiblock.config"
|
||||
UCI_VARS="proxy_mode proxy_local_clients nftset_clear_sets allowed_hosts_mode allowed_hosts_list bypass_mode bypass_entries_dns enable_fproxy fproxy_list enable_bllist_proxy if_vpn vpn_gw_ip vpn_route_check tor_trans_port onion_dns_addr t_proxy_port_tcp t_proxy_port_udp t_proxy_allow_udp add_user_entries user_entries_dns enable_logging bllist_min_entries bllist_module bllist_preset bllist_ip_limit bllist_gr_excluded_nets bllist_summarize_ip bllist_summarize_cidr bllist_ip_filter bllist_ip_filter_type bllist_sd_limit bllist_gr_excluded_sld bllist_fqdn_filter bllist_fqdn_filter_type bllist_enable_idn bllist_alt_nslookup bllist_alt_dns_addr update_at_startup"
|
||||
UCI_VARS="proxy_mode proxy_local_clients nftset_clear_sets allowed_hosts_mode allowed_hosts_list bypass_mode bypass_entries_dns enable_fproxy fproxy_list enable_bllist_proxy if_vpn vpn_gw_ip vpn_route_check tor_trans_port onion_dns_addr t_proxy_port_tcp t_proxy_port_udp t_proxy_allow_udp add_user_entries user_entries_dns user_entries_remote enable_logging bllist_min_entries bllist_module bllist_preset bllist_ip_limit bllist_gr_excluded_nets bllist_summarize_ip bllist_summarize_cidr bllist_ip_filter bllist_ip_filter_type bllist_sd_limit bllist_gr_excluded_sld bllist_fqdn_filter bllist_fqdn_filter_type bllist_enable_idn bllist_alt_nslookup bllist_alt_dns_addr update_at_startup enable_tmp_downloads"
|
||||
UCI_CMD=`which uci`
|
||||
if [ $? -ne 0 ]; then
|
||||
echo " Error! UCI doesn't exists" >&2
|
||||
|
||||
@@ -2,15 +2,38 @@ Info() {
|
||||
local _update_status
|
||||
if [ -f "$UPDATE_STATUS_FILE" ]; then
|
||||
_update_status=`$AWK_CMD '{
|
||||
if(NF < 4)
|
||||
if(NF < 4) {
|
||||
printf "{\"status\":false}";
|
||||
else
|
||||
} else {
|
||||
printf "{\"status\":true,\"date\":\""$4"\",\"cidr\":\""$1"\",\"ip\":\""$2"\",\"fqdn\":\""$3"\"}";
|
||||
};
|
||||
}' "$UPDATE_STATUS_FILE"`
|
||||
else
|
||||
_update_status="{\"status\":false}"
|
||||
fi
|
||||
NftListBllistChainJson 2> /dev/null | $AWK_CMD -v UPDATE_STATUS="$_update_status" '
|
||||
if [ -f "$USER_ENTRIES_STATUS_FILE" ]; then
|
||||
_user_entries_status=`$AWK_CMD '
|
||||
BEGIN {
|
||||
items = 0;
|
||||
printf "[";
|
||||
}
|
||||
{
|
||||
if(NF == 4) {
|
||||
gsub("/", "\134\134/", $4);
|
||||
if(items >= 1) {
|
||||
printf ",";
|
||||
};
|
||||
printf "{\"id\":\""$4"\",\"cidr\":\""$1"\",\"ip\":\""$2"\",\"fqdn\":\""$3"\"}";
|
||||
items++;
|
||||
};
|
||||
}
|
||||
END {
|
||||
printf "]";
|
||||
}' "$USER_ENTRIES_STATUS_FILE"`
|
||||
else
|
||||
_user_entries_status="[]"
|
||||
fi
|
||||
NftListBllistChainJson 2> /dev/null | $AWK_CMD -v UPDATE_STATUS="$_update_status" -v USER_ENTRIES_STATUS="$_user_entries_status" '
|
||||
BEGIN {
|
||||
rules_str = "";
|
||||
}
|
||||
@@ -22,7 +45,7 @@ Info() {
|
||||
printf "{\"status\": \"disabled\"}";
|
||||
exit 1;
|
||||
} else {
|
||||
printf "{\"status\":\"enabled\",\"last_blacklist_update\":%s,\"rules\":%s", UPDATE_STATUS, rules_str;
|
||||
printf "{\"status\":\"enabled\",\"last_blacklist_update\":%s,\"user_entries\":%s,\"rules\":%s", UPDATE_STATUS, USER_ENTRIES_STATUS, rules_str;
|
||||
exit 0;
|
||||
};
|
||||
}'
|
||||
|
||||
Reference in New Issue
Block a user