mirror of
https://github.com/webmin/webmin.git
synced 2026-03-20 08:40:24 +00:00
Add param to force a hostname
This commit is contained in:
@@ -45,10 +45,7 @@ foreach $t (@todo) {
|
||||
|
||||
if ($tellcount) {
|
||||
# Add link to Webmin
|
||||
&get_miniserv_config(\%miniserv);
|
||||
$proto = $miniserv{'ssl'} ? 'https' : 'http';
|
||||
$port = $miniserv{'port'};
|
||||
$url = $proto."://".&get_system_hostname().":".$port."/$module_name/";
|
||||
$url = &get_webmin_email_url($module_name);
|
||||
$body .= "Updates can be installed at $url\n\n";
|
||||
}
|
||||
|
||||
|
||||
@@ -11207,14 +11207,14 @@ $referer =~ s/\/\//\//g;
|
||||
return $referer;
|
||||
}
|
||||
|
||||
=head2 get_webmin_email_url([module], [cgi], [force-default])
|
||||
=head2 get_webmin_email_url([module], [cgi], [force-default], [force-host])
|
||||
|
||||
Returns the base URL for accessing this Webmin system, for use in URLs.
|
||||
|
||||
=cut
|
||||
sub get_webmin_email_url
|
||||
{
|
||||
my ($mod, $cgi, $def) = @_;
|
||||
my ($mod, $cgi, $def, $forcehost) = @_;
|
||||
|
||||
# Work out the base URL
|
||||
my $url;
|
||||
@@ -11226,7 +11226,7 @@ else {
|
||||
&get_miniserv_config(\%miniserv);
|
||||
my $proto = $miniserv{'ssl'} ? 'https' : 'http';
|
||||
my $port = $miniserv{'port'};
|
||||
my $host = &get_system_hostname();
|
||||
my $host = $forcehost || &get_system_hostname();
|
||||
my $defport = $proto eq 'https' ? 443 : 80;
|
||||
$url = $proto."://".$host.($port == $defport ? "" : ":".$port);
|
||||
$url .= $gconfig{'webprefix'} if ($gconfig{'webprefix'});
|
||||
@@ -11234,8 +11234,15 @@ else {
|
||||
|
||||
# Append module if needed
|
||||
$url =~ s/\/$//;
|
||||
$url .= "/".$mod if ($mod);
|
||||
$url .= "/".$cgi if ($cgi);
|
||||
if ($mod && $cgi) {
|
||||
$url .= "/".$mod."/".$cgi;
|
||||
}
|
||||
elsif ($mod) {
|
||||
$url .= "/".$mod."/";
|
||||
}
|
||||
elsif ($cgi) {
|
||||
$url .= "/".$cgi;
|
||||
}
|
||||
return $url;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user