From f79ceeac436162d62a7231679f4f8c61ee79958e Mon Sep 17 00:00:00 2001 From: Nick Peng Date: Thu, 30 Apr 2020 23:11:58 +0800 Subject: [PATCH] luci: update luci --- .../luci/files/luci/controller/smartdns.lua | 27 ------------------- .../share/luci/menu.d/luci-app-smartdns.json | 12 +++++++++ .../share/rpcd/acl.d/luci-app-smartdns.json | 12 +++++---- .../resources/view/smartdns/smartdns.js | 8 +++--- package/luci/make.sh | 6 ++--- 5 files changed, 24 insertions(+), 41 deletions(-) delete mode 100644 package/luci/files/luci/controller/smartdns.lua create mode 100644 package/luci/files/root/usr/share/luci/menu.d/luci-app-smartdns.json rename package/luci/files/{ => root}/usr/share/rpcd/acl.d/luci-app-smartdns.json (61%) rename package/luci/files/{luci/htdocs => root/www}/luci-static/resources/view/smartdns/smartdns.js (99%) diff --git a/package/luci/files/luci/controller/smartdns.lua b/package/luci/files/luci/controller/smartdns.lua deleted file mode 100644 index 667f8bc..0000000 --- a/package/luci/files/luci/controller/smartdns.lua +++ /dev/null @@ -1,27 +0,0 @@ --- --- Copyright (C) 2018-2020 Ruilin Peng (Nick) . --- --- smartdns is free software: you can redistribute it and/or modify --- it under the terms of the GNU General Public License as published by --- the Free Software Foundation, either version 3 of the License, or --- (at your option) any later version. --- --- smartdns is distributed in the hope that it will be useful, --- but WITHOUT ANY WARRANTY; without even the implied warranty of --- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the --- GNU General Public License for more details. --- --- You should have received a copy of the GNU General Public License --- along with this program. If not, see . - -module("luci.controller.smartdns", package.seeall) - -function index() - if not nixio.fs.access("/etc/config/smartdns") then - return - end - - local page - page = entry({"admin", "services", "smartdns"}, view("smartdns/smartdns"), _("SmartDNS"), 60) - page.dependent = true -end diff --git a/package/luci/files/root/usr/share/luci/menu.d/luci-app-smartdns.json b/package/luci/files/root/usr/share/luci/menu.d/luci-app-smartdns.json new file mode 100644 index 0000000..91b4402 --- /dev/null +++ b/package/luci/files/root/usr/share/luci/menu.d/luci-app-smartdns.json @@ -0,0 +1,12 @@ +{ + "admin/services/smartdns": { + "title": "SmartDNS", + "action": { + "type": "view", + "path": "smartdns/smartdns" + }, + "depends": { + "uci": { "smartdns": true } + } + } +} diff --git a/package/luci/files/usr/share/rpcd/acl.d/luci-app-smartdns.json b/package/luci/files/root/usr/share/rpcd/acl.d/luci-app-smartdns.json similarity index 61% rename from package/luci/files/usr/share/rpcd/acl.d/luci-app-smartdns.json rename to package/luci/files/root/usr/share/rpcd/acl.d/luci-app-smartdns.json index 2765ed4..78fbb1c 100644 --- a/package/luci/files/usr/share/rpcd/acl.d/luci-app-smartdns.json +++ b/package/luci/files/root/usr/share/rpcd/acl.d/luci-app-smartdns.json @@ -4,18 +4,20 @@ "read": { "file": { "/etc/smartdns/*": [ "read" ], - "/usr/sbin/iptables": [ "exec" ], - "/usr/sbin/ip6tables": [ "exec" ], + "/usr/sbin/iptables -t nat -nL PREROUTING": [ "exec" ], + "/usr/sbin/ip6tables -t nat -nL PREROUTING": [ "exec" ], "/usr/sbin/smartdns": [ "exec" ] }, "ubus": { "service": [ "list" ] - } + }, + "uci": [ "smartdns" ] }, "write": { "file": { "/etc/smartdns/*": [ "write" ] - } + }, + "uci": [ "smartdns" ] } } -} \ No newline at end of file +} diff --git a/package/luci/files/luci/htdocs/luci-static/resources/view/smartdns/smartdns.js b/package/luci/files/root/www/luci-static/resources/view/smartdns/smartdns.js similarity index 99% rename from package/luci/files/luci/htdocs/luci-static/resources/view/smartdns/smartdns.js rename to package/luci/files/root/www/luci-static/resources/view/smartdns/smartdns.js index 59af2d6..4d13775 100644 --- a/package/luci/files/luci/htdocs/luci-static/resources/view/smartdns/smartdns.js +++ b/package/luci/files/root/www/luci-static/resources/view/smartdns/smartdns.js @@ -201,7 +201,7 @@ return L.view.extend({ _("Attempts to serve old responses from cache with a TTL of 0 in the response without waiting for the actual resolution to finish.")); o.rmempty = false; o.default = o.disabled; - + // Redirect; o = s.taboption("settings", form.ListValue, "redirect", _("Redirect"), _("SmartDNS redirect mode")); o.placeholder = "none"; @@ -253,7 +253,7 @@ return L.view.extend({ // dns server group; o = s.taboption("seconddns", form.Value, "seconddns_server_group", _("Server Group"), - _("Query DNS through specific dns server group, such as office, home.")); + _("Query DNS through specific dns server group, such as office, home.")); o.rmempty = true; o.placeholder = "default"; o.datatype = "hostname"; @@ -305,8 +305,7 @@ return L.view.extend({ // custom settings; o = s.taboption("custom", form.TextValue, "custom_conf", - _(""), - _("smartdns custom settings")); + "", _("smartdns custom settings")); o.rows = 20; o.cfgvalue = function (section_id) { @@ -491,4 +490,3 @@ return L.view.extend({ return m.render(); } }); - diff --git a/package/luci/make.sh b/package/luci/make.sh index f9ef629..ed3ff20 100644 --- a/package/luci/make.sh +++ b/package/luci/make.sh @@ -53,17 +53,15 @@ build() cd $ROOT/ build_tool - mkdir $ROOT/root/usr/lib/lua/ -p - mkdir $ROOT/root/usr/lib/lua/luci/controller/ -p + mkdir $ROOT/root/usr/lib/lua/luci -p mkdir $ROOT/root/usr/share/rpcd/acl.d/ -p - cp $ROOT/files/luci/controller/* $ROOT/root/usr/lib/lua/luci/controller/ -avf cp $ROOT/files/luci/i18n $ROOT/root/usr/lib/lua/luci/ -avf #Generate Language $PO2LMO $ROOT/files/luci/i18n/smartdns.zh-cn.po $ROOT/root/usr/lib/lua/luci/i18n/smartdns.zh-cn.lmo rm $ROOT/root/usr/lib/lua/luci/i18n/smartdns.zh-cn.po - cp $ROOT/files/usr $ROOT/root/ -avf + cp $ROOT/files/root/* $ROOT/root/ -avf INST_SIZE="`du -sb $ROOT/root/ | awk '{print $1}'`" sed -i "s/^Architecture.*/Architecture: all/g" $ROOT/control/control