mirror of
https://github.com/webmin/webmin.git
synced 2026-06-05 04:40:24 +01:00
* Note: Add lightweight quick controls for allowed ports, services, and port forwards, with service autocomplete, ACLs, and structured NAT redirect/DNAT editing.
23 lines
487 B
Perl
Executable File
23 lines
487 B
Perl
Executable File
#!/usr/bin/perl
|
|
# search_services.cgi
|
|
# Return matching quick service definitions for the autocomplete widget
|
|
|
|
require './nftables-lib.pl'; ## no critic
|
|
use strict;
|
|
use warnings;
|
|
our (%in);
|
|
ReadParse();
|
|
assert_quick_acl('service');
|
|
|
|
my $limit = $in{'limit'} || 20;
|
|
$limit = 20 if ($limit !~ /^\d+$/);
|
|
my @services = search_quick_services($in{'q'}, $limit);
|
|
my @results = map {
|
|
{
|
|
'id' => $_->{'id'},
|
|
'label' => $_->{'label'} || $_->{'id'},
|
|
}
|
|
} @services;
|
|
|
|
print_json(\@results);
|