";
@@ -321,11 +323,12 @@ namespace http {
void ShowLocalDestinations (std::stringstream& s)
{
+ std::string webroot; i2p::config::GetOption("http.webroot", webroot);
s << "
Local Destinations:\r\n
\r\n";
for (auto& it: i2p::client::context.GetDestinations ())
{
auto ident = it.second->GetIdentHash ();
- s << "
";
+ s << "";
s << i2p::client::context.GetAddressBook ().ToAddress(ident) << "\r\n" << std::endl;
}
@@ -340,7 +343,7 @@ namespace http {
{
auto ident = dest->GetIdentHash ();
auto& name = dest->GetNickname ();
- s << "
[ ";
+ s << "[ ";
s << name << " ] ⇔ " << i2p::client::context.GetAddressBook ().ToAddress(ident) <<"
\r\n" << std::endl;
}
}
@@ -510,33 +513,34 @@ namespace http {
static void ShowCommands (std::stringstream& s, uint32_t token)
{
+ std::string webroot; i2p::config::GetOption("http.webroot", webroot);
/* commands */
s << "
Router Commands\r\n
\r\n";
- s << "
Run peer test\r\n";
+ s << "
Run peer test\r\n";
//s << "
Reload config\r\n";
if (i2p::context.AcceptsTunnels ())
- s << "
Decline transit tunnels\r\n";
+ s << "
Decline transit tunnels\r\n";
else
- s << "
Accept transit tunnels\r\n";
+ s << "
Accept transit tunnels\r\n";
#if ((!defined(WIN32) && !defined(QT_GUI_LIB) && !defined(ANDROID)) || defined(ANDROID_BINARY))
if (Daemon.gracefulShutdownInterval)
- s << "
Cancel graceful shutdown";
+ s << "
Cancel graceful shutdown";
else
- s << "
Start graceful shutdown\r\n";
+ s << "
Start graceful shutdown\r\n";
#elif defined(WIN32_APP)
if (i2p::util::DaemonWin32::Instance().isGraceful)
- s << "
Cancel graceful shutdown";
+ s << "
Cancel graceful shutdown";
else
- s << "
Graceful shutdown\r\n";
+ s << "
Graceful shutdown\r\n";
#endif
- s << "
Force shutdown\r\n";
+ s << "
Force shutdown\r\n";
s << "
\r\n
Logging level\r\n";
- s << "
[none] ";
- s << "
[error] ";
- s << "
[warn] ";
- s << "
[info] ";
- s << "
[debug]\r\n";
+ s << "
[none] ";
+ s << "
[error] ";
+ s << "
[warn] ";
+ s << "
[info] ";
+ s << "
[debug]\r\n";
}
void ShowTransitTunnels (std::stringstream& s)
@@ -653,6 +657,7 @@ namespace http {
void ShowSAMSessions (std::stringstream& s)
{
+ std::string webroot; i2p::config::GetOption("http.webroot", webroot);
auto sam = i2p::client::context.GetSAMBridge ();
if (!sam) {
ShowError(s, "SAM disabled");
@@ -662,13 +667,14 @@ namespace http {
for (auto& it: sam->GetSessions ())
{
auto& name = it.second->localDestination->GetNickname ();
- s << "
";
+ s << "";
s << name << " (" << it.first << ")\r\n" << std::endl;
}
}
static void ShowSAMSession (std::stringstream& s, const std::string& id)
{
+ std::string webroot; i2p::config::GetOption("http.webroot", webroot);
s << "
SAM Session:\r\n
\r\n";
auto sam = i2p::client::context.GetSAMBridge ();
if (!sam) {
@@ -681,7 +687,7 @@ namespace http {
return;
}
auto& ident = session->localDestination->GetIdentHash();
- s << "
";
+ s << "";
s << i2p::client::context.GetAddressBook ().ToAddress(ident) << "\r\n";
s << "
\r\n";
s << "
Streams:\r\n";
@@ -701,11 +707,12 @@ namespace http {
void ShowI2PTunnels (std::stringstream& s)
{
+ std::string webroot; i2p::config::GetOption("http.webroot", webroot);
s << "
Client Tunnels:\r\n
\r\n";
for (auto& it: i2p::client::context.GetClientTunnels ())
{
auto& ident = it.second->GetLocalDestination ()->GetIdentHash();
- s << "
";
+ s << "";
s << it.second->GetName () << " ⇐ ";
s << i2p::client::context.GetAddressBook ().ToAddress(ident);
s << "
\r\n"<< std::endl;
@@ -714,7 +721,7 @@ namespace http {
if (httpProxy)
{
auto& ident = httpProxy->GetLocalDestination ()->GetIdentHash();
- s << "
";
+ s << "";
s << "HTTP Proxy" << " ⇐ ";
s << i2p::client::context.GetAddressBook ().ToAddress(ident);
s << "
\r\n"<< std::endl;
@@ -723,7 +730,7 @@ namespace http {
if (socksProxy)
{
auto& ident = socksProxy->GetLocalDestination ()->GetIdentHash();
- s << "
";
+ s << "";
s << "SOCKS Proxy" << " ⇐ ";
s << i2p::client::context.GetAddressBook ().ToAddress(ident);
s << "
\r\n"<< std::endl;
@@ -734,7 +741,7 @@ namespace http {
for (auto& it: serverTunnels)
{
auto& ident = it.second->GetLocalDestination ()->GetIdentHash();
- s << "
";
+ s << "";
s << it.second->GetName () << " ⇒ ";
s << i2p::client::context.GetAddressBook ().ToAddress(ident);
s << ":" << it.second->GetLocalPort ();
@@ -748,7 +755,7 @@ namespace http {
for (auto& it: clientForwards)
{
auto& ident = it.second->GetLocalDestination ()->GetIdentHash();
- s << "
";
+ s << "";
s << it.second->GetName () << " ⇐ ";
s << i2p::client::context.GetAddressBook ().ToAddress(ident);
s << "
\r\n"<< std::endl;
@@ -761,7 +768,7 @@ namespace http {
for (auto& it: serverForwards)
{
auto& ident = it.second->GetLocalDestination ()->GetIdentHash();
- s << "
";
+ s << "";
s << it.second->GetName () << " ⇐ ";
s << i2p::client::context.GetAddressBook ().ToAddress(ident);
s << "
\r\n"<< std::endl;
@@ -1026,9 +1033,9 @@ namespace http {
return;
}
s << "
SUCCESS: Command accepted
\r\n";
- s << "
Back to commands list\r\n";
- s << "
You will be redirected in 5 seconds";
- res.add_header("Refresh", "5; url=/?page=commands");
+ s << "Back to commands list
\r\n";
+ // s << "
You will be redirected in 5 seconds";
+ // res.add_header("Refresh", "5; url=/?page=commands");
}
void HTTPConnection::SendReply (HTTPRes& reply, std::string& content)
diff --git a/libi2pd/Config.cpp b/libi2pd/Config.cpp
index 9eaaf068..abeba94f 100644
--- a/libi2pd/Config.cpp
+++ b/libi2pd/Config.cpp
@@ -86,6 +86,7 @@ namespace config {
("http.pass", value()->default_value(""), "Password for basic auth (default: random, see logs)")
("http.strictheaders", value()->default_value(true), "Enable strict host checking on WebUI")
("http.hostname", value()->default_value("localhost"), "Expected hostname for WebUI")
+ ("http.webroot", value()->default_value("/"), "WebUI root path (default: / )")
;
options_description httpproxy("HTTP Proxy options");