From 1ef89f4c42059d7b00f77f65e0abe585ff8c71ff Mon Sep 17 00:00:00 2001 From: Anya Lin Date: Thu, 1 Aug 2024 20:53:29 +0800 Subject: [PATCH] feat(server/client): service quick reload --- htdocs/luci-static/resources/view/homeproxy/client.js | 8 ++++++++ htdocs/luci-static/resources/view/homeproxy/server.js | 8 ++++++++ root/usr/share/rpcd/acl.d/luci-app-homeproxy.json | 1 + 3 files changed, 17 insertions(+) diff --git a/htdocs/luci-static/resources/view/homeproxy/client.js b/htdocs/luci-static/resources/view/homeproxy/client.js index ab9cdd24..7490b004 100644 --- a/htdocs/luci-static/resources/view/homeproxy/client.js +++ b/htdocs/luci-static/resources/view/homeproxy/client.js @@ -6,6 +6,7 @@ 'use strict'; 'require form'; +'require fs'; 'require network'; 'require poll'; 'require rpc'; @@ -340,6 +341,13 @@ return view.extend({ } so.default = 'nil'; so.rmempty = false; + + so = ss.option(form.Button, '_reload_client', _('Quick Reload')); + so.inputtitle = _('Reload'); + so.inputstyle = 'apply'; + so.onclick = function() { + return fs.exec('/etc/init.d/homeproxy', ['reload']); + }; /* Routing settings end */ /* Routing nodes start */ diff --git a/htdocs/luci-static/resources/view/homeproxy/server.js b/htdocs/luci-static/resources/view/homeproxy/server.js index b3d5f64b..a64e838c 100644 --- a/htdocs/luci-static/resources/view/homeproxy/server.js +++ b/htdocs/luci-static/resources/view/homeproxy/server.js @@ -6,6 +6,7 @@ 'use strict'; 'require form'; +'require fs'; 'require poll'; 'require rpc'; 'require uci'; @@ -72,6 +73,13 @@ return view.extend({ s = m.section(form.NamedSection, 'server', 'homeproxy', _('Global settings')); + o = s.option(form.Button, '_reload_server', _('Quick Reload')); + o.inputtitle = _('Reload'); + o.inputstyle = 'apply'; + o.onclick = function() { + return fs.exec('/etc/init.d/homeproxy', ['reload']); + }; + o = s.option(form.Flag, 'enabled', _('Enable')); o.default = o.disabled; o.rmempty = false; diff --git a/root/usr/share/rpcd/acl.d/luci-app-homeproxy.json b/root/usr/share/rpcd/acl.d/luci-app-homeproxy.json index b4b97ea8..e5caa016 100644 --- a/root/usr/share/rpcd/acl.d/luci-app-homeproxy.json +++ b/root/usr/share/rpcd/acl.d/luci-app-homeproxy.json @@ -4,6 +4,7 @@ "read": { "file": { "/etc/homeproxy/scripts/update_subscriptions.uc": [ "exec" ], + "/etc/init.d/homeproxy reload": [ "exec" ], "/var/run/homeproxy/homeproxy.log": [ "read" ], "/var/run/homeproxy/sing-box-c.log": [ "read" ], "/var/run/homeproxy/sing-box-s.log": [ "read" ]