luci-app-chinadns: fix init

This commit is contained in:
CN_SZTL 2019-07-21 00:08:27 +08:00
parent 10cd9a0a3e
commit 97951d0f67
No known key found for this signature in database
GPG Key ID: 6850B6345C862176

View File

@ -39,12 +39,14 @@ append_parm() {
start_chinadns() {
local enable
local yn_use_proxy
local local_subnet
local foreign_subnet
local local_subnet=$(echo `curl -4 -s members.3322.org/dyndns/getip | grep -oE '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.'`0)
config_get_bool enable $1 enable
[ "$enable" = 1 ] || return 0
config_get_bool yn_use_proxy $1 yn_use_proxy
[ "$yn_use_proxy" = 0 ] && local foreign_subnet && config_get foreign_subnet $1 foreign_subnet
[ "$yn_use_proxy" = 1 ] && local foreign_subnet=$(echo `curl -4 -s ip.sb | grep -oE '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.'`0)
[ "$yn_use_proxy" = 1 ] && local foreign_subnet=$(echo `curl -4 -s ip.sb | grep -oE '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.'`0) || config_get foreign_subnet $1 foreign_subnet
append_parm $1 port "-p"
append_parm $1 server "-s"
append_parm $1 chnroute "-c"
@ -55,6 +57,7 @@ start_chinadns() {
}
start() {
stop
config_load chinadns
config_foreach start_chinadns chinadns
}