From 29fdc2b014b05a4d6ae2324b36ea9ce1c956360b Mon Sep 17 00:00:00 2001 From: Richard Yu Date: Mon, 18 Nov 2019 20:46:48 +0800 Subject: luci-app-nextdns: port to client side Signed-off-by: Richard Yu --- .../luci-static/resources/view/nextdns/logread.js | 43 +++++++++++++++++++++ .../luci-static/resources/view/nextdns/overview.js | 44 ++++++++++++++++++++++ 2 files changed, 87 insertions(+) create mode 100644 applications/luci-app-nextdns/htdocs/luci-static/resources/view/nextdns/logread.js create mode 100644 applications/luci-app-nextdns/htdocs/luci-static/resources/view/nextdns/overview.js (limited to 'applications/luci-app-nextdns/htdocs/luci-static/resources') diff --git a/applications/luci-app-nextdns/htdocs/luci-static/resources/view/nextdns/logread.js b/applications/luci-app-nextdns/htdocs/luci-static/resources/view/nextdns/logread.js new file mode 100644 index 0000000000..9b3c7bfc41 --- /dev/null +++ b/applications/luci-app-nextdns/htdocs/luci-static/resources/view/nextdns/logread.js @@ -0,0 +1,43 @@ +'use strict'; +'require fs'; + +return L.view.extend({ + render: function() { + L.Poll.add(function() { + return L.resolveDefault(fs.exec('/sbin/logread', ['-e', 'nextdns']), { code: 1 }) + .then(function(res) { + var content; + if (res.code === 0) + content = res.stdout.trim(); + if (!content) + content = _('No nextdns related logs yet!'); + var view = document.getElementById("view_id"); + view.value = content; + view.scrollTop = view.scrollHeight; + }); + }); + return E('div', { class: 'cbi-map' }, + E('div', { class: 'cbi-section' }, [ + E('div', { class: 'cbi-section-descr' }, + _('The syslog output, pre-filtered for nextdns related messages only.')), + E('textarea', { + id: 'view_id', + readonly: 'readonly', + wrap: 'off', + style: 'width: 100% !important;\ + height: 450px !important;\ + border: 1px solid #cccccc;\ + padding: 5px;\ + font-size: 12px;\ + font-family: monospace;\ + resize: none;\ + pointer-events: auto;\ + cursor: auto;' + }) + ]) + ); + }, + handleSaveApply: null, + handleSave: null, + handleReset: null +}); diff --git a/applications/luci-app-nextdns/htdocs/luci-static/resources/view/nextdns/overview.js b/applications/luci-app-nextdns/htdocs/luci-static/resources/view/nextdns/overview.js new file mode 100644 index 0000000000..2fd693f3e2 --- /dev/null +++ b/applications/luci-app-nextdns/htdocs/luci-static/resources/view/nextdns/overview.js @@ -0,0 +1,44 @@ +'use strict'; +'require form'; + +return L.view.extend({ + render: function() { + var m, s, o; + + m = new form.Map('nextdns', _('NextDNS'), + _('NextDNS Configuration.') + + '
' + + _('For further information, go to \ + nextdns.io.')); + + s = m.section(form.TypedSection, 'nextdns', _('General')); + s.anonymous = true; + + o = s.option(form.Flag, 'enabled', _('Enabled'), + _('Enable NextDNS.')); + o.default = '1'; + o.rmempty = false; + + s.option(form.Value, 'config', _('Configuration ID'), + _('The ID of your NextDNS configuration.') + + '
' + + _('Go to nextdns.io to create a configuration.')); + + o = s.option(form.Flag, 'report_client_info', _('Report Client Info'), + _('Expose LAN clients information in NextDNS analytics.')); + o.default = '1'; + o.rmempty = false; + + o = s.option(form.Flag, 'hardened_privacy', _('Hardened Privacy'), + _('When enabled, use DNS servers located in jurisdictions with strong privacy laws.') + + '
' + + _('Available locations are: Switzerland, Iceland, Finland, Panama and Hong Kong.')); + o.rmempty = false; + + o = s.option(form.Flag, 'log_queries', _('Log Queries'), + _('Log individual queries to system log.')); + o.rmempty = false; + + return m.render(); + }, +}); -- cgit v1.2.3