forked from pexcn/openwrt-chinadns-ng
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6ca03cd
commit d75fb32
Showing
20 changed files
with
66,120 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,24 @@ | ||
include $(TOPDIR)/rules.mk | ||
PKG_VERSION:=1.0 | ||
PKG_RELEASE:=5 | ||
|
||
PKG_NAME:=luci-app-chinadns-ng | ||
PKG_VERSION:=1.1 | ||
PKG_RELEASE:=6 | ||
|
||
LUCI_TITLE:=LuCI support for chinadns-ng | ||
LUCI_DESCRIPTION:=LuCI Support for chinadns-ng. | ||
LUCI_DEPENDS:=+chinadns-ng | ||
LUCI_PKGARCH:=all | ||
|
||
include $(TOPDIR)/feeds/luci/luci.mk | ||
|
||
define Package/chinadns-ng/conffiles | ||
/etc/config/chinadns-ng | ||
/etc/chinadns-ng/chnroute.txt | ||
/etc/chinadns-ng/chnroute6.txt | ||
/etc/chinadns-ng/gfwlist.txt | ||
/etc/chinadns-ng/chinalist.txt | ||
/etc/chinadns-ng/whitelist.txt | ||
/etc/chinadns-ng/blacklist.txt | ||
endef | ||
|
||
# call BuildPackage - OpenWrt buildroot signature |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
require "nixio.fs" | ||
local m, s, o | ||
|
||
function sync_value_to_file(file, value) | ||
value = value:gsub("\r\n?", "\n") | ||
local old_value = nixio.fs.readfile(file) | ||
if value ~= old_value then | ||
nixio.fs.writefile(file, value) | ||
end | ||
end | ||
|
||
m = Map("chinadns-ng", translate("")) | ||
|
||
s = m:section(TypedSection, "chinadns-ng", translate("Route Setting")) | ||
s:tab("blacklist", translate("Black List")) | ||
s:tab("whitelist", translate("White List")) | ||
s.addremove = false | ||
s.anonymous = true | ||
|
||
|
||
o = s:taboption("blacklist", Value, "gfwlist_file", | ||
translate("Use GFWRoute File"), | ||
translate("Choose black domain list file, Domains in black list will use trusted DNS servers. You can choose one of these or use any other file:") | ||
..[[<br />/etc/chinadns-ng/gfwlist.txt ]] | ||
..translate("(default GFWRoute list, can be updated automaticly. If you use SSR+, don't use gfwlist file for black list.)") | ||
..[[<br />/etc/chinadns-ng/blacklist.txt ]] | ||
..translate("(custom GFWRoute list, you can edit it below)") | ||
) | ||
o.placeholder = "/etc/chinadns-ng/blacklist.txt" | ||
o.default = "/etc/chinadns-ng/blacklist.txt" | ||
o.datatype = "file" | ||
o.rmempty = false | ||
|
||
local blacklist = "/etc/chinadns-ng/blacklist.txt" | ||
o = s:taboption("blacklist", TextValue, "blacklist", | ||
translate("Custom GFWRoute List (Black Domain List)"), | ||
translate("Edit the content of custom black domain list file (/etc/chinadns-ng/blacklist.txt)")) | ||
o.rows = 13 | ||
o.wrap = "off" | ||
o.rmempty = true | ||
|
||
o.cfgvalue = function(self, section) | ||
return nixio.fs.readfile(blacklist) or " " | ||
end | ||
o.write = function(self, section, value) | ||
sync_value_to_file(blacklist, value) | ||
end | ||
o.remove = function(self, section, value) | ||
nixio.fs.writefile(blacklist, "") | ||
end | ||
|
||
|
||
o = s:taboption("whitelist", Value, "chnlist_file", | ||
translate("Use CHNRoute File"), | ||
translate("Choose white domain list file, domains in white list will use China DNS servers. You can choose one of these or use any other file:") | ||
..[[<br />/etc/chinadns-ng/chinalist.txt ]] | ||
..translate("(default CHNRoute list, can be updated automaticly)") | ||
..[[<br />/etc/chinadns-ng/whitelist.txt ]] | ||
..translate("(custom CHNRoute list, you can edit it below)") | ||
) | ||
o.placeholder = "/etc/chinadns-ng/whitelist.txt" | ||
o.default = "/etc/chinadns-ng/whitelist.txt" | ||
o.datatype = "file" | ||
o.rmempty = false | ||
|
||
local whitelist = "/etc/chinadns-ng/whitelist.txt" | ||
o = s:taboption("whitelist", TextValue, "whitelist", | ||
translate("Custom CHNRoute List (White Domain List)"), | ||
translate("Edit the content of custom white domain list file (/etc/chinadns-ng/whitelist.txt)")) | ||
o.rows = 13 | ||
o.wrap = "off" | ||
o.rmempty = true | ||
|
||
o.cfgvalue = function(self, section) | ||
return nixio.fs.readfile(whitelist) or " " | ||
end | ||
o.write = function(self, section, value) | ||
sync_value_to_file(whitelist, value) | ||
end | ||
o.remove = function(self, section, value) | ||
nixio.fs.writefile(whitelist, "") | ||
end | ||
|
||
return m |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
local m, s, o | ||
|
||
m = Map("chinadns-ng", translate("")) | ||
|
||
s = m:section(TypedSection, "chinadns-ng", translate("Rules Update")) | ||
s.addremove = false | ||
s.anonymous = true | ||
|
||
o = s:option(Flag, "auto_update", translate("Auto Update"), translate("Auto update China ipset and route lists at 3:00 on Saturday")) | ||
o.rmempty = false | ||
|
||
o=s:option(DummyValue,"chinadns-ng_data",translate("Update Now")) | ||
o.rawhtml = true | ||
o.template = "chinadns-ng/refresh" | ||
o.value = " " | ||
|
||
return m |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<%+cbi/valueheader%> | ||
<script type="text/javascript">//<![CDATA[ | ||
function refresh_data(btn,dataname) | ||
{ | ||
btn.disabled = true; | ||
btn.value = '<%:Refresh...%> '; | ||
murl=dataname; | ||
XHR.get('<%=luci.dispatcher.build_url("admin", "services", "chinadns-ng","refresh")%>', | ||
{ set:murl }, | ||
function(x,rv) | ||
{ | ||
var s = document.getElementById(dataname +'-status'); | ||
if (s) | ||
{ | ||
if(rv.ret=="-1") | ||
s.innerHTML ="<font color='red'>"+"<%:Refresh Error!%> "+"</font>"; | ||
else | ||
s.innerHTML ="<font color='green'>"+"<%:Refresh OK!%> "+"</font>"; | ||
} | ||
btn.disabled = false; | ||
btn.value = '<%:Refresh %>'; | ||
} | ||
); | ||
return false; | ||
} | ||
//]]></script> | ||
<input type="button" class="cbi-button cbi-input-reload" value="<%:Refresh%> " onclick="return refresh_data(this,'<%=self.option%>')" /> | ||
<span id="<%=self.option%>-status"><em><%=self.value%></em></span> | ||
<%+cbi/valuefooter%> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<script type="text/javascript">//<![CDATA[ | ||
XHR.poll(3, '<%=url([[admin]], [[services]], [[chinadns-ng]], [[status]])%>', null, | ||
function(x, data) { | ||
var tb = document.getElementById('chinadns-ng_status'); | ||
if (data && tb) { | ||
if (data.running) { | ||
var links = '<em><b><font color=green>ChinaDNS-NG <%:RUNNING%></font></b></em>'; | ||
tb.innerHTML = links; | ||
} else { | ||
tb.innerHTML = '<em><b><font color=red>ChinaDNS-NG <%:NOT RUNNING%></font></b></em>'; | ||
} | ||
} | ||
} | ||
); | ||
//]]> | ||
</script> | ||
<style>.mar-10 {margin-left: 50px; margin-right: 10px;}</style> | ||
<fieldset class="cbi-section"> | ||
<p id="chinadns-ng_status"> | ||
<em><%:Collecting data...%></em> | ||
</p> | ||
</fieldset> |
Oops, something went wrong.