Compare commits

...

21 Commits

Author SHA1 Message Date
Ilia Ross
d04dfdf157 Fix to simplify the test 2024-06-12 01:20:29 +03:00
Ilia Ross
41f1adf0df Fix to start with a sudo-capable user if possible 2024-06-11 15:31:00 +03:00
Ilia Ross
1ae01bed8d Fix to support theme styling for embedded calendar 2024-06-10 16:34:29 +03:00
Ilia Ross
4a6f5d9a6a Fix not to load images by default and ask 2024-06-10 14:23:18 +03:00
Ilia Ross
bb3a4bc1e8 Fix font size consistency 2024-06-10 13:48:14 +03:00
Jamie Cameron
084c117547 Merge pull request #2193 from webmin/dev/embed-calendar
Add support for embedding calendar events inline in email messages
2024-06-09 18:48:18 -07:00
Ilia Ross
20d481e96b Add further margin fixes 2024-06-09 19:13:52 +03:00
Ilia Ross
6af5ed6e2f Fix margin for inner content 2024-06-09 16:09:44 +03:00
Ilia Ross
3fa687e716 Fix bugs 2024-06-09 03:49:43 +03:00
Ilia Ross
d21188c2ad Add improvements to mail frame interactions 2024-06-09 03:06:53 +03:00
Ilia Ross
ba3be31335 Fix to resize iframe if called by some elements from inside 2024-06-09 01:53:36 +03:00
Ilia Ross
adb3d0bb67 Revert "Fix to expose mail iframe resize function"
This reverts commit cd9bc8b7c4.
2024-06-09 01:42:12 +03:00
Ilia Ross
cd9bc8b7c4 Fix to expose mail iframe resize function 2024-06-09 01:16:21 +03:00
Ilia Ross
cce8911f0f Add additional details to the object 2024-06-08 16:53:25 +03:00
Jamie Cameron
cde548ada3 Merge pull request #2192 from webmin/dev/websocket-url-proxy-rely
Set websocket URL depending on the proxy unless defined in config
2024-06-06 20:39:03 -07:00
Ilia Ross
00d0a89630 Set socket URL depending on the proxy unless defined in config 2024-06-07 01:15:27 +03:00
Ilia Ross
9c971202b3 Remove debug 2024-06-07 00:47:47 +03:00
Ilia Ross
2aa3bce4da Fix explicitly set module name from the caller 2024-06-07 00:35:41 +03:00
Ilia Ross
4103177d1e Fix dependencies [build] 2024-06-06 22:55:39 +03:00
Jamie Cameron
31b6cdc82b Merge branch 'master' of github.com:webmin/webmin 2024-06-06 08:34:03 -07:00
Jamie Cameron
fd8c634277 Zone key record might not exist https://forum.virtualmin.com/t/security-updates/127159 2024-06-06 08:33:34 -07:00
10 changed files with 81 additions and 28 deletions

View File

@@ -30,7 +30,7 @@ push(@EXPORT, qw(&unique));
push(@EXPORT, qw($config_directory $var_directory $remote_error_handler %month_to_number_map %number_to_month_map $webmin_feedback_address $default_lang $default_charset $module_index_name $module_index_link %in $in @in $progress_callback_prefix $progress_callback_url $wait_for_debug $wait_for_input @matches $theme_no_table $webmin_logfile $pragma_no_cache));
# Functions defined in themes
push(@EXPORT, qw(&theme_post_save_domain &theme_post_save_domains &theme_post_save_server &theme_select_server &theme_select_domain &theme_post_save_folder &theme_post_change_modules &theme_address_button &theme_virtualmin_ui_rating_selector &theme_virtualmin_ui_show_cron_time &theme_virtualmin_ui_parse_cron_time &theme_virtualmin_ui_html_editor_bodytags &theme_virtualmin_ui_show_html_editor &theme_post_change_theme &theme_pre_change_theme));
push(@EXPORT, qw(&theme_post_save_domain &theme_post_save_domains &theme_post_save_server &theme_select_server &theme_select_domain &theme_post_save_folder &theme_post_change_modules &theme_address_button &theme_virtualmin_ui_rating_selector &theme_virtualmin_ui_show_cron_time &theme_virtualmin_ui_parse_cron_time &theme_virtualmin_ui_html_editor_bodytags &theme_virtualmin_ui_show_html_editor &theme_post_change_theme &theme_pre_change_theme &theme_fonts &theme_css_inline));
$called_from_webmin_core = 1;
do "web-lib.pl";

View File

@@ -40,6 +40,7 @@ if (@keyrecs) {
my $kt = $key->{'ksk'} ? 'ksk' : 'zone';
my ($keyrec) = grep { $_->{'values'}->[0] ==
($key->{'ksk'} ? 257 : 256) } @keyrecs;
next if (!$keyrec);
my $keyline = format_dnssec_public_key(
join(" ", $keyrec->{'name'}, $keyrec->{'class'},
$keyrec->{'type'}, @{$keyrec->{'values'}}));

View File

@@ -29,9 +29,6 @@ table.ui_table thead td {
table.sortable tbody td {
padding: 2px;
}
table.ui_table td * {
line-height:1.5em;
}
table.ui_table td textarea {line-height:normal; font-family:monospace;}
table.ui_table td div.barchart * {
margin: 0;
@@ -55,9 +52,16 @@ div.ui_form_end_buttons {
padding: 6px 3px;
}
.ui_form_end_buttons input {
padding: 2px;
padding: 1px;
}
table.ui_grid_table td { padding: 2px 4px; }
.ui_form_value td > b > input+label+tt,
.ui_form_value td > b > input+label {
font-weight: normal !important;
}
table.ui_grid_table td {
padding: 2px 4px;
}
select,
input {
padding: 1px;
}

View File

@@ -16,7 +16,7 @@ fwd_mode=0
delete_warn=y
top_buttons=2
view_html=2
view_images=3
view_images=1
mail_usermin=mail
sync_create=0
sync_modify=1

View File

@@ -2947,7 +2947,8 @@ my $iframe_body = <<EOF;
theme_mail_iframe_onload(iframe);
return;
}
const iframe_spinner = document.querySelector('#mail-iframe-spinner'),
const iframeDoc = iframe.contentDocument || iframe.contentWindow.document,
iframe_spinner = document.querySelector('#mail-iframe-spinner'),
iframe_resize = function() {
const iframeobj = document.querySelector('#mail-iframe'),
iframe_height_bound = iframeobj.contentWindow.document.body.getBoundingClientRect().bottom,
@@ -2955,8 +2956,11 @@ my $iframe_body = <<EOF;
iframe_height =
iframe_height_bound > iframe_scroll_height ?
iframe_height_bound : iframe_scroll_height;
iframeobj.style.height = Math.ceil(iframe_height) + "px";
iframeobj.style.height = Math.ceil(iframe_height - 1) + "px";
};
iframeDoc.body.style.removeProperty('width');
iframeDoc.body.style.margin = '4px';
iframeDoc.body.style.padding = '0';
iframe_spinner && iframe_spinner.remove();
iframe.classList.add("loaded");
setTimeout(iframe_resize);
@@ -2980,6 +2984,15 @@ my $iframe_body = <<EOF;
})();
});
}, 99);
iframeDoc.addEventListener('click', function(event) {
if (event.target.tagName.toLowerCase() === 'summary' &&
event.target.dataset.resize === 'iframe') {
setTimeout(iframe_resize);
}
});
iframe.contentWindow.addEventListener('resize', function() {
setTimeout(iframe_resize);
});
}
</script>
<iframe
@@ -4579,6 +4592,12 @@ my ($calendars) = @_;
my @calendars = @{$calendars};
$calendars = { };
if (@calendars) {
# Fonts for our HTML
$calendars->{'html'} .= &theme_fonts()
if (defined(&theme_fonts));
my $theme_css_inline;
$theme_css_inline = &theme_css_inline('calendar')
if (defined(&theme_css_inline));
# CSS for HTML version
$calendars->{'html'} .= <<STYLE;
<style>
@@ -4588,6 +4607,7 @@ if (@calendars) {
border-collapse: collapse;
border: 1px solid #99999933;
margin-bottom: 4px;
font-family: 'RobotoLocal',arial,helvetica,clean,sans-serif !important;
}
.calendar-table-inner {
table-layout: fixed;
@@ -4610,44 +4630,50 @@ if (@calendars) {
font-weight: bold;
}
.calendar-month {
font-size: 21px;
font-size: 19px;
color: #1d72ff;
text-align: center;
padding: 2px 8px;
}
.calendar-day {
font-size: 24px;
font-size: 19px;
text-align: center;
padding: 4px 8px;
}
.calendar-week {
font-size: 16px;
font-size: 13px;
border-top: 1px dotted #999999aa;
padding: 6px;
display: inline-block;
}
.calendar-details h2 {
margin: 0;
font-size: 18px;
font-size: 15px;
}
.calendar-details p {
margin: 4px 0;
}
.calendar-details .title {
font-size: 20px;
font-size: 16px;
}
.calendar-details .detail strong {
opacity: 0.66;
opacity: 0.83;
white-space: nowrap;
}
.calendar-details .detail + .desc p:first-child {
margin-top: 0;
}
details.calendar-details {
font-size: 90%;
font-size: 87%;
display: inline-block;
margin-left: 9px;
}
.calendar-details > .calendar-table-inner .detail:has(strong),
.calendar-details > .calendar-table-inner .detail strong,
.calendar-details > .calendar-table-inner .detail + td {
font-size: 13px;
line-height: 1.2;
}
details.calendar-details summary {
cursor: help;
}
@@ -4655,6 +4681,7 @@ if (@calendars) {
.calendar-details tr:has(>.detail+td:empty) {
display: none;
}
$theme_css_inline
</style>
STYLE
foreach my $calendar (@calendars) {

View File

@@ -107,7 +107,7 @@ if ($product eq "webmin") {
$size = int(`du -sk $tmp_dir`);
@deps = ( "perl", "libnet-ssleay-perl", "openssl", "libauthen-pam-perl", "libpam-runtime", "libio-pty-perl", "unzip", "shared-mime-info", "tar", "libdigest-sha-perl", "libdigest-md5-perl", "gzip" );
$deps = join(", ", @deps);
@recommends = ( "libdatetime-perl", "libdatetime-timezone-perl", "libdatetime-locale-perl", "libtime-piece-perl", "libencode-detect-perl", "libtime-hires-perl", "libsocket6-perl", "lynx", "qrencode" );
@recommends = ( "libdatetime-perl", "libdatetime-timezone-perl", "libdatetime-locale-perl", "libtime-piece-perl", "libencode-detect-perl", "libtime-hires-perl", "libsocket6-perl", "libthreads-perl", "libthreads-shared-perl", "lynx", "qrencode" );
$recommends = join(", ", @recommends);
open(CONTROL, ">$control_file");
print CONTROL <<EOF;

View File

@@ -87,7 +87,7 @@ Release: $rel
Provides: %{name}-%{version} perl(WebminCore)
Requires(pre): /usr/bin/perl
Requires: /bin/sh /usr/bin/perl perl(lib) perl(open) perl(Net::SSLeay) perl(Time::Local) perl(Data::Dumper) perl(File::Path) perl(File::Basename) perl(Digest::SHA) perl(Digest::MD5) openssl unzip tar gzip
Recommends: perl(DateTime) perl(DateTime::TimeZone) perl(DateTime::Locale) perl(Time::Piece) perl(Encode::Detect) perl(Time::HiRes) perl(Socket6) lynx shared-mime-info perl-File-Basename perl-File-Path qrencode
Recommends: perl(DateTime) perl(DateTime::TimeZone) perl(DateTime::Locale) perl(Time::Piece) perl(Encode::Detect) perl(Time::HiRes) perl(Socket6) perl(threads) perl(threads::shared) lynx shared-mime-info perl-File-Basename perl-File-Path qrencode
AutoReq: 0
License: BSD-3-clause
Group: System/Tools

View File

@@ -2228,6 +2228,10 @@ if (!$@ && $] > 5.011) {
}
};
$data->{'year'} = DateTime->from_epoch(locale => $locale_name_loaded, epoch => $secs, time_zone => $tz)->strftime("%Y");
$data->{'day'} = DateTime->from_epoch(locale => $locale_name_loaded, epoch => $secs, time_zone => $tz)->strftime("%d");
$data->{'week'} = DateTime->from_epoch(locale => $locale_name_loaded, epoch => $secs, time_zone => $tz)->strftime("%a");
$data->{'weekfull'} = DateTime->from_epoch(locale => $locale_name_loaded, epoch => $secs, time_zone => $tz)->strftime("%A");
$data->{'month'} = DateTime->from_epoch(locale => $locale_name_loaded, epoch => $secs, time_zone => $tz)->strftime("%b");
$data->{'complete'} =~ s/(\d+):(\d+):(\d+)(.*?)/$1:$2$4/;
($data->{'complete_short'} = $data->{'complete'}) =~ s/(.*?)([\s\,]*\Q$data->{'year'}\E.*)/$1/;
@@ -13569,12 +13573,22 @@ my $ws_proto = lc($ENV{'HTTPS'}) eq 'on' ? 'wss' : 'ws';
my %miniserv;
&get_miniserv_config(\%miniserv);
my $http_host_conf = &trim($miniserv{'websocket_host'} || $host);
# Pass as defined
if ($http_host_conf) {
if ($http_host_conf !~ /^wss?:\/\//) {
$http_host_conf = "$ws_proto://$http_host_conf";
}
$http_host_conf =~ s/[\/]+$//g;
}
# Try to rely on the proxy
if (!defined($http_host_conf)) {
my $forwarded_host = $ENV{'HTTP_X_FORWARDED_HOST'};
if ($forwarded_host) {
$http_host_conf = "$ws_proto://$forwarded_host".
&get_webprefix();
$http_host_conf =~ s/\/$//;
}
}
my $http_host = $http_host_conf || "$ws_proto://$ENV{'HTTP_HOST'}";
return "$http_host/$module/ws-$port";
}

View File

@@ -168,13 +168,20 @@ EOF
print "<div data-label=\"$text{'index_connecting'}\" id=\"terminal\"></div>\n";
# Get a free port that can be used for the socket
my $port = &allocate_miniserv_websocket();
my $port = &allocate_miniserv_websocket($module_name);
# Check permissions for user to run as
my $user = $access{'user'};
if ($user eq "*") {
$user = $remote_user;
}
elsif ($user eq "root" && $remote_user ne $user && !$in{'user'}) {
# If possible, start with a sudo-capable user
my @uinfo = getpwnam($remote_user);
if (@uinfo && $uinfo[7]) {
$user = $remote_user;
}
}
$user = $config{'user'} if ($user eq 'root' && $config{'user'});
# Switch to given user
@@ -200,7 +207,7 @@ $ENV{'SESSION_ID'} = $main::session_id;
" >$module_var_directory/websocket-connection-$port.out 2>&1 </dev/null");
# Open the terminal
my $url = &get_miniserv_websocket_url($port, $config{'host'});
my $url = &get_miniserv_websocket_url($port, $config{'host'}, $module_name);
my $canvasAddon = $termlinks->{'js'}[3];
my $webGLAddon = $termlinks->{'js'}[4];
my $term_script = <<EOF;

View File

@@ -14,7 +14,7 @@ my @uinfo = getpwnam($user);
my ($uid, $gid);
if ($user ne "root" && !$<) {
if (!@uinfo) {
&remove_miniserv_websocket($port);
&remove_miniserv_websocket($port, $module_name);
die "User $user does not exist!";
}
$uid = $uinfo[2];
@@ -83,7 +83,7 @@ my ($shellfh, $pid) = &proc::pty_process_exec($shellexec, $uid, $gid, $shelllogi
&reset_environment();
my $shcmd = "'$shellexec".($shelllogin ? " $shelllogin" : "")."'";
if (!$pid) {
&remove_miniserv_websocket($port);
&remove_miniserv_websocket($port, $module_name);
die "Failed to run shell with $shcmd\n";
}
else {
@@ -99,7 +99,7 @@ close(STDIN);
# Clean up when socket is terminated
$SIG{'ALRM'} = sub {
&remove_miniserv_websocket($port);
&remove_miniserv_websocket($port, $module_name);
die "timeout waiting for connection";
};
alarm(60);
@@ -154,13 +154,13 @@ Net::WebSocket::Server->new(
}
if (!syswrite($shellfh, $msg, length($msg))) {
&error_stderr("Write to shell failed : $!");
&remove_miniserv_websocket($port);
&remove_miniserv_websocket($port, $module_name);
exit(1);
}
},
disconnect => sub {
&error_stderr("WebSocket connection closed");
&remove_miniserv_websocket($port);
&remove_miniserv_websocket($port, $module_name);
kill('KILL', $pid) if ($pid);
exit(0);
}
@@ -173,7 +173,7 @@ Net::WebSocket::Server->new(
my $ok = sysread($shellfh, $buf, 1024);
if ($ok <= 0) {
&error_stderr("End of output from shell");
&remove_miniserv_websocket($port);
&remove_miniserv_websocket($port, $module_name);
exit(0);
}
if ($wsconn) {
@@ -186,5 +186,5 @@ Net::WebSocket::Server->new(
],
)->start;
&error_stderr("Exited WebSocket server");
&remove_miniserv_websocket($port);
&cleanup_miniserv_websockets([$port]);
&remove_miniserv_websocket($port, $module_name);
&cleanup_miniserv_websockets([$port], $module_name);