From ca971b720d18926f813becb6f4940301d73b833b Mon Sep 17 00:00:00 2001 From: iliajie Date: Sat, 21 Jan 2023 17:06:31 +0200 Subject: [PATCH] Remove `size` option in Authentic as it's pointless, resize does it all --- xterm/index.cgi | 5 +++-- xterm/xterm-lib.pl | 25 +++++++++++++++++++++++++ 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/xterm/index.cgi b/xterm/index.cgi index 40914ae19..bf291d645 100755 --- a/xterm/index.cgi +++ b/xterm/index.cgi @@ -56,8 +56,9 @@ $conf_rows_n = int($conf_rows_n); my $env_cols = $conf_cols_n || $def_cols_n; my $env_rows = $conf_rows_n || $def_rows_n; -# Set columns and rows environment vars only in fixed mode -if ($conf_cols_n && $conf_rows_n) { +# Set columns and rows environment vars only +# in fixed mode, and only for old themes +if ($conf_cols_n && $conf_rows_n && !$xmlhr) { $ENV{'COLUMNS'} = $conf_cols_n; $ENV{'LINES'} = $conf_rows_n; } diff --git a/xterm/xterm-lib.pl b/xterm/xterm-lib.pl index 1b3847689..032108550 100644 --- a/xterm/xterm-lib.pl +++ b/xterm/xterm-lib.pl @@ -6,4 +6,29 @@ use WebminCore; our %access = &get_module_acl(); do "$module_root_directory/websockets-lib-funcs.pl"; +# config_pre_load(mod-info-ref, [mod-order-ref]) +# Check if some config options are conditional, +# and if not allowed, remove them from listing +sub config_pre_load +{ +my ($modconf_info, $modconf_order) = @_; + +if ($ENV{'HTTP_X_REQUESTED_WITH'} eq "XMLHttpRequest") { + + # Process forbidden keys + my @forbidden_keys; + + # Size is not supported in Authentic, because resize works flawlessly and + # making it work would just add addition complexity for no good reason + push(@forbidden_keys, 'size'); + + # Remove forbidden from display + foreach my $fkey (@forbidden_keys) { + delete($modconf_info->{$fkey}); + @{$modconf_order} = grep { $_ ne $fkey } @{$modconf_order} + if ($modconf_order); + } + } +} + 1; \ No newline at end of file