diff --git a/daemon/HTTPServer.cpp b/daemon/HTTPServer.cpp
index 5c6a3cd8..38225450 100644
--- a/daemon/HTTPServer.cpp
+++ b/daemon/HTTPServer.cpp
@@ -41,71 +41,108 @@
namespace i2p {
namespace http {
- const std::string itoopieFavicon =
- "data:image/png;base64,"
- "iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACx"
- "jwv8YQUAAAAJcEhZcwAALiIAAC4iAari3ZIAAAAHdElNRQfgCQsUNSZrkhi1AAAAGXRFWHRTb2Z0"
- "d2FyZQBwYWludC5uZXQgNC4wLjEyQwRr7AAAAoJJREFUOE9jwAUqi4Q1oEwwcDTV1+5sETaBclGB"
- "vb09C5QJB6kWpvFQJoOCeLC5kmjEHCgXE2SlyETLi3h6QrkM4VL+ssWSCZUgtopITLKqaOotRTEn"
- "cbAkLqAkGtOqLBLVAWLXyWSVFkkmRiqLxuaqiWb/VBYJMAYrwgckJY25VEUzniqKhjU2y+RtCRSP"
- "6lUXy/1jIBV5tlYxZUaFVMq2NInwIi9hO8fSfOEAqDZUoCwal6MulvOvyS7gi69K4j9zxZT/m0ps"
- "/28ptvvvquXXryIa7QYMMdTwqi0WNtVi0GIDseXl7TnUxFKfnGlxAGp0+D8j2eH/8Ub7/9e7nf7X"
- "+Af/B7rwt6pI0h0l0WhQADOC9DBkhSirpImHNVZKp24ukkyoshGLnN8d5fA/y13t/44Kq/8hlnL/"
- "z7fZ/58f6vcxSNpbVUVFhV1RLNBVTsQzVYZPSwhsCAhkiIfpNMrkbO6TLf071Sfk/5ZSi/+7q6z/"
- "P5ns+v9mj/P/CpuI/20y+aeNGYxZoVoYGmsF3aFMBAAZlCwftnF9ke3//bU2//fXWP8/UGv731Am"
- "+V+DdNblSqnUYqhSTKAiYSOqJBrVqiaa+S3UNPr/gmyH/xuKXf63hnn/B8bIP0UxHfEyyeSNQKVM"
- "EB1AEB2twhcTLp+gIBJUoyKasEpVJHmqskh8qryovUG/ffCHHRU2q/Tk/YuB6eGPsbExa7ZkpLu1"
- "oLEcVDtuUCgV1w60rQzElpRUE1EVSX0BYidHiInXF4nagNhYQW60EF+ApH1ktni0A1SIITSUgVlZ"
- "JHYnlIsfzJjIp9xZKswL5YKBHL+coKJoRDaUSzoozxHVrygQU4JykQADAwAT5b1NHtwZugAAAABJ"
- "RU5ErkJggg==";
+ const std::string i2pdfavicon =
+ "data:image/svg+xml,%3Csvg xmlns=\'http://www.w3.org/2000/svg\' viewBox=\'0 0 64 64\'%3E%3Crect width=\'64\' height=\'64\' fill=\'%23313\' rx=\'5\'/%3E%3Ccircle cx=\'8\' cy=\'32\' r=\'4\' fill=\'%23ee6565\'/%3E%3Ccircle cx=\'20\' cy=\'32\' r=\'4\' fill=\'%239ff39f\'/%3E%3Ccircle cx=\'32\' cy=\'8\' r=\'4\' fill=\'%239ff39f\'/%3E%3Ccircle cx=\'32\' cy=\'20\' r=\'4\' fill=\'%239ff39f\'/%3E%3Ccircle cx=\'32\' cy=\'32\' r=\'4\' fill=\'%239ff39f\'/%3E%3Ccircle cx=\'32\' cy=\'44\' r=\'4\' fill=\'%239ff39f\'/%3E%3Ccircle cx=\'32\' cy=\'56\' r=\'4\' fill=\'%239ff39f\'/%3E%3Ccircle cx=\'44\' cy=\'32\' r=\'4\' fill=\'%239ff39f\'/%3E%3Ccircle cx=\'56\' cy=\'32\' r=\'4\' fill=\'%23ee6565\'/%3E%3Ccircle cx=\'8\' cy=\'20\' r=\'4\' fill=\'%23ffc95e\'/%3E%3Ccircle cx=\'8\' cy=\'44\' r=\'4\' fill=\'%23ffc95e\'/%3E%3Ccircle cx=\'20\' cy=\'8\' r=\'4\' fill=\'%23ffc95e\'/%3E%3Ccircle cx=\'20\' cy=\'20\' r=\'4\' fill=\'%23ffc95e\'/%3E%3Ccircle cx=\'20\' cy=\'44\' r=\'4\' fill=\'%239ff39f\'/%3E%3Ccircle cx=\'20\' cy=\'56\' r=\'4\' fill=\'%23ffc95e\'/%3E%3Ccircle cx=\'44\' cy=\'8\' r=\'4\' fill=\'%239ff39f\'/%3E%3Ccircle cx=\'44\' cy=\'20\' r=\'4\' fill=\'%239ff39f\'/%3E%3Ccircle cx=\'44\' cy=\'44\' r=\'4\' fill=\'%239ff39f\'/%3E%3Ccircle cx=\'44\' cy=\'56\' r=\'4\' fill=\'%239ff39f\'/%3E%3Ccircle cx=\'56\' cy=\'20\' r=\'4\' fill=\'%23ffc95e\'/%3E%3Ccircle cx=\'56\' cy=\'44\' r=\'4\' fill=\'%23ffc95e\'/%3E%3Ccircle cx=\'8\' cy=\'8\' r=\'4\' fill=\'%23ee6565\'/%3E%3Ccircle cx=\'8\' cy=\'56\' r=\'4\' fill=\'%23ee6565\'/%3E%3Ccircle cx=\'56\' cy=\'8\' r=\'4\' fill=\'%23ee6565\'/%3E%3Ccircle cx=\'56\' cy=\'56\' r=\'4\' fill=\'%23ee6565\'/%3E%3C/svg%3E";
// Bundled style
const std::string internalCSS =
"\r\n";
// for external style sheet
@@ -188,17 +225,25 @@ namespace http {
static void ShowTraffic (std::stringstream& s, uint64_t bytes)
{
- s << std::fixed << std::setprecision(2);
+ s << std::fixed << std::setprecision(0);
auto numKBytes = (double) bytes / 1024;
- if (numKBytes < 1024)
- s << numKBytes << " " << tr(/* tr: Kibibit */ "KiB");
- else if (numKBytes < 1024 * 1024)
- s << numKBytes / 1024 << " " << tr(/* tr: Mebibit */ "MiB");
- else
- s << numKBytes / 1024 / 1024 << " " << tr(/* tr: Gibibit */ "GiB");
+ if (numKBytes < 1) {
+ s << std::fixed << std::setprecision(2);
+ s << numKBytes * 1024 << " " << tr(/* tr: Byte */ "B");
+ } else if (numKBytes < 1024) {
+ s << numKBytes << " " << tr(/* tr: Kibibit */ "K");
+ } else if (numKBytes < 1024 * 1024) {
+ s << std::fixed << std::setprecision(1);
+ s << numKBytes / 1024 << " " << tr(/* tr: Mebibit */ "M");
+ } else if (numKBytes < 1024 * 1024 * 1024) {
+ s << std::fixed << std::setprecision(2);
+ s << numKBytes / 1024 / 1024 << " " << tr(/* tr: Gibibit */ "G");
+ } else {
+ s << numKBytes / 1024 / 1024 / 1024 << " " << tr(/* tr: Tibibit */ "T");
+ }
}
- static void ShowTunnelDetails (std::stringstream& s, enum i2p::tunnel::TunnelState eState, bool explr, int bytes)
+ static void ShowTunnelDetails (std::stringstream& s, enum i2p::tunnel::TunnelState eState, bool explr, double bytes)
{
std::string state, stateText;
switch (eState) {
@@ -218,8 +263,21 @@ namespace http {
else if (state == "established") stateText = tr("established");
else stateText = tr("unknown");
- s << " " << stateText << ((explr) ? " (" + tr("exploratory") + ")" : "") << ", ";
- s << " " << (int) (bytes / 1024) << " " << tr(/* tr: Kibibit */ "KiB") << "\r\n";
+ s << ""
+ << stateText << ((explr) ? " (" + tr("exploratory") + ")" : "") << "";
+ s << std::fixed << std::setprecision(0);
+ if (bytes > 1024 * 1024 * 1024) {
+ s << std::fixed << std::setprecision(2);
+ s << " " << (double) (bytes / 1024 / 1024 / 1024) << "G\r\n";
+ } else if (bytes > 1024 * 1024) {
+ s << std::fixed << std::setprecision(1);
+ s << " " << (double) (bytes / 1024 / 1024) << "M\r\n";
+ } else if (bytes > 1024) {
+ s << " " << (int) (bytes / 1024) << "K\r\n";
+ } else {
+ s << " " << (int) (bytes) << "B\r\n";
+ }
}
static void SetLogLevel (const std::string& level)
@@ -241,6 +299,14 @@ namespace http {
std::string currLang = i2p::context.GetLanguage ()->GetLanguage(); // get current used language
auto it = i2p::i18n::languages.find(currLang);
std::string langCode = it->second.ShortCode;
+ // SAM
+ auto sam = i2p::client::context.GetSAMBridge ();
+
+ std::map params;
+ std::string page("");
+ URL url;
+ url.parse_query(params);
+ page = params["page"];
s <<
"\r\n"
@@ -248,43 +314,47 @@ namespace http {
" \r\n" /* TODO: Find something to parse html/template system. This is horrible. */
" \r\n"
" \r\n"
- " \r\n"
- " Purple I2P " VERSION " Webconsole\r\n";
+ " \r\n"
+ " Purple I2P | " VERSION "\r\n";
GetStyles(s);
s <<
"\r\n"
"\r\n"
- "\r\n"
- "\r\n"
- "