luci-mod-network: Add filter-rr to filter responses by record type name
authorPaul Donald <newtwen+github@gmail.com>
Tue, 22 Oct 2024 23:33:21 +0000 (01:33 +0200)
committerPaul Donald <newtwen+github@gmail.com>
Tue, 22 Oct 2024 23:33:21 +0000 (01:33 +0200)
This follows https://github.com/openwrt/openwrt/pull/14975

Signed-off-by: Paul Donald <newtwen+github@gmail.com>
modules/luci-mod-network/htdocs/luci-static/resources/view/network/dhcp.js

index 6a94952eabe1e6f9b9eff47e3ae1c652102479da..e6333b89d33f837b8b1ec1f9742908a6db8d66e0 100644 (file)
@@ -307,6 +307,36 @@ return view.extend({
 
                };
 
+               const recordtypes = [
+                       'ANY',
+                       'A',
+                       'AAAA',
+                       'ALIAS',
+                       'CAA',
+                       'CERT',
+                       'CNAME',
+                       'DS',
+                       'HINFO',
+                       'HIP',
+                       'HTTPS',
+                       'KEY',
+                       'LOC',
+                       'MX',
+                       'NAPTR',
+                       'NS',
+                       'OPENPGPKEY',
+                       'PTR',
+                       'RP',
+                       'SIG',
+                       'SOA',
+                       'SRV',
+                       'SSHFP',
+                       'SVCB',
+                       'TLSA',
+                       'TXT',
+                       'URI',
+               ]
+
                function customi18n(template, values) {
                        if (!values)
                                values = noi18nstrings;
@@ -648,6 +678,16 @@ return view.extend({
                        _('Remove IPv4 addresses from the results and only return IPv6 addresses.'));
                o.optional = true;
 
+               o = s.taboption('filteropts', form.MultiValue, 'filter_rr',
+                       _('Filter arbitrary RR'), _('Removes records of the specified type(s) from answers.'));
+               o.optional = true;
+               o.create = true;
+               o.multiple = true;
+               o.display_size = 5;
+               recordtypes.forEach(r => {
+                       o.value(r);
+               });
+
                s.taboption('filteropts', form.Flag, 'localise_queries',
                        _('Localise queries'),
                        customi18n(_('Limit response records (from {etc_hosts}) to those that fall within the subnet of the querying interface.') ) + '<br />' +