Skip to content

Commit

Permalink
fix: Updated httpd root template
Browse files Browse the repository at this point in the history
  • Loading branch information
g-bougard committed Dec 12, 2023
1 parent 97ce49d commit 56e2020
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
2 changes: 2 additions & 0 deletions Changes
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ core:
* Make alt2canonical() always return a mac address in lower case if found one
* Fix HTTP::Client API to support timeout update
* Move runPowerShell() API remote case support in RemoteInventory API
* Update httpd default page to show targets id and server url or local path only
for trusted clients

inventory:
* PR #531: Add SentinelOne Antivirus support on Linux, thanks to @MarcSamD
Expand Down
6 changes: 3 additions & 3 deletions lib/GLPI/Agent/HTTP/Server.pm
Original file line number Diff line number Diff line change
Expand Up @@ -324,17 +324,17 @@ sub _handle_root {
return 500;
}

my $trust = $self->_isTrusted($clientIp);
my @server_targets =
map { { name => $_->getUrl(), date => $_->getFormatedNextRunDate() } }
map { { id => $_->id(), target => $trust ? $_->getUrl() : '', date => $_->getFormatedNextRunDate() } }
grep { $_->isType('server') }
$self->{agent}->getTargets();

my @local_targets =
map { { name => $_->getPath(), date => $_->getFormatedNextRunDate() } }
map { { id => $_->id(), target => $trust ? $_->getPath() : '', date => $_->getFormatedNextRunDate() } }
grep { $_->isType('local') }
$self->{agent}->getTargets();

my $trust = $self->_isTrusted($clientIp);
my @listening_plugins = ();
my %plugins_url = ();
if ($trust) {
Expand Down
4 changes: 2 additions & 2 deletions share/html/index.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<ul>";
foreach my $target (@server_targets) {
$OUT .= "
<li>$target->{name}: $target->{date}</li>";
<li>".($target->{target} ? "<a href='$target->{target}' target='_blank'>$target->{id}</a>" : $target->{id}).": $target->{date}</li>";
}
$OUT .= "
</ul>
Expand All @@ -41,7 +41,7 @@
<ul>";
foreach my $target (@local_targets) {
$OUT .= "
<li>$target->{name}: $target->{date}</li>";
<li>$target->{id}: $target->{date}".($target->{target} ? "<br/>folder: <tt>$target->{target}</tt>" : "")."</li>";
}
$OUT .= "
</ul>
Expand Down

0 comments on commit 56e2020

Please sign in to comment.