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

This commit is contained in:
Jamie Cameron
2020-01-18 16:41:56 -08:00
8 changed files with 47 additions and 23 deletions

File diff suppressed because one or more lines are too long

View File

@@ -34,12 +34,12 @@ sub list_system_info
my $free_percent_html;
if ($free_percent > 49) {
$free_percent_html = ui_text_type("$free_percent%", 'success');
$free_percent_html = ui_text_color("$free_percent%", 'success');
} elsif ($free_percent > 9) {
$free_percent_html = ui_text_type("$free_percent%", 'warn');
$free_percent_html = ui_text_color("$free_percent%", 'warn');
} else {
$open = 1;
$free_percent_html = ui_text_type("$free_percent%", 'danger');
$free_percent_html = ui_text_color("$free_percent%", 'danger');
}
$html .= ui_columns_row([$dir, $type, $free_percent_html . " ($free_nice)", $total_nice, $dev_id,]);
}

View File

@@ -64,12 +64,18 @@ foreach $p (sort { $a->{'name'} cmp $b->{'name'} } (@current, @avail)) {
# Work out the status
$c = $current{$p->{'name'}."/".$p->{'system'}};
$a = $avail{$p->{'name'}."/".$p->{'system'}};
$bp = $a->{'disallowed'} =~ /\/Backports/;
if ($a && $c && &compare_versions($a, $c) > 0) {
# An update is available
$msg = "<b><font color=#00aa00>".
&text('index_new', $a->{'version'})."</font></b>";
$need = 1;
if ($bp) {
$msg = '<b>'.&ui_text_color(&text('index_new_backports', $a->{'version'}), 'success').'</b>';
}
else {
$msg = "<b><font color=#00aa00>".
&text('index_new', $a->{'version'})."</font></b>";
$need = 1;
}
next if ($in{'mode'} eq 'security' && !$a->{'security'});
next if ($in{'mode'} ne 'updates' &&
$in{'mode'} ne 'current' &&
@@ -78,7 +84,12 @@ foreach $p (sort { $a->{'name'} cmp $b->{'name'} } (@current, @avail)) {
elsif ($a && !$c) {
# Could be installed, but isn't currently
next if (!&installation_candiate($a));
$msg = "<font color=#00aa00>$text{'index_caninstall'}</font>";
if ($bp) {
$msg = &ui_text_color($text{'index_caninstall_backports'}, 'success');
}
else {
$msg = "<font color=#00aa00>$text{'index_caninstall'}</font>";
}
$need = 0;
next if ($in{'mode'} ne 'new');
}
@@ -100,7 +111,10 @@ foreach $p (sort { $a->{'name'} cmp $b->{'name'} } (@current, @avail)) {
next if ($in{'mode'} ne 'current');
}
$source = ucfirst($a->{'source'});
if ($a->{'security'}) {
if ($bp) {
$source = &ui_text_color("<span title=\"$text{'index_install_disallowed_backports'}\">$source$a->{'disallowed'} <sup><b>&quest;</b></sup></span>", 'info');
}
elsif ($a->{'security'}) {
$source = "<font color=#ff0000>$source</font>";
}
@@ -117,11 +131,13 @@ foreach $p (sort { $a->{'name'} cmp $b->{'name'} } (@current, @avail)) {
push(@rows, [
{ 'type' => 'checkbox', 'name' => 'u',
'value' => $p->{'update'}."/".$p->{'system'},
'checked' => $need },
&ui_link("view.cgi?mode=$in{'mode'}&name=".
&urlize($p->{'name'})."&system=".
&urlize($p->{'system'})."&search=".
&urlize($in{'search'}), $p->{'name'}),
'checked' => $need,
'disabled' => $bp ? 1 : 0 },
($bp ? $p->{'name'} :
&ui_link("view.cgi?mode=$in{'mode'}&name=".
&urlize($p->{'name'})."&system=".
&urlize($p->{'system'})."&search=".
&urlize($in{'search'}), $p->{'name'})),
$p->{'desc'},
$msg,
$source ? ( $source ) : ( ),

View File

@@ -148,5 +148,8 @@ repos_enone=None selected
repos_title=Delete Repositories
repos_rusure=Are you sure you want to delete the $1 selected package repositories? Packages installed from them will still be available, but may not be updatable.
repos_ok=Delete Now
index_install_disallowed_backports=By default backports repositories have a lower priority than stable (100), thus they won't be installed or upgraded unless explicitly configured to (or the package only exists in backports) - packages from backports must be installed using command line, with special flags
index_new_backports=Backports new version $1
index_caninstall_backports=Available for manual installation
__norefs=1

View File

@@ -22,11 +22,11 @@ if ($gconfig{'loginbanner'} && $ENV{'HTTP_COOKIE'} !~ /banner=1/ &&
close(BANNER);
return;
}
&get_miniserv_config(\%miniserv);
$sec = uc($ENV{'HTTPS'}) eq 'ON' ? "; secure" : "";
if (!$config{'no_httponly'}) {
if (!$miniserv{'no_httponly'}) {
$sec .= "; httpOnly";
}
&get_miniserv_config(\%miniserv);
$sidname = $miniserv{'sidname'} || "sid";
print "Set-Cookie: banner=0; path=/$sec\r\n" if ($gconfig{'loginbanner'});
print "Set-Cookie: $sidname=x; path=/$sec\r\n" if ($in{'logout'});

View File

@@ -23,11 +23,11 @@ if ($gconfig{'loginbanner'} && $ENV{'HTTP_COOKIE'} !~ /banner=1/ &&
close(BANNER);
return;
}
&get_miniserv_config(\%miniserv);
$sec = uc($ENV{'HTTPS'}) eq 'ON' ? "; secure" : "";
if (!$config{'no_httponly'}) {
if (!$miniserv{'no_httponly'}) {
$sec .= "; httpOnly";
}
&get_miniserv_config(\%miniserv);
$sidname = $miniserv{'sidname'} || "sid";
print "Set-Cookie: banner=0; path=/$sec\r\n" if ($gconfig{'loginbanner'});
print "Set-Cookie: $sidname=x; path=/$sec\r\n" if ($in{'logout'});

View File

@@ -185,6 +185,11 @@ while(<DUMP>) {
elsif (/^\s*File:\s*(\S+)/ && $pkg) {
$pkg->{'file'} ||= $1;
}
# By default Debian backports repositories have a lower priority than stable (100) thus they won't
# be installed or upgraded unless explicitly configured to (or the package only exists in backports).
if ($pkg->{'file'} =~ /dists_.*-backports/) {
$pkg->{'disallowed'} = "/Backports";
}
}
close(DUMP);
&reset_environment();

View File

@@ -2448,7 +2448,7 @@ $rv .= "</center>\n";
return $rv;
}
=head2 ui_text_type(text, type)
=head2 ui_text_color(text, type)
Returns HTML for a text string, with its color determined by $type.
@@ -2458,13 +2458,13 @@ Returns HTML for a text string, with its color determined by $type.
=cut
sub ui_text_type
sub ui_text_color
{
my ($text, $type) = @_;
my ($rv, $color);
if (defined (&theme_ui_text_type)) {
return &theme_ui_text_type(@_);
if (defined (&theme_ui_text_color)) {
return &theme_ui_text_color(@_);
}
if ($type eq "success") { $color = "3c763d"; }
@@ -2472,7 +2472,7 @@ elsif ($type eq "info") { $color = "31708f"; }
elsif ($type eq "warn") { $color = "8a6d3b"; }
elsif ($type eq "danger") { $color = "a94442"; }
$rv .= "<span class='ui_text_type text_type_$type' style='color: #$color'>$text</span>\n";
$rv .= "<span class='ui_text_color text_type_$type' style='color: #$color'>$text</span>\n";
return $rv;
}