--- lib/PXElator/httpd.pm 2009/08/28 23:30:38 334 +++ lib/PXElator/httpd.pm 2009/08/30 22:46:57 385 @@ -19,8 +19,25 @@ use IO::Socket::INET; use Regexp::Common qw/net/; -sub menu {qq{ +our $title; +sub html_start { +qq{ + + +$title + + +}} + +sub html_end { +qq{ + + +}} + +sub menu { +qq{
home server @@ -56,6 +73,8 @@ use wireshark; use syslogd; use nmap; +use ping; +use wol; use CouchDB; @@ -107,7 +126,7 @@ } sub ok { - qq|HTTP/1.0 200 OK\r\nContent-Type: text/html\r\nConnection: close\r\n\r\n| . menu() + qq|HTTP/1.0 200 OK\r\nContent-Type: text/html\r\nConnection: close\r\n\r\n| . html_start() . menu() } sub redirect { @@ -123,6 +142,8 @@ CouchDB::audit( 'request', { path => $path, param => $param, peerhost => $client->peerhost } ); + $title = $path; + if ( my $found = static( $client,$path ) ) { warn "static $found" if $debug; } elsif ( $path eq '/' ) { @@ -209,6 +230,7 @@ ; } elsif ( $path =~ m!^/client(?:/$RE{net}{IPv4}{-keep})?! ) { my $ip = $1; + $title = $ip; if ( $param->{action} eq 'remove' ) { client::remove( $param->{change_ip} ); @@ -237,26 +259,27 @@ } if ( $ip && $ip ne $server::ip ) { - my $hostname = client::conf( $ip, 'hostname' => $param->{hostname} ); + my @editable = ( qw/hostname config homepage/ ); + + client::conf( $ip, $_ => $param->{$_} ) foreach @editable; + + my $conf = client::all_conf( $ip ); + my $config = delete $conf->{config}; + + my $nmap = qq|nmap|; my @table = ( + 'ping' => ping::host($ip) + ? qq|up $nmap| + : qq|down wol $nmap| + , 'ip' => qq|