Support multilang, update code

Signed-off-by: R4SAS <r4sas@i2pmail.org>
This commit is contained in:
R4SAS 2021-05-22 18:29:05 +03:00
parent 0e68fe4a57
commit 80b44fc9a9
No known key found for this signature in database
GPG key ID: 66F6C87B98EBCFE2
10 changed files with 124 additions and 28 deletions

View file

@ -32,11 +32,6 @@
#include "ECIESX25519AEADRatchetSession.h"
#include "I18N.h"
#ifdef _WIN32
#include <boost/filesystem.hpp>
#include <codecvt>
#endif
#ifdef WIN32_APP
#include "Win32App.h"
#endif
@ -136,20 +131,6 @@ namespace http {
static std::string ConvertTime (uint64_t time);
std::map<uint32_t, uint32_t> HTTPConnection::m_Tokens;
std::string DataPath;
static void SetDataDir ()
{
#ifdef _WIN32
boost::filesystem::wpath path (i2p::fs::GetDataDir());
auto loc = boost::filesystem::path::imbue(std::locale( std::locale(), new std::codecvt_utf8_utf16<wchar_t>() ) );
i2p::http::DataPath = path.string();
boost::filesystem::path::imbue(loc); // Return it back
#else
i2p::http::DataPath = i2p::fs::GetDataDir();
#endif
}
static void ShowUptime (std::stringstream& s, int seconds)
{
int num;
@ -331,7 +312,7 @@ namespace http {
s << "<b>Transit:</b> ";
ShowTraffic (s, i2p::transport::transports.GetTotalTransitTransmittedBytes ());
s << " (" << (double) i2p::transport::transports.GetTransitBandwidth () / 1024 << " KiB/s)<br>\r\n";
s << "<b>Data path:</b> " << i2p::http::DataPath << "<br>\r\n";
s << "<b>Data path:</b> " << i2p::fs::GetUTF8DataDir() << "<br>\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<div class=\"slidecontent\">\r\n";
@ -1390,8 +1371,6 @@ namespace http {
LogPrint(eLogInfo, "HTTPServer: password set to ", pass);
}
i2p::http::SetDataDir();
m_IsRunning = true;
m_Thread.reset (new std::thread (std::bind (&HTTPServer::Run, this)));
m_Acceptor.listen ();