luci: fix status section not working issue and add some options
This commit is contained in:
@@ -36,7 +36,9 @@
|
|||||||
# IPV6:
|
# IPV6:
|
||||||
# bind [::]:53
|
# bind [::]:53
|
||||||
# bind-tcp [::]:53
|
# bind-tcp [::]:53
|
||||||
bind [::]:53
|
bind [::]:7053
|
||||||
|
|
||||||
|
force-AAAA-SOA yes
|
||||||
|
|
||||||
# tcp connection idle timeout
|
# tcp connection idle timeout
|
||||||
# tcp-idle-time [second]
|
# tcp-idle-time [second]
|
||||||
|
|||||||
@@ -109,6 +109,12 @@ msgstr "重定向53端口到SmartDNS"
|
|||||||
msgid "Cache Size"
|
msgid "Cache Size"
|
||||||
msgstr "缓存大小"
|
msgstr "缓存大小"
|
||||||
|
|
||||||
|
msgid "Resolve Local Hostnames"
|
||||||
|
msgstr "本地主机名解析"
|
||||||
|
|
||||||
|
msgid "Resolve local hostnames by reading Dnsmasq lease file"
|
||||||
|
msgstr "读取Dnsmasq的DHCP Lease文件解析本地主机名"
|
||||||
|
|
||||||
msgid "DNS domain result cache size"
|
msgid "DNS domain result cache size"
|
||||||
msgstr "缓存DNS的结果,缓存大小,配置零则不缓存(单位:条)"
|
msgstr "缓存DNS的结果,缓存大小,配置零则不缓存(单位:条)"
|
||||||
|
|
||||||
@@ -193,8 +199,8 @@ msgstr "跳过cache。"
|
|||||||
msgid "Force AAAA SOA"
|
msgid "Force AAAA SOA"
|
||||||
msgstr "停用IPV6地址解析"
|
msgstr "停用IPV6地址解析"
|
||||||
|
|
||||||
msgid "Force AAAA SOA."
|
msgid "Force HTTPS SOA."
|
||||||
msgstr "停用IPV6地址解析。"
|
msgstr "停用HTTPS解析。"
|
||||||
|
|
||||||
msgid "Upstream Servers"
|
msgid "Upstream Servers"
|
||||||
msgstr "上游服务器"
|
msgstr "上游服务器"
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ var callServiceList = rpc.declare({
|
|||||||
expect: { '': {} }
|
expect: { '': {} }
|
||||||
});
|
});
|
||||||
|
|
||||||
function getPidOfSmartdns() {
|
function getServiceStatus() {
|
||||||
return L.resolveDefault(callServiceList(conf), {})
|
return L.resolveDefault(callServiceList(conf), {})
|
||||||
.then(function (res) {
|
.then(function (res) {
|
||||||
var isrunning = false;
|
var isrunning = false;
|
||||||
@@ -49,6 +49,8 @@ function getIPTablesRedirect() {
|
|||||||
} else {
|
} else {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
}).catch(function (err) {
|
||||||
|
return "";
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -59,12 +61,14 @@ function getIP6TablesRedirect() {
|
|||||||
} else {
|
} else {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
});
|
}).catch(function (err) {
|
||||||
|
return "";
|
||||||
|
});;
|
||||||
}
|
}
|
||||||
|
|
||||||
function smartdnsServiceStatus() {
|
function smartdnsServiceStatus() {
|
||||||
return Promise.all([
|
return Promise.all([
|
||||||
getPidOfSmartdns(),
|
getServiceStatus(),
|
||||||
getIPTablesRedirect(),
|
getIPTablesRedirect(),
|
||||||
getIP6TablesRedirect()
|
getIP6TablesRedirect()
|
||||||
]);
|
]);
|
||||||
@@ -136,6 +140,10 @@ return L.view.extend({
|
|||||||
L.Poll.add(function () {
|
L.Poll.add(function () {
|
||||||
return L.resolveDefault(smartdnsServiceStatus()).then(function (res) {
|
return L.resolveDefault(smartdnsServiceStatus()).then(function (res) {
|
||||||
var view = document.getElementById("service_status");
|
var view = document.getElementById("service_status");
|
||||||
|
if (view == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
view.innerHTML = smartdnsRenderStatus(res);
|
view.innerHTML = smartdnsRenderStatus(res);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -215,6 +223,21 @@ return L.view.extend({
|
|||||||
o = s.taboption("settings", form.Value, "cache_size", _("Cache Size"), _("DNS domain result cache size"));
|
o = s.taboption("settings", form.Value, "cache_size", _("Cache Size"), _("DNS domain result cache size"));
|
||||||
o.rempty = true;
|
o.rempty = true;
|
||||||
|
|
||||||
|
// cache-size;
|
||||||
|
o = s.taboption("settings", form.Flag, "resolve_local_hostnames", _("Resolve Local Hostnames"), _("Resolve local hostnames by reading Dnsmasq lease file"));
|
||||||
|
o.rmempty = false;
|
||||||
|
o.default = o.enabled;
|
||||||
|
|
||||||
|
// Force AAAA SOA
|
||||||
|
o = s.taboption("settings", form.Flag, "force_aaaa_soa", _("Force AAAA SOA"), _("Force AAAA SOA."));
|
||||||
|
o.rmempty = false;
|
||||||
|
o.default = o.disabled;
|
||||||
|
|
||||||
|
// Force HTTPS SOA
|
||||||
|
o = s.taboption("settings", form.Flag, "force_https_soa", _("Force HTTPS SOA"), _("Force HTTPS SOA."));
|
||||||
|
o.rmempty = false;
|
||||||
|
o.default = o.disabled;
|
||||||
|
|
||||||
// rr-ttl;
|
// rr-ttl;
|
||||||
o = s.taboption("settings", form.Value, "rr_ttl", _("Domain TTL"), _("TTL for all domain result."));
|
o = s.taboption("settings", form.Value, "rr_ttl", _("Domain TTL"), _("TTL for all domain result."));
|
||||||
o.rempty = true;
|
o.rempty = true;
|
||||||
|
|||||||
@@ -260,6 +260,8 @@ load_service()
|
|||||||
{
|
{
|
||||||
local section="$1"
|
local section="$1"
|
||||||
args=""
|
args=""
|
||||||
|
dnsmase_lease_file="$(uci get dhcp.@dnsmasq[0].leasefile 2>/dev/null)"
|
||||||
|
qtype_soa_list=""
|
||||||
|
|
||||||
mkdir -p $SMARTDNS_VAR_CONF_DIR
|
mkdir -p $SMARTDNS_VAR_CONF_DIR
|
||||||
rm -f $SMARTDNS_CONF_TMP
|
rm -f $SMARTDNS_CONF_TMP
|
||||||
@@ -302,6 +304,15 @@ load_service()
|
|||||||
config_get cache_size "$section" "cache_size" ""
|
config_get cache_size "$section" "cache_size" ""
|
||||||
[ -z "$cache_size" ] || conf_append "cache-size" "$cache_size"
|
[ -z "$cache_size" ] || conf_append "cache-size" "$cache_size"
|
||||||
|
|
||||||
|
config_get resolve_local_hostnames "$section" "resolve_local_hostnames" "1"
|
||||||
|
[ -z "$resolve_local_hostnames" ] || conf_append "dnsmasq-lease-file" "$dnsmase_lease_file"
|
||||||
|
|
||||||
|
config_get force_aaaa_soa "$section" "force_aaaa_soa" "0"
|
||||||
|
[ "$force_aaaa_soa" = "1" ] && qtype_soa_list="$qtype_soa_list 28"
|
||||||
|
|
||||||
|
config_get force_https_soa "$section" "force_https_soa" "0"
|
||||||
|
[ "$force_https_soa" = "1" ] && qtype_soa_list="$qtype_soa_list 65"
|
||||||
|
|
||||||
config_get rr_ttl "$section" "rr_ttl" ""
|
config_get rr_ttl "$section" "rr_ttl" ""
|
||||||
[ -z "$rr_ttl" ] || conf_append "rr-ttl" "$rr_ttl"
|
[ -z "$rr_ttl" ] || conf_append "rr-ttl" "$rr_ttl"
|
||||||
|
|
||||||
@@ -331,6 +342,8 @@ load_service()
|
|||||||
config_get old_port "$section" "old_port" "0"
|
config_get old_port "$section" "old_port" "0"
|
||||||
config_get old_enabled "$section" "old_enabled" "0"
|
config_get old_enabled "$section" "old_enabled" "0"
|
||||||
|
|
||||||
|
[ -z "$qtype_soa_list" ] || conf_append "force-qtype-SOA" "$qtype_soa_list"
|
||||||
|
|
||||||
if [ "$old_redirect" != "$redirect" ] || [ "$old_port" != "$SMARTDNS_PORT" ] || [ "$old_enabled" = "1" -a "$enabled" = "0" ]; then
|
if [ "$old_redirect" != "$redirect" ] || [ "$old_port" != "$SMARTDNS_PORT" ] || [ "$old_enabled" = "1" -a "$enabled" = "0" ]; then
|
||||||
[ "$old_redirect" = "none" ] || {
|
[ "$old_redirect" = "none" ] || {
|
||||||
[ "$old_port" = "0" ] || clear_iptable "$old_port" "$ipv6_server"
|
[ "$old_port" = "0" ] || clear_iptable "$old_port" "$ipv6_server"
|
||||||
|
|||||||
Reference in New Issue
Block a user