diff --git a/cgi-bin/home b/cgi-bin/home index eb057b25..a91456e5 100755 --- a/cgi-bin/home +++ b/cgi-bin/home @@ -297,6 +297,7 @@ sub process_sync_page my $peer_table = ""; foreach my $uuid (keys %{$anvil->data->{database}}) { + next if not $anvil->Validate->is_uuid({uuid => $uuid}); next if $uuid eq $host_uuid; $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { uuid => $uuid }}); @@ -304,14 +305,52 @@ sub process_sync_page my $port = $anvil->data->{database}{$uuid}{port} ? $anvil->data->{database}{$uuid}{port} : 5432; my $name = $anvil->data->{database}{$uuid}{name} ? $anvil->data->{database}{$uuid}{name} : $anvil->data->{sys}{database}{name}; my $user = $anvil->data->{database}{$uuid}{user} ? $anvil->data->{database}{$uuid}{user} : $anvil->data->{sys}{database}{user}; + my $ping = $anvil->data->{database}{$uuid}{ping} ? $anvil->data->{database}{$uuid}{ping} : 1; my $password = $anvil->data->{database}{$uuid}{password} ? $anvil->data->{database}{$uuid}{password} : ""; $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { host => $host, port => $port, name => $name, user => $user, + ping => $ping, password => $anvil->Log->secure ? $password : $anvil->Words->string({key => "log_0186"}), }}); + + # Store it by name. + $anvil->data->{peers}{$host}{port} = $port; + $anvil->data->{peers}{$host}{name} = $name; + $anvil->data->{peers}{$host}{user} = $user; + $anvil->data->{peers}{$host}{ping} = $ping; + $anvil->data->{peers}{$host}{password} = $password; + $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { + "peers::${host}::port" => $anvil->data->{peers}{$host}{port}, + "peers::${host}::name" => $anvil->data->{peers}{$host}{name}, + "peers::${host}::ping" => $anvil->data->{peers}{$host}{ping}, + "peers::${host}::password" => $anvil->Log->secure ? $anvil->data->{peers}{$host}{password} : $anvil->Words->string({key => "log_0186"}), + }}); + } + + # Now peers are sortable by host name. + foreach my $host (sort {$a cmp $b} keys %{$anvil->data->{peers}}) + { + my $port = $anvil->data->{peers}{$host}{port}; + my $name = $anvil->data->{peers}{$host}{name}; + my $user = $anvil->data->{peers}{$host}{user}; + my $ping = $anvil->data->{peers}{$host}{ping}; + my $password = $anvil->data->{peers}{$host}{password}; + $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { + host => $host, + port => $port, + name => $name, + user => $user, + ping => $ping, + password => $anvil->Log->secure ? $password : $anvil->Words->string({key => "log_0186"}), + }}); + + $peer_table .= $anvil->Template->get({file => "striker.html", name => "striker-sync-entry", variables => { + access => $port eq 5432 ? $user."\@".$host : $user."\@".$host.":".$port, + ping_checked => $ping ? "checked" : "", + }}); } # Build the menu. diff --git a/html/skins/alteeve/striker.html b/html/skins/alteeve/striker.html index 30fd1bac..0e16c9a3 100644 --- a/html/skins/alteeve/striker.html +++ b/html/skins/alteeve/striker.html @@ -147,6 +147,20 @@ #!variable!peer_table!# + + + + + + #!string!striker_0071!# + + + #!string!striker_0072!# + + + + + @@ -159,13 +173,13 @@ #!variable!access!# - #!variable!ping!# + #!string!striker_0071!# - - #!variable!save_button!# + + - - #!variable!delete_button!# + + diff --git a/share/words.xml b/share/words.xml index be38aca7..772f91f2 100644 --- a/share/words.xml +++ b/share/words.xml @@ -319,7 +319,7 @@ Here we will inject 't_0006', which injects 't_0001' which has a variable: [#!st Up Order Inbound Connections Network - Peer Connection (user@host:port) + Peer Connections Ping @@ -390,10 +390,12 @@ Here we will inject 't_0006', which injects 't_0001' which has a variable: [#!st Help and support Use 'anvil-change-password' from the console to reset it.]]> Access to this machine via: [#!variable!network!#]. - - - - + Update + Delete + db_user@hostname_or_ip[:tcp_port] + Add + Ping before connect: + Bi-directional: Configure Network diff --git a/tools/anvil-configure-striker b/tools/anvil-configure-striker index 7ec075bb..172d7f69 100755 --- a/tools/anvil-configure-striker +++ b/tools/anvil-configure-striker @@ -31,6 +31,7 @@ $anvil->Log->level({set => 2}); $anvil->Log->secure({set => 1}); # Read switches +$anvil->data->{switches}{'no-reboot'} = 0; $anvil->Get->switches; # Paths @@ -85,8 +86,11 @@ $anvil->Database->insert_or_update_variables({ }); ### TODO: This is only until we can get the damn networking stable on reconfigure. -# Reboot. -$anvil->System->call({shell_call => $anvil->data->{path}{exe}{'shutdown'}." --reboot now"}); +if (not $anvil->data->{switches}{'no-reboot'}) +{ + # Reboot. + $anvil->System->call({shell_call => $anvil->data->{path}{exe}{'shutdown'}." --reboot now"}); +} $anvil->nice_exit({code => 0});