diff --git a/daemon/HTTPServer.cpp b/daemon/HTTPServer.cpp index 125fc519..e935e16f 100644 --- a/daemon/HTTPServer.cpp +++ b/daemon/HTTPServer.cpp @@ -1255,8 +1255,8 @@ namespace http { std::string jsRedir = "this.href = location.protocol + '//' + location.hostname + ':' + " + std::to_string(rpcPort) + " + '" + webPath + "/web/'"; s << "" + << "onmouseover=\"" << jsRedir << "\" target=\"_blank\" rel=\"noopener noreferrer\"" + << "onclick=\"" << jsRedir << "\" target=\"_blank\" rel=\"noopener noreferrer\">" << " | Web Panel"; } s << "\r\n"<< std::endl; diff --git a/libi2pd_client/TorrentsRPC.cpp b/libi2pd_client/TorrentsRPC.cpp index 6cb12992..13ea9a46 100644 --- a/libi2pd_client/TorrentsRPC.cpp +++ b/libi2pd_client/TorrentsRPC.cpp @@ -931,11 +931,14 @@ namespace torrents { ".swf", { "application/x-shockwave-flash", false } } }; - std::string contentType ("text/html; charset=utf-8"); + std::string contentType (""); auto filePath = std::filesystem::path (i2p::fs::GetDataDir ()) / "torrents" / "web"; std::string target {req.target ()}; if (target.empty () || target.back() == '/') + { filePath /= "index.html"; + contentType = "text/html; charset=utf-8"; + } else { std::filesystem::path urlPath (target); @@ -995,7 +998,8 @@ namespace torrents m_WebResponse->result (boost::beast::http::status::ok); m_WebResponse->version(11); m_WebResponse->set (boost::beast::http::field::server, "i2pd torrents web"); - m_WebResponse->set (boost::beast::http::field::content_type, contentType); + if (contentType.length()) + m_WebResponse->set (boost::beast::http::field::content_type, contentType); m_WebResponse->body () = std::move (body); boost::beast::http::async_write (m_Socket, *m_WebResponse, [s = shared_from_this ()](const boost::system::error_code& ecode, size_t bytes_transferred)