Merge branch 'master' of github.com:webmin/webmin

This commit is contained in:
Jamie Cameron
2022-11-02 23:22:50 -07:00
6 changed files with 63 additions and 7 deletions

View File

@@ -42,6 +42,12 @@ print &ui_table_row($text{'limits_input'},
&find_value("max_input_time", $conf),
8, $text{'default'})." ".$text{'db_s'});
# Max parsing time
print &ui_table_row($text{'limits_vars'},
&ui_opt_textbox("max_input_vars",
&find_value("max_input_vars", $conf),
8, $text{'default'}));
print &ui_table_end();
print &ui_form_end([ [ "save", $text{'save'} ] ]);

View File

@@ -90,12 +90,14 @@ limits_post=Maximum HTTP POST size
limits_upload=Maximum file upload size
limits_exec=Maximum execution time
limits_input=Maximum input parsing time
limits_vars=Maximum input variables limit
limits_err=Failed to save resource limits
limits_emem=Missing or invalid maximum memory allocation
limits_epost=Missing or invalid maximum HTTP POST size
limits_eupload=Missing or invalid maximum file upload size
limits_eexec=Missing or invalid maximum execution time
limits_einput=Missing or invalid maximum input parsing time
limits_evars=Missing or invalid maximum input variables limit
errors_title=Error Logging
errors_header=Error message display and logging options

View File

@@ -41,6 +41,12 @@ $in{"max_input_time_def"} || $in{"max_input_time"} =~ /^\-?\d+$/ ||
&save_directive($conf, "max_input_time",
$in{"max_input_time_def"} ? undef : $in{"max_input_time"});
# Save max input vars limit
$in{"max_input_vars_def"} || $in{"max_input_vars"} =~ /^\d+$/ ||
&error($text{'limits_evars'});
&save_directive($conf, "max_input_vars",
$in{"max_input_vars_def"} ? undef : $in{"max_input_vars"});
&flush_file_lines_as_user($in{'file'}, undef, 1);
&unlock_file($in{'file'});
&graceful_apache_restart($in{'file'});

View File

@@ -1 +1,2 @@
base_port=555
flavors=0

View File

@@ -1,2 +1,3 @@
base_port=Base port number for WebSockets connections,0,5
size=Terminal width and height in characters,3,Automatic,5,,,Static (80x24)
flavors=Enable inbuilt command prompt color customization,1,1-Yes,0-No

View File

@@ -113,6 +113,19 @@ body[style='height:100%'] {
#terminal + script ~ * {
display: none
}
#terminal > .terminal {
visibility: hidden;
animation: .15s fadeIn;
animation-fill-mode: forwards;
}
\@keyframes fadeIn {
99% {
visibility: hidden;
}
100% {
visibility: visible;
}
}
EOF
@@ -186,6 +199,29 @@ if ($user eq "root" && $in{'user'}) {
$user = $in{'user'};
}
# Terminal flavors
my (@cmds, $term_flavors);
if ($config{'flavors'}) {
my ($cmd_lsalias, $cmd_ps1) = ("alias ls='ls --color=auto'");
# Optionally add colors to the prompt depending on the user type
if ($user eq "root") {
# magenta@blue ~# (for root)
$cmd_ps1 = "PS1='\\\\[\\\\033[1;35m\\\\]\\\\u\\\\[\\\\033[1;37m\\\\]".
"@\\\\[\\\\033[1;34m\\\\]\\\\h:\\\\[\\\\033[1;37m\\\\]".
"\\\\w\\\\[\\\\033[1;37m\\\\]\\\\\$\\\\[\\\\033[0m\\\\] '";
}
else {
# green@blue ~$ (for regular users)
$cmd_ps1 = "PS1='\\\\[\\\\033[1;32m\\\\]\\\\u\\\\[\\\\033[1;37m\\\\]".
"@\\\\[\\\\033[1;34m\\\\]\\\\h:\\\\[\\\\033[1;37m\\\\]".
"\\\\w\\\\[\\\\033[1;37m\\\\]\\\\\$\\\\[\\\\033[0m\\\\] '";
}
$term_flavors = "socket.send(\" $cmd_lsalias\\r\"); ".
"socket.send(\" $cmd_ps1\\r\");";
push(@cmds, $cmd_ps1, $cmd_lsalias);
}
# Check for directory to start the shell in
my $dir = $in{'dir'};
@@ -197,6 +233,7 @@ if (!-r $shellserver_cmd) {
}
defined(getpwnam($user)) || &error(&text('index_euser', &html_escape($user)));
my $tmpdir = &tempname_dir();
$ENV{'HISTCONTROL'} = 'ignoredups:ignorespace';
$ENV{'SESSION_ID'} = $main::session_id;
&system_logged($shellserver_cmd." ".quotemeta($port)." ".quotemeta($user).
($dir ? " ".quotemeta($dir) : "").
@@ -217,7 +254,8 @@ my $term_script = <<EOF;
term.loadAddon(attachAddon);
term.open(termcont);
term.focus();
socket.send('clear\\r');
$term_flavors
socket.send(' clear\\r');
};
socket.onerror = function() {
termcont.innerHTML = '<tt style="color: \#ff0000">Error: ' +
@@ -235,12 +273,14 @@ EOF
print "<script>\n";
if ($xmlhr) {
print "var xterm_argv = ".
&convert_to_json(
{ 'files' => $termlinks,
'cols' => $env_cols,
'rows' => $env_rows,
'port' => $port,
'socket_url' => $url });
&convert_to_json(
{ 'conf' => \%config,
'files' => $termlinks,
'socket_url' => $url,
'port' => $port,
'cols' => $env_cols,
'rows' => $env_rows,
'cmds' => \@cmds });
}
else {
print $term_script;