@ -198,7 +198,10 @@ namespace http {
s < < " <b>ERROR:</b> " < < string < < " <br> \r \n " ;
s < < " <b>ERROR:</b> " < < string < < " <br> \r \n " ;
}
}
void ShowStatus ( std : : stringstream & s , bool includeHiddenContent )
void ShowStatus (
std : : stringstream & s ,
bool includeHiddenContent ,
i2p : : http : : OutputFormatEnum outputFormat )
{
{
s < < " <b>Uptime:</b> " ;
s < < " <b>Uptime:</b> " ;
ShowUptime ( s , i2p : : context . GetUptime ( ) ) ;
ShowUptime ( s , i2p : : context . GetUptime ( ) ) ;
@ -245,7 +248,10 @@ namespace http {
ShowTraffic ( s , i2p : : transport : : transports . GetTotalTransitTransmittedBytes ( ) ) ;
ShowTraffic ( s , i2p : : transport : : transports . GetTotalTransitTransmittedBytes ( ) ) ;
s < < " ( " < < ( double ) i2p : : transport : : transports . GetTransitBandwidth ( ) / 1024 < < " KiB/s)<br> \r \n " ;
s < < " ( " < < ( double ) i2p : : transport : : transports . GetTransitBandwidth ( ) / 1024 < < " KiB/s)<br> \r \n " ;
s < < " <b>Data path:</b> " < < i2p : : fs : : GetDataDir ( ) < < " <br> \r \n " ;
s < < " <b>Data path:</b> " < < i2p : : fs : : GetDataDir ( ) < < " <br> \r \n " ;
s < < " <div class='slide'><label for='slide-info'>Hidden content. Press on text to see.</label> \r \n <input type='checkbox' id='slide-info'/> \r \n <p class='content'> \r \n " ;
s < < " <div class='slide'> " ;
if ( ( outputFormat = = OutputFormatEnum : : forWebConsole ) | | ! includeHiddenContent ) {
s < < " <label for='slide-info'>Hidden content. Press on text to see.</label> \r \n <input type='checkbox' id='slide-info'/> \r \n <p class='content'> \r \n " ;
}
if ( includeHiddenContent ) {
if ( includeHiddenContent ) {
s < < " <b>Router Ident:</b> " < < i2p : : context . GetRouterInfo ( ) . GetIdentHashBase64 ( ) < < " <br> \r \n " ;
s < < " <b>Router Ident:</b> " < < i2p : : context . GetRouterInfo ( ) . GetIdentHashBase64 ( ) < < " <br> \r \n " ;
s < < " <b>Router Family:</b> " < < i2p : : context . GetRouterInfo ( ) . GetProperty ( " family " ) < < " <br> \r \n " ;
s < < " <b>Router Family:</b> " < < i2p : : context . GetRouterInfo ( ) . GetProperty ( " family " ) < < " <br> \r \n " ;
@ -274,6 +280,9 @@ namespace http {
}
}
}
}
s < < " </p> \r \n </div> \r \n " ;
s < < " </p> \r \n </div> \r \n " ;
if ( outputFormat = = OutputFormatEnum : : forQtUi ) {
s < < " <br> " ;
}
s < < " <b>Routers:</b> " < < i2p : : data : : netdb . GetNumRouters ( ) < < " " ;
s < < " <b>Routers:</b> " < < i2p : : data : : netdb . GetNumRouters ( ) < < " " ;
s < < " <b>Floodfills:</b> " < < i2p : : data : : netdb . GetNumFloodfills ( ) < < " " ;
s < < " <b>Floodfills:</b> " < < i2p : : data : : netdb . GetNumFloodfills ( ) < < " " ;
s < < " <b>LeaseSets:</b> " < < i2p : : data : : netdb . GetNumLeaseSets ( ) < < " <br> \r \n " ;
s < < " <b>LeaseSets:</b> " < < i2p : : data : : netdb . GetNumLeaseSets ( ) < < " <br> \r \n " ;
@ -285,6 +294,7 @@ namespace http {
s < < " <b>Client Tunnels:</b> " < < std : : to_string ( clientTunnelCount ) < < " " ;
s < < " <b>Client Tunnels:</b> " < < std : : to_string ( clientTunnelCount ) < < " " ;
s < < " <b>Transit Tunnels:</b> " < < std : : to_string ( transitTunnelCount ) < < " <br> \r \n <br> \r \n " ;
s < < " <b>Transit Tunnels:</b> " < < std : : to_string ( transitTunnelCount ) < < " <br> \r \n <br> \r \n " ;
if ( outputFormat = = OutputFormatEnum : : forWebConsole ) {
s < < " <table><caption>Services</caption><tr><th>Service</th><th>State</th></tr> \r \n " ;
s < < " <table><caption>Services</caption><tr><th>Service</th><th>State</th></tr> \r \n " ;
s < < " <tr><td> " < < " HTTP Proxy " < < " </td><td><div class=' " < < ( ( i2p : : client : : context . GetHttpProxy ( ) ) ? " enabled " : " disabled " ) < < " '></div></td></tr> \r \n " ;
s < < " <tr><td> " < < " HTTP Proxy " < < " </td><td><div class=' " < < ( ( i2p : : client : : context . GetHttpProxy ( ) ) ? " enabled " : " disabled " ) < < " '></div></td></tr> \r \n " ;
s < < " <tr><td> " < < " SOCKS Proxy " < < " </td><td><div class=' " < < ( ( i2p : : client : : context . GetSocksProxy ( ) ) ? " enabled " : " disabled " ) < < " '></div></td></tr> \r \n " ;
s < < " <tr><td> " < < " SOCKS Proxy " < < " </td><td><div class=' " < < ( ( i2p : : client : : context . GetSocksProxy ( ) ) ? " enabled " : " disabled " ) < < " '></div></td></tr> \r \n " ;
@ -295,6 +305,7 @@ namespace http {
s < < " <tr><td> " < < " I2PControl " < < " </td><td><div class=' " < < ( ( i2pcontrol ) ? " enabled " : " disabled " ) < < " '></div></td></tr> \r \n " ;
s < < " <tr><td> " < < " I2PControl " < < " </td><td><div class=' " < < ( ( i2pcontrol ) ? " enabled " : " disabled " ) < < " '></div></td></tr> \r \n " ;
s < < " </table> \r \n " ;
s < < " </table> \r \n " ;
}
}
}
void ShowLocalDestinations ( std : : stringstream & s )
void ShowLocalDestinations ( std : : stringstream & s )
{
{
@ -863,7 +874,7 @@ namespace http {
} else if ( req . uri . find ( " cmd= " ) ! = std : : string : : npos ) {
} else if ( req . uri . find ( " cmd= " ) ! = std : : string : : npos ) {
HandleCommand ( req , res , s ) ;
HandleCommand ( req , res , s ) ;
} else {
} else {
ShowStatus ( s , true ) ;
ShowStatus ( s , true , i2p : : http : : OutputFormatEnum : : forWebConsol e ) ;
res . add_header ( " Refresh " , " 10 " ) ;
res . add_header ( " Refresh " , " 10 " ) ;
}
}
ShowPageTail ( s ) ;
ShowPageTail ( s ) ;