Skip to content

Commit

Permalink
Merge pull request thuantran#301 from thuantran/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
jumpsmm7 authored Mar 11, 2022
2 parents 6909038 + 6771cc4 commit 0907000
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 43 deletions.
73 changes: 31 additions & 42 deletions installer
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
# | | | \| | (___ | | / \ | | | | | |__ | |__) | Current Maintainer: #
# | | | . ` |\___ \ | | / /\ \ | | | | | __| | _ / SomeWhereOverTheRainBow #
# _| |_| |\ |____) | | |/ ____ \| |____| |____| |____| | \ \ #
#|_____|_| \_|_____/ |_/_/ \_|______|______|______|_| \_\ v2.3.5 #
#|_____|_| \_|_____/ |_/_/ \_|______|______|______|_| \_\ v2.3.6 #
# #
########################################################################################################

Expand All @@ -37,7 +37,7 @@
# shellcheck disable=SC3057
# shellcheck disable=SC3060

DI_VERSION="v2.3.5"
DI_VERSION="v2.3.6"
readonly LATEST_URL="https://api.github.com/repos/jedisct1/dnscrypt-proxy/releases/latest"
readonly DNSCRYPT_VER="$(curl -sL "$LATEST_URL" | grep "tag_name" | head -1 | cut -d \" -f 4)"

Expand Down Expand Up @@ -188,50 +188,39 @@ check_dns_environment () {
}

check_dns_filter () {
local DNSFIL
DNSFIL="$(nvram get dnsfilter_enable_x)"
local NVCHECK
NVCHECK="0"
local USE_SOME
if [ "$1" -eq 0 ] && [ "$DNSFIL" -ne 0 ]; then
nvram set dnsfilter_enable_x="0"
nvram commit
service "restart_firewall;restart_dnsmasq" >/dev/null 2>&1
if [ "$1" -eq 0 ]; then
if [ "$(nvram get dnsfilter_enable_x)" -ne 0 ]; then { nvram set dnsfilter_enable_x="0"; }; NVCHECK="$((NVCHECK+1))"; fi
PTXT "$INFO DNS will not be forced through this proxy."
return
fi
if [ "$1" -eq 1 ] && [ "$DNSFIL" -ne 1 ]; then
nvram set dnsfilter_enable_x="1"
USE_SOME=1
elif [ "$1" -eq 1 ] && [ "$DNSFIL" -ne 0 ]; then
PTXT "$INFO DNSFilter is Already on." \
"$INFO You can choose to keep any custom dnsfilter values and only redirect non-custom traffic or send all traffic through this proxy."
read_yesno "Do you want to redirect only SOME DNS resolutions on your network through this proxy?" && USE_SOME="0" || USE_SOME="1"
fi
if [ "$USE_SOME" -eq 0 ]; then
nvram set dnsfilter_mode="11"
nvram commit
service "restart_firewall;restart_dnsmasq" >/dev/null 2>&1
PTXT "$INFO DNSFilter is set to control DNS through this proxy, while leaving any Custom Rules and Values."
return
fi
if [ "$USE_SOME" -eq 1 ]; then
nvram set dnsfilter_custom1=""
nvram set dnsfilter_custom2=""
nvram set dnsfilter_custom3=""
nvram set dnsfilter_mode="11"
nvram set dnsfilter_rulelist=""
nvram set dnsfilter_rulelist1=""
nvram set dnsfilter_rulelist2=""
nvram set dnsfilter_rulelist3=""
nvram set dnsfilter_rulelist4=""
nvram set dnsfilter_rulelist5=""
nvram set dhcp_dns1_x=""
nvram set dhcp_dns2_x=""
nvram set dhcpd_dns_router="1"
nvram commit
service "restart_firewall;restart_dnsmasq" >/dev/null 2>&1
PTXT "$INFO DNS is set to redirect All DNS resolutions through this proxy."
return
if [ "$1" -eq 1 ]; then
if [ "$(nvram get dnsfilter_enable_x)" -ne 1 ]; then { nvram set dnsfilter_enable_x="1"; }; NVCHECK="$((NVCHECK+1))"; fi
PTXT "$INFO You can choose to keep any custom dnsfilter values by only redirect non-custom traffic or send all traffic through to AdGuardHome."
read_yesno "Do you want to redirect only NON-CUSTOM DNS resolutions on your network through AdGuardHome?" && USE_SOME="0" || USE_SOME="1"
if [ "$USE_SOME" -eq 0 ]; then
if [ "$(nvram get dnsfilter_mode)" != "11" ]; then { nvram set dnsfilter_mode="11"; }; NVCHECK="$((NVCHECK+1))"; fi
PTXT "$INFO DNSFilter is set to control DNS through this proxy, while leaving any Custom Rules and Values."
fi
if [ "$USE_SOME" -eq 1 ]; then
if [ "$(nvram get dnsfilter_custom1)" ]; then { nvram set dnsfilter_custom1=""; }; NVCHECK="$((NVCHECK+1))"; fi
if [ "$(nvram get dnsfilter_custom2)" ]; then { nvram set dnsfilter_custom2=""; }; NVCHECK="$((NVCHECK+1))"; fi
if [ "$(nvram get dnsfilter_custom3)" ]; then { nvram set dnsfilter_custom3=""; }; NVCHECK="$((NVCHECK+1))"; fi
if [ "$(nvram get dnsfilter_mode)" != "11" ]; then { nvram set dnsfilter_mode="11"; }; NVCHECK="$((NVCHECK+1))"; fi
if [ "$(nvram get dnsfilter_rulelist)" ]; then { nvram set dnsfilter_rulelist=""; }; NVCHECK="$((NVCHECK+1))"; fi
if [ "$(nvram get dnsfilter_rulelist1)" ]; then { nvram set dnsfilter_rulelist1=""; }; NVCHECK="$((NVCHECK+1))"; fi
if [ "$(nvram get dnsfilter_rulelist2)" ]; then { nvram set dnsfilter_rulelist2=""; }; NVCHECK="$((NVCHECK+1))"; fi
if [ "$(nvram get dnsfilter_rulelist3)" ]; then { nvram set dnsfilter_rulelist3=""; }; NVCHECK="$((NVCHECK+1))"; fi
if [ "$(nvram get dnsfilter_rulelist4)" ]; then { nvram set dnsfilter_rulelist4=""; }; NVCHECK="$((NVCHECK+1))"; fi
if [ "$(nvram get dnsfilter_rulelist5)" ]; then { nvram set dnsfilter_rulelist5=""; }; NVCHECK="$((NVCHECK+1))"; fi
if [ "$(nvram get dhcp_dns1_x)" ]; then { nvram set dhcp_dns1_x=""; }; NVCHECK="$((NVCHECK+1))"; fi
if [ "$(nvram get dhcp_dns2_x)" ]; then { nvram set dhcp_dns2_x=""; }; NVCHECK="$((NVCHECK+1))"; fi
if [ "$(nvram get dhcpd_dns_router)" != "1" ]; then { nvram set dhcpd_dns_router="1"; }; NVCHECK="$((NVCHECK+1))"; fi
PTXT "$INFO DNS is set to redirect All DNS resolutions through this proxy."
fi
fi
if [ "$NVCHECK" != "0" ]; then { nvram commit; }; { service "restart_firewall;restart_dnsmasq" >/dev/null 2>&1; }; while { [ "$(ping 1.1.1.1 -c1 -W2 >/dev/null 2>&1; printf "%s" "$?")" = "0" ] && [ "$(nslookup google.com 127.0.0.1 >/dev/null 2>&1; printf "%s" "$?")" != "0" ]; }; do sleep 1; done; fi
}

check_jffs_enabled () {
Expand Down
2 changes: 1 addition & 1 deletion installer.md5sum
Original file line number Diff line number Diff line change
@@ -1 +1 @@
d3c6a83c666ecacec5aaa4d578ef625d
ac24c52bb4b46690d08e852eba508392

0 comments on commit 0907000

Please sign in to comment.