From 47ac81c3189a2244530f824724b640422133d118 Mon Sep 17 00:00:00 2001 From: Vadim Vetrov Date: Mon, 23 Dec 2024 01:09:53 +0300 Subject: [PATCH] Update UI for luci-app status --- .../resources/view/youtubeUnblock/status.js | 20 +++++++++++++++++-- .../rpcd/acl.d/luci-app-youtubeUnblock.json | 3 ++- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/luci-app-youtubeUnblock/htdocs/luci-static/resources/view/youtubeUnblock/status.js b/luci-app-youtubeUnblock/htdocs/luci-static/resources/view/youtubeUnblock/status.js index 01de834..2267a2c 100644 --- a/luci-app-youtubeUnblock/htdocs/luci-static/resources/view/youtubeUnblock/status.js +++ b/luci-app-youtubeUnblock/htdocs/luci-static/resources/view/youtubeUnblock/status.js @@ -52,6 +52,12 @@ function handleAction(act, event) { } else { fs.exec_direct('/etc/init.d/youtubeUnblock', [ 'disable' ]).then(thn_inc); } + } else if (act == "reset_configs") { + fs.exec_direct('/usr/share/youtubeUnblock/youtubeUnblock_defaults.sh', [ '--force' ]) + .then(function() { + fs.exec_direct('/etc/init.d/youtubeUnblock', [ 'restart' ]) + .then(thn_disp); + }); } else { unroll_inact(event.target); } @@ -210,15 +216,25 @@ return view.extend({ return handleAction('fw_reload', event); }) }, [ _('Firewall reload') ]), + '\xa0\xa0\xa0', + E('button', { + 'class': 'btn cbi-button cbi-button-negative', + 'id': 'btn_reset_configs', + 'click': ui.createHandlerFn(this, function(event) { + return handleAction('reset_configs', event); + }) + }, [ _('Reset configuration') ]), + ]) ]); }, o, this); - const logs_s = m.section(form.NamedSection, 'ytb_logs'); + const logs_s = m.section(form.NamedSection, 'ytb_logs', _("Logs"), _("If you want to scroll logs, disable refreshing by clicking the button in the upper right corner of the screen")); logs_s.render = L.bind(function(view, section_id) { return E('div', { class: 'cbi-map' }, E('div', { class: 'cbi-section' }, [ - E('div', { class: 'cbi-section-descr' }, _('The syslog output, pre-filtered for messages related to: youtubeUnblock')), + E('h3', _('Logs')), + E('div', { class: 'cbi-section-descr' }, _('If you want to scroll logs, disable refreshing by clicking the button in the upper right corner of the screen')), E('textarea', { 'id': 'ytb_logger', 'style': 'width: 100% !important; padding: 5px; font-family: monospace', diff --git a/luci-app-youtubeUnblock/root/usr/share/rpcd/acl.d/luci-app-youtubeUnblock.json b/luci-app-youtubeUnblock/root/usr/share/rpcd/acl.d/luci-app-youtubeUnblock.json index dd52c9c..82d9bb3 100644 --- a/luci-app-youtubeUnblock/root/usr/share/rpcd/acl.d/luci-app-youtubeUnblock.json +++ b/luci-app-youtubeUnblock/root/usr/share/rpcd/acl.d/luci-app-youtubeUnblock.json @@ -14,7 +14,8 @@ "/etc/init.d/firewall reload" : [ "exec" ], "/usr/bin/youtubeUnblock --version" : [ "exec" ], "/sbin/logread -e youtubeUnblock -l [0-9]*": [ "exec" ], - "/usr/sbin/logread -e youtubeUnblock -l [0-9]*": [ "exec" ] + "/usr/sbin/logread -e youtubeUnblock -l [0-9]*": [ "exec" ], + "/usr/share/youtubeUnblock/youtubeUnblock_defaults.sh --force": [ "exec" ] }, "uci": [ "youtubeUnblock" ] },