| 477 | } |
| 478 | |
| 479 | static void ShowLeaseSetDestination (std::stringstream& s, std::shared_ptr<const i2p::client::LeaseSetDestination> dest, uint32_t token) |
| 480 | { |
| 481 | std::string webroot; i2p::config::GetOption("http.webroot", webroot); |
| 482 | s << "<b>Base32:</b><br>\r\n<textarea readonly cols=\"80\" rows=\"1\">"; |
| 483 | s << dest->GetIdentHash ().ToBase32 () << "</textarea><br>\r\n<br>\r\n"; |
| 484 | |
| 485 | s << "<b>Base64:</b><br>\r\n<textarea readonly cols=\"80\" rows=\"8\">"; |
| 486 | s << dest->GetIdentity ()->ToBase64 () << "</textarea><br>\r\n<br>\r\n"; |
| 487 | |
| 488 | if (dest->IsEncryptedLeaseSet ()) |
| 489 | { |
| 490 | i2p::data::BlindedPublicKey blinded (dest->GetIdentity (), dest->IsPerClientAuth ()); |
| 491 | s << "<div class='slide'><label for='slide-b33'><b>" << tr("Encrypted B33 address") << ":</b></label>\r\n"; |
| 492 | s << "<input type=\"checkbox\" id=\"slide-b33\" />\r\n"; |
| 493 | s << "<div class=\"slidecontent\">\r\n"; |
| 494 | s << blinded.ToB33 () << ".b32.i2p<br>\r\n"; |
| 495 | s << "</div>\r\n</div>\r\n"; |
| 496 | } |
| 497 | |
| 498 | if (dest->IsPublic() && token && !dest->IsEncryptedLeaseSet ()) |
| 499 | { |
| 500 | std::string webroot; i2p::config::GetOption("http.webroot", webroot); |
| 501 | s << "<div class='slide'><label for='slide-regaddr'><b>" << tr("Address registration line") << "</b></label>\r\n" |
| 502 | "<input type=\"checkbox\" id=\"slide-regaddr\" />\r\n" |
| 503 | "<div class=\"slidecontent\">\r\n" |
| 504 | "<form method=\"get\" action=\"" << webroot << "\">\r\n" |
| 505 | " <input type=\"hidden\" name=\"cmd\" value=\"" << HTTP_COMMAND_GET_REG_STRING << "\">\r\n" |
| 506 | " <input type=\"hidden\" name=\"token\" value=\"" << token << "\">\r\n" |
| 507 | " <input type=\"hidden\" name=\"b32\" value=\"" << dest->GetIdentHash ().ToBase32 () << "\">\r\n" |
| 508 | " <b>" << tr("Domain") << ":</b>\r\n<input type=\"text\" maxlength=\"67\" name=\"name\" placeholder=\"domain.i2p\" required>\r\n" |
| 509 | " <button type=\"submit\">" << tr("Generate") << "</button>\r\n" |
| 510 | "</form>\r\n" |
| 511 | "<small>" << tr("<b>Note:</b> result string can be used only for registering 2LD domains (example.i2p). For registering subdomains please use i2pd-tools.") << "</small>\r\n" |
| 512 | "</div>\r\n</div>\r\n<br>\r\n"; |
| 513 | } |
| 514 | |
| 515 | if (dest->GetNumRemoteLeaseSets()) |
| 516 | { |
| 517 | s << "<div class='slide'><label for='slide-lease'><b>" << tr("LeaseSets") << ":</b> <i>" << dest->GetNumRemoteLeaseSets () |
| 518 | << "</i></label>\r\n<input type=\"checkbox\" id=\"slide-lease\" />\r\n" |
| 519 | << "<div class=\"slidecontent\">\r\n" |
| 520 | << "<table>\r\n<thead><tr>" |
| 521 | << "<th>" << tr("Address") << "</th>" |
| 522 | << "<th style=\"width:5px;\"> </th>" // LeaseSet expiration button column |
| 523 | << "<th>" << tr("Type") << "</th>" |
| 524 | << "<th>" << tr("EncType") << "</th>" |
| 525 | << "</tr></thead>\r\n<tbody class=\"tableitem\">"; |
| 526 | for(auto& it: dest->GetLeaseSets ()) |
| 527 | { |
| 528 | s << "<tr>" |
| 529 | << "<td>" << it.first.ToBase32 () << "</td>" |
| 530 | << "<td><a class=\"button\" href=\"" << webroot << "?cmd=" << HTTP_COMMAND_EXPIRELEASE<< "&b32=" << dest->GetIdentHash ().ToBase32 () |
| 531 | << "&lease=" << it.first.ToBase32 () << "&token=" << token << "\" title=\"" << tr("Expire LeaseSet") << "\"> ✘ </a></td>" |
| 532 | << "<td>" << (int)it.second->GetStoreType () << "</td>" |
| 533 | << "<td>" << (int)it.second->GetEncryptionType () <<"</td>" |
| 534 | << "</tr>\r\n"; |
| 535 | } |
| 536 | s << "</tbody>\r\n</table>\r\n"; |
no test coverage detected