From 1f92711cd4fe055ca7456251403aaacf39196a57 Mon Sep 17 00:00:00 2001 From: Steve Kostecke Date: Sun, 27 Oct 2019 15:55:52 -0500 Subject: [PATCH] Remove ".local.mesh" from link text --- files/www/cgi-bin/mesh | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) mode change 100755 => 100644 files/www/cgi-bin/mesh diff --git a/files/www/cgi-bin/mesh b/files/www/cgi-bin/mesh old mode 100755 new mode 100644 index 15656c96..6dafae7d --- a/files/www/cgi-bin/mesh +++ b/files/www/cgi-bin/mesh @@ -376,8 +376,9 @@ if(keys %localhosts) foreach $ip (keys %localhosts) { $host = $localhosts{$ip}{name}; + $localpart = $host =~ s/.local.mesh//r; $tactical = $localhosts{$ip}{tactical} ? " / " . $localhosts{$ip}{tactical} : ""; - $rows{$host} = sprintf "%s", $host . $tactical; + $rows{$host} = sprintf "%s", $localpart . $tactical; if ( $wangateway{$ip} ) { $nodeiface = "wan" ; } if ( $nodeiface ) { $rows{$host} .= "   ($nodeiface)"; } @@ -393,7 +394,8 @@ if(keys %localhosts) # add locally advertised dmz hosts foreach $dmzhost (@{$localhosts{$ip}{hosts}}) { - $rows{$host} .= " $dmzhost"; + $localpart = $dmzhost =~ s/.local.mesh//r; + $rows{$host} .= " $localpart"; $rows{$host} .= "\n"; foreach(sort keys %{$services{$dmzhost}}) { @@ -432,12 +434,13 @@ foreach $ip (keys %hosts) next if $isNeig; $host = $hosts{$ip}{name}; + $localpart = $host =~ s/.local.mesh//r; $tactical = $hosts{$ip}{tactical} ? " / " . $hosts{$ip}{tactical} : ""; $etx = sprintf "%.2f", $hosts{$ip}{etx}; next if ($etx > 50 ); next if ($etx == 0 ); - $rows{$host} = sprintf "%s", $host, $host . $tactical; + $rows{$host} = sprintf "%s", $host, $localpart . $tactical; undef $nodeiface; if ( $dtd{$ip} ) @@ -460,7 +463,8 @@ foreach $ip (keys %hosts) # add advertised dmz hosts foreach $dmzhost (@{$hosts{$ip}{hosts}}) { - $rows{$host} .= " $dmzhost"; + $localpart = $dmzhost =~ s/.local.mesh//r; + $rows{$host} .= " $localpart"; $rows{$host} .= "\n"; foreach(sort keys %{$services{$dmzhost}}) { @@ -496,12 +500,13 @@ if(keys %links) { $ipmain = exists $ipalias{$ip} ? $ipalias{$ip} : $ip ; $host = $hosts{$ipmain}{name} ? $hosts{$ipmain}{name} : $ipmain; + $localpart = $host =~ s/.local.mesh//r; $tactical = $hosts{$ipmain}{tactical} ? " / " . $hosts{$ipmain}{tactical} : ""; if ( $rows{$host} ) { $host .= " " ; } # avoid collision 2 links to same host {rf, dtd} $no_space_host=$host; $no_space_host =~ s/\s+$//; - $rows{$host} = sprintf "%s", $no_space_host, $no_space_host . $tactical; + $rows{$host} = sprintf "%s", $no_space_host, $localpart . $tactical; undef $nodeiface; if ( $ipmain ne $ip ) # indicate if dtd or tunnel interface to neighbor @@ -525,7 +530,8 @@ if(keys %links) # add advertised dmz hosts foreach $dmzhost (@{$hosts{$ipmain}{hosts}}) { - $rows{$host} .= " $dmzhost\n"; + $localpart = $dmzhost =~ s/.local.mesh//r; + $rows{$host} .= " $localpart\n"; foreach(sort keys %{$services{$dmzhost}}) { $rows{$host} .= $services{$dmzhost}{$_} . "
\n" } $rows{$host} .= "\n"; }