From 9049902ceda0b3a8d1644beafe037d56f9b1d2c8 Mon Sep 17 00:00:00 2001 From: R4SAS Date: Wed, 10 Mar 2021 01:48:42 +0300 Subject: [PATCH] [webconsole] add address registration line generator Signed-off-by: R4SAS --- daemon/HTTPServer.cpp | 77 ++++++++++++++++++++++++++++++++++++------- libi2pd/Destination.h | 3 +- 2 files changed, 68 insertions(+), 12 deletions(-) diff --git a/daemon/HTTPServer.cpp b/daemon/HTTPServer.cpp index 459af3b9..fce3052d 100644 --- a/daemon/HTTPServer.cpp +++ b/daemon/HTTPServer.cpp @@ -123,6 +123,7 @@ namespace http { const char HTTP_COMMAND_LOGLEVEL[] = "set_loglevel"; const char HTTP_COMMAND_KILLSTREAM[] = "closestream"; const char HTTP_COMMAND_LIMITTRANSIT[] = "limittransit"; + const char HTTP_COMMAND_GET_REG_STRING[] = "get_reg_string"; const char HTTP_PARAM_SAM_SESSION_ID[] = "id"; const char HTTP_PARAM_ADDRESS[] = "address"; @@ -407,7 +408,7 @@ namespace http { } } - static void ShowLeaseSetDestination (std::stringstream& s, std::shared_ptr dest) + static void ShowLeaseSetDestination (std::stringstream& s, std::shared_ptr dest, uint32_t token) { s << "Base64:
\r\n
\r\n
\r\n"; @@ -419,6 +420,20 @@ namespace http { s << "\r\n\r\n"; } + if(dest->IsPublic()) + { + std::string webroot; i2p::config::GetOption("http.webroot", webroot); + auto base32 = dest->GetIdentHash ().ToBase32 (); + s << "
\r\n\r\n
\r\n" + "
\r\n" + " \r\n" + " \r\n" + " \r\n" + " Domain:\r\n\r\n" + " \r\n" + "
\r\nNote: result string can be used only for registering 2LD domains (example.i2p). For registering subdomains please use i2pd-tools.\r\n
\r\n
\r\n
\r\n"; + } + if(dest->GetNumRemoteLeaseSets()) { s << "