luci-app-chinadns: fix bugs

This commit is contained in:
CN_SZTL 2019-07-20 23:33:43 +08:00
parent a6a1b94bc6
commit 2417d0e02d
No known key found for this signature in database
GPG Key ID: 6850B6345C862176
6 changed files with 28 additions and 12 deletions

View File

@ -45,6 +45,7 @@ define Package/ChinaDNS/conffiles
endef
define Package/ChinaDNS/install
$(INSTALL_DIR) $(1)/etc
$(INSTALL_CONF) $(PKG_BUILD_DIR)/chnroute.txt $(1)/etc/chinadns_chnroute.txt
$(INSTALL_DIR) $(1)/usr/bin
$(INSTALL_BIN) $(PKG_BUILD_DIR)/src/chinadns $(1)/usr/sbin

View File

@ -8,8 +8,8 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=luci-app-chinadns
PKG_VERSION:=2.0.0
PKG_RELEASE:=beta
PKG_VERSION:=2.0.1
PKG_RELEASE:=1
PKG_LICENSE:=GPLv3
PKG_LICENSE_FILES:=LICENSE
@ -80,4 +80,4 @@ define Package/luci-app-chinadns/install
$(INSTALL_BIN) ./files/root/etc/uci-defaults/luci-chinadns $(1)/etc/uci-defaults/luci-chinadns
endef
$(eval $(call BuildPackage,luci-app-chinadns))
$(eval $(call BuildPackage,luci-app-chinadns))

View File

@ -10,11 +10,17 @@ msgstr "国内路由表"
msgid "Enable"
msgstr "启用"
msgid "Used a proxy or not"
msgstr "是否使用了代理服务器"
msgid "If you used a proxy like shadowsocks, please tick this option."
msgstr "如果您使用了类似SS的代理程序请勾选此选项"
msgid "Foreign Subnet"
msgstr "外网子网"
msgid "Just foreign subnet. The subnet of interface WAN will be used as local subnet."
msgstr "仅填写外网子网地址即可。接口WAN的子网地址将被用作本地子网地址。"
msgid "Just foreign subnet. The local subnet will be automatically obtained."
msgstr "仅填写外网子网地址即可,本地子网地址会自动获取。"
msgid "General Setting"
msgstr "基本设置"

View File

@ -17,6 +17,11 @@ s.anonymous = true
o = s:option(Flag, "enable", translate("Enable"))
o.rmempty = false
o = s:option(Flag, "yn_use_proxy",
translate("Used a proxy or not")
translate("If you used a proxy like shadowsocks, please tick this option."))
o.rmenpty = false
o = s:option(Value, "port", translate("Local Port"))
o.placeholder = 5353
o.default = 5353
@ -31,11 +36,12 @@ o.rmempty = false
o = s:option(Value, "foreign_subnet",
translate("Foreign Subnet"),
translate("Just foreign subnet. The subnet of interface WAN will be used as local subnet."))
translate("Just foreign subnet. The local subnet will be automatically obtained."))
o.placeholder = "45.76.96.0"
o.default = "45.76.96.0"
o.datatype = "ipaddr"
o.rmempty = false
o:depends("yn_use_proxy", 0)
o = s:option(Value, "server",
translate("Upstream Server"),
@ -45,4 +51,4 @@ o.default = "8.8.8.8"
o.datatype = "ipaddr"
o.rmempty = false
return m
return m

View File

@ -38,11 +38,13 @@ append_parm() {
start_chinadns() {
local enable
local local_subnet=$(echo `ifstatus wan | grep \"address\" | grep -oE '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.'`0)
local foreign_subnet
local yn_use_proxy
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 foreign_subnet $1 foreign_subnet
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 foregin_subnet=$(echo `curl -4 -s ip.sb | grep -oE '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.'`0)
append_parm $1 port "-p"
append_parm $1 server "-s"
append_parm $1 chnroute "-c"
@ -58,5 +60,5 @@ start() {
}
stop() {
service_stop /usr/bin/chinadns
service_stop /usr/sbin/chinadns
}

View File

@ -2,6 +2,7 @@
1.1.1.1
cloudflare-dns.com
debian.org
ip.sb
openwrt.org
apple.com
icloud.com
@ -63,4 +64,4 @@ akamai.net
akamaiedge.net
akamaihd.net
edgesuite.net
edgekey.net
edgekey.net