Browse Source

default webroot in config, webroot in automatic redirect instead of request path

pull/1268/head
asokolov 6 years ago
parent
commit
c994950aaf
  1. 2
      contrib/i2pd.conf
  2. 6
      daemon/HTTPServer.cpp

2
contrib/i2pd.conf

@ -93,6 +93,8 @@ ipv6 = false @@ -93,6 +93,8 @@ ipv6 = false
## Address and port service will listen on
address = 127.0.0.1
port = 7070
## Path to web console, default "/"
# webroot = /
## Uncomment following lines to enable Web Console authentication
# auth = true
# user = i2pd

6
daemon/HTTPServer.cpp

@ -1032,10 +1032,12 @@ namespace http { @@ -1032,10 +1032,12 @@ namespace http {
ShowError(s, "Unknown command: " + cmd);
return;
}
std::string webroot; i2p::config::GetOption("http.webroot", webroot);
std::string redirect = "5; url=" + webroot + "?page=commands";
s << "<b>SUCCESS</b>:&nbsp;Command accepted<br><br>\r\n";
s << "<a href=\"" << url.path << "?page=commands\">Back to commands list</a><br>\r\n";
s << "<a href=\"" << webroot << "?page=commands\">Back to commands list</a><br>\r\n";
s << "<p>You will be redirected in 5 seconds</b>";
res.add_header("Refresh", std::string("5; url=" + url.path + "?page=commands").c_str());
res.add_header("Refresh", redirect.c_str());
}
void HTTPConnection::SendReply (HTTPRes& reply, std::string& content)

Loading…
Cancel
Save