diff --git a/luci-app-mosdns/luasrc/model/cbi/mosdns/basic.lua b/luci-app-mosdns/luasrc/model/cbi/mosdns/basic.lua index cccafb0..1b51488 100644 --- a/luci-app-mosdns/luasrc/model/cbi/mosdns/basic.lua +++ b/luci-app-mosdns/luasrc/model/cbi/mosdns/basic.lua @@ -189,11 +189,7 @@ function o.write(self, section, value) fs.writefile("/etc/mosdns/config_custom.yaml", value) end -s:tab("api", translate("API Setting")) - -o = s:taboption("api", Flag, "enabled_api", translate("Enabled API")) -o:depends("configfile", "/etc/mosdns/config.yaml") -o.default = false +s:tab("api", translate("API Options")) o = s:taboption("api", Value, "listen_port_api", translate("API Listen port")) o.datatype = "and(port,min(1))" @@ -203,7 +199,7 @@ o:depends("configfile", "/etc/mosdns/config.yaml") o = s:taboption("api", Button, "flush_cache", translate("Flush Cache"), translate("Flushing Cache will clear any IP addresses or DNS records from MosDNS cache")) o.rawhtml = true o.template = "mosdns/mosdns_flush_cache" -o:depends("enabled_api", "1") +o:depends("configfile", "/etc/mosdns/config.yaml") s:tab("geodata", translate("GeoData Export")) diff --git a/luci-app-mosdns/luasrc/view/mosdns/mosdns_flush_cache.htm b/luci-app-mosdns/luasrc/view/mosdns/mosdns_flush_cache.htm index f462ce3..7126754 100644 --- a/luci-app-mosdns/luasrc/view/mosdns/mosdns_flush_cache.htm +++ b/luci-app-mosdns/luasrc/view/mosdns/mosdns_flush_cache.htm @@ -18,7 +18,7 @@ tb.innerHTML = "" + "<%:Flushing Success%>" + ""; break; case false: - tb.innerHTML = "" + "<%:Flushing Failed, Please check if the API is enabled%>" + ""; + tb.innerHTML = "" + "<%:Flushing Failed, Please check if MosDNS is enabled%>" + ""; break; } } diff --git a/luci-app-mosdns/po/zh-cn/mosdns.po b/luci-app-mosdns/po/zh-cn/mosdns.po index c756ca3..c0e92cc 100644 --- a/luci-app-mosdns/po/zh-cn/mosdns.po +++ b/luci-app-mosdns/po/zh-cn/mosdns.po @@ -7,6 +7,9 @@ msgstr "基本选项" msgid "Advanced Options" msgstr "高级选项" +msgid "API Options" +msgstr "API 选项" + msgid "MosDNS is a 'programmable' DNS forwarder." msgstr "MosDNS 是一个插件化的 DNS 转发/分流器。" @@ -25,12 +28,6 @@ msgstr "启用" msgid "Listen port" msgstr "监听端口" -msgid "API Setting" -msgstr "API 设置" - -msgid "Enabled API" -msgstr "启用 API" - msgid "API Listen port" msgstr "API 监听端口" @@ -46,8 +43,8 @@ msgstr "正在刷新..." msgid "Flushing Success" msgstr "刷新成功" -msgid "Flushing Failed, Please check if the API is enabled" -msgstr "刷新失败,请检查 API 是否已启用" +msgid "Flushing Failed, Please check if MosDNS is enabled" +msgstr "刷新失败,请检查 MosDNS 是否已启用" msgid "Log Level" msgstr "日志等级" diff --git a/luci-app-mosdns/root/etc/config/mosdns b/luci-app-mosdns/root/etc/config/mosdns index 86ae30f..a7e31a7 100644 --- a/luci-app-mosdns/root/etc/config/mosdns +++ b/luci-app-mosdns/root/etc/config/mosdns @@ -22,7 +22,6 @@ config mosdns 'config' option enable_pipeline '0' option insecure_skip_verify '0' option enable_http3 '0' - option enabled_api '0' option listen_port_api '9091' option bootstrap_dns '119.29.29.29' list remote_dns 'tls://8.8.8.8' diff --git a/luci-app-mosdns/root/etc/init.d/mosdns b/luci-app-mosdns/root/etc/init.d/mosdns index 2c778ae..5025aa9 100755 --- a/luci-app-mosdns/root/etc/init.d/mosdns +++ b/luci-app-mosdns/root/etc/init.d/mosdns @@ -52,7 +52,6 @@ get_config() { config_get remote_dns $1 remote_dns "tls://8.8.8.8 tls://1.1.1.1" config_get custom_local_dns $1 custom_local_dns 0 config_get bootstrap_dns $1 bootstrap_dns "119.29.29.29" - config_get enabled_api $1 enabled_api 0 config_get listen_port_api $1 listen_port_api 9091 config_get concurrent $1 concurrent 1 config_get max_conns $1 max_conns 2 @@ -77,13 +76,11 @@ init_yaml() { s,cache_survival_time,$cache_survival_time,g; \ s,minimal_ttl_custom,$minimal_ttl_custom,g; \ s,maximum_ttl_custom,$maximum_ttl_custom,g; \ - s,concurrent_num,$concurrent,g; \ + s,concurrent_num,$concurrent,g;s,api_port,$listen_port_api,g; \ s,adblock,$adlist,g;s,remote_dns_pipeline,$enable_pipeline,g" $DEFAULT_CONF > $CONF echo "${local_dns}" > $TMPDIR/local_dns.txt echo "${remote_dns}" > $TMPDIR/remote_dns.txt sed -i -e '/- addr: local_dns/{r '$TMPDIR/local_dns.txt -e';d};/- addr: remote_dns/{r '$TMPDIR/remote_dns.txt -e';d}' $CONF - [ "$enabled_api" -eq 1 ] && sed -i "s/api_port/$listen_port_api/g" $CONF - [ "$enabled_api" -eq 0 ] && sed -i "/api:/d;/http:/d;" $CONF [ "$dump_file" -eq 1 ] && sed -i "/lazy_cache_ttl/a\ dump_file: $DUMP_FILE\n dump_interval: $dump_interval" $CONF [ "$dump_file" -eq 1 ] && [ ! -f $DUMP_FILE ] && cp -a $DUMP_FILE_DEFAULT $DUMP_FILE [ "$dump_file" -eq 0 ] && \cp -a $DUMP_FILE_DEFAULT $DUMP_FILE