From 2185f2068d76f825dfb89e490c9b2c7af4e988ba Mon Sep 17 00:00:00 2001 From: Ilia Ross Date: Fri, 21 Mar 2025 12:53:05 +0200 Subject: [PATCH 1/6] Update pod [no-build] --- web-lib-funcs.pl | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/web-lib-funcs.pl b/web-lib-funcs.pl index 2ef672564..9fd2fdd9e 100755 --- a/web-lib-funcs.pl +++ b/web-lib-funcs.pl @@ -4058,7 +4058,7 @@ return " ". &group_chooser_button($_[0], 0, $_[2] || 0)."\n"; } -=head2 hlink(text, page, [module], [width], [height]) +=head2 hlink(text, page, [module], [width], [height], [tmpl]) Returns HTML for a link that when clicked on pops up a window for a Webmin help page. The parameters are : @@ -4073,6 +4073,8 @@ help page. The parameters are : =item height - Height of the help popup window. Defaults to 400 pixels. +=item tmpl - Hash ref of template variables to substitute in the help page. + The actual help pages are in each module's help sub-directory, in files with .html extensions. From 7b85a75a2b3c48a53002eea43f9878ee55b3ffd4 Mon Sep 17 00:00:00 2001 From: Ilia Ross Date: Fri, 21 Mar 2025 12:54:08 +0200 Subject: [PATCH 2/6] Fix not to add `?` unless there is a query [no-build] --- web-lib-funcs.pl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/web-lib-funcs.pl b/web-lib-funcs.pl index 9fd2fdd9e..cb49dd85f 100755 --- a/web-lib-funcs.pl +++ b/web-lib-funcs.pl @@ -4088,8 +4088,8 @@ if (defined(&theme_hlink)) { } $width ||= $tconfig{'help_width'} || $gconfig{'help_width'} || 600; $height ||= $tconfig{'help_height'} || $gconfig{'help_height'} || 400; -my $params = $tmpl ? join("&", map { "tmpl_".&urlize($_)."=".&urlize($tmpl->{$_}) } keys %$tmpl) : ""; -return "$txt"; +my $params = $tmpl ? "?".join("&", map { "tmpl_".&urlize($_)."=".&urlize($tmpl->{$_}) } keys %$tmpl) : ""; +return "$txt"; } =head2 user_chooser_button(field, multiple, [form]) From 1f07fdb2747db3e757248865e8c320982a59ddef Mon Sep 17 00:00:00 2001 From: Ilia Ross Date: Fri, 21 Mar 2025 16:55:32 +0200 Subject: [PATCH 3/6] Fix to prefer JSON::XS over JSON::PP if available for better performance --- web-lib-funcs.pl | 45 +++++++++++++++++++++++++++++---------------- 1 file changed, 29 insertions(+), 16 deletions(-) diff --git a/web-lib-funcs.pl b/web-lib-funcs.pl index cb49dd85f..29dad3119 100755 --- a/web-lib-funcs.pl +++ b/web-lib-funcs.pl @@ -12970,47 +12970,60 @@ for(my $i=0; $i<@sp1 || $i<@sp2; $i++) { return 0; } -=head2 convert_to_json(data, [pretty]) +=head2 convert_to_json(data, [pretty], [raw-utf8]) Converts the given Perl data structure to encoded binary string =item data parameter is a hash/array reference =item if the output should be prettified +=item raw-utf8 parameter, if set to 1, encodes data using UTF-8 =cut sub convert_to_json { -eval "use JSON::PP"; -if (!$@) { - my ($data, $pretty) = @_; - my $json = JSON::PP->new; - $pretty = 0 if (!$pretty); - $json = $json->pretty($pretty); - $data ||= {}; - return $json->latin1->encode($data); +my ($data, $pretty, $raw_utf8) = @_; +my $json; + +if (eval { require JSON::XS }) { + $json = JSON::XS->new; + } +elsif (eval { require JSON::PP }) { + $json = JSON::PP->new; } else { - error("The JSON::PP Perl module is not available on your system : $@"); + error("Neither JSON::XS nor JSON::PP Perl module is available on your system"); } +$json->pretty(!!$pretty); +$data ||= {}; +return $raw_utf8 ? $json->utf8->encode($data) : $json->latin1->encode($data); } -=head2 convert_from_json(data) +=head2 convert_from_json(data, [raw-utf8]) Parses given JSON string =item data parameter is encoded JSON string +=item raw-utf8 parameter, if set, treats the input as raw UTF-8 + =cut sub convert_from_json { -eval "use JSON::PP"; -if (!$@) { - my ($json_text) = @_; - return JSON::PP->new->utf8->decode($json_text); +my ($json_text, $raw_utf8) = @_; + +my $json; +if (eval { require JSON::XS }) { + $json = JSON::XS->new; + } +elsif (eval { require JSON::PP }) { + $json = JSON::PP->new; } else { - error("The JSON::PP Perl module is not available on your system : $@"); + error("Neither JSON::XS nor JSON::PP Perl module is available on your system"); } + +$json = $json->utf8 if (!$raw_utf8); +return $json->decode($json_text); } =head2 print_json(data) From e8b2b21bce78f6b53267e889a2bb9c3911744d9f Mon Sep 17 00:00:00 2001 From: Ilia Ross Date: Sat, 22 Mar 2025 18:56:44 +0200 Subject: [PATCH 4/6] Fix to stop rebuilding on release edit [no-build] --- .github/workflows/webmin.dev+webmin.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/webmin.dev+webmin.yml b/.github/workflows/webmin.dev+webmin.yml index fcada5702..2b26d71c0 100644 --- a/.github/workflows/webmin.dev+webmin.yml +++ b/.github/workflows/webmin.dev+webmin.yml @@ -7,7 +7,6 @@ on: release: types: - published - - edited jobs: build: From fdbf960a2c6fb85eeab2ccbb78e6ee35097ac699 Mon Sep 17 00:00:00 2001 From: Ilia Ross Date: Sun, 23 Mar 2025 03:07:50 +0200 Subject: [PATCH 5/6] Fix to use `dmesg -T` for Linux systems #2442 --- proc/syslog_logs.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/proc/syslog_logs.pl b/proc/syslog_logs.pl index a90b78abc..92010894d 100755 --- a/proc/syslog_logs.pl +++ b/proc/syslog_logs.pl @@ -7,7 +7,7 @@ require 'proc-lib.pl'; sub syslog_getlogs { if ($gconfig{'os_type'} =~ /-linux$/) { - return ( { 'cmd' => "dmesg", + return ( { 'cmd' => "dmesg -T", 'desc' => $text{'syslog_dmesg'}, 'active' => 1, } ); } From 16fec003dc47dbac81b0a02efd470cae4929844d Mon Sep 17 00:00:00 2001 From: Ilia Ross Date: Sun, 23 Mar 2025 15:44:36 +0200 Subject: [PATCH 6/6] Fix to use shell command with direct file writing for EOL data file --- webmin/os-eol-lib.pl | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/webmin/os-eol-lib.pl b/webmin/os-eol-lib.pl index c75b74142..972afa9a0 100755 --- a/webmin/os-eol-lib.pl +++ b/webmin/os-eol-lib.pl @@ -64,10 +64,9 @@ foreach my $os (@eol_oses) { push(@eol_oses_data, @$fdata_json); } my $eol_oses_data = &convert_to_json(\@eol_oses_data); -&backquote_command("echo -n '$eol_oses_data' > $eol_cache_file 2>&1 ', $eol_cache_file) or die("Could not open OS EOL data file for writing: $!"); +print $fh $eol_oses_data; +close($fh) or die("Could not close OS EOL data file: $!"); } # eol_get_os_data()