diff --git a/daemon/HTTPServer.cpp b/daemon/HTTPServer.cpp
index dceee06a..f9b034ae 100644
--- a/daemon/HTTPServer.cpp
+++ b/daemon/HTTPServer.cpp
@@ -87,6 +87,7 @@ namespace http {
const char HTTP_COMMAND_GET_REG_STRING[] = "get_reg_string";
const char HTTP_COMMAND_SETLANGUAGE[] = "setlanguage";
const char HTTP_COMMAND_RELOAD_CSS[] = "reload_css";
+ const char HTTP_COMMAND_EXPIRELEASE[] = "expirelease";
static std::string ConvertTime (uint64_t time)
{
@@ -434,12 +435,11 @@ namespace http {
if (dest->IsPublic() && token && !dest->IsEncryptedLeaseSet ())
{
std::string webroot; i2p::config::GetOption("http.webroot", webroot);
- auto base32 = dest->GetIdentHash ().ToBase32 ();
s << "
" << tr("Address registration line") << " \r\n
\r\n
\r\n"
"\r\n" << tr("Note: 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";
@@ -448,9 +448,23 @@ namespace http {
if (dest->GetNumRemoteLeaseSets())
{
s << "" << tr("LeaseSets") << ": " << dest->GetNumRemoteLeaseSets ()
- << " \r\n
\r\n
\r\n
"<< tr("Address") << " " << tr("Type") << " " << tr("EncType") << " ";
+ << "\r\n \r\n\r\n\r\n \r\n";
} else
s << "" << tr("LeaseSets") << ": 0 \r\n \r\n";
@@ -1312,6 +1326,36 @@ namespace http {
res.add_header("Refresh", redirect.c_str());
return;
}
+ else if (cmd == HTTP_COMMAND_EXPIRELEASE)
+ {
+ std::string b32 = params["b32"];
+ std::string lease = params["lease"];
+
+ i2p::data::IdentHash ident, leaseident;
+ ident.FromBase32 (b32);
+ leaseident.FromBase32 (lease);
+ auto dest = i2p::client::context.FindLocalDestination (ident);
+
+ if (dest)
+ {
+ auto leaseset = dest->FindLeaseSet (leaseident);
+ if (leaseset)
+ {
+ leaseset->ExpireLease ();
+ s << "" << tr("SUCCESS") << " : " << tr("LeaseSet expiration time updated") << " \r\n \r\n";
+ }
+ else
+ s << "" << tr("ERROR") << " : " << tr("LeaseSet is not found or already expired") << " \r\n \r\n";
+ }
+ else
+ s << "" << tr("ERROR") << " : " << tr("Destination not found") << " \r\n \r\n";
+
+ s << "" << tr("Return to destination page") << " \r\n";
+ s << "" << tr("You will be redirected in %d seconds", COMMAND_REDIRECT_TIMEOUT) << "";
+ redirect = std::to_string(COMMAND_REDIRECT_TIMEOUT) + "; url=" + webroot + "?page=local_destination&b32=" + b32;
+ res.add_header("Refresh", redirect.c_str());
+ return;
+ }
else if (cmd == HTTP_COMMAND_LIMITTRANSIT)
{
uint32_t limit = std::stoul(params["limit"], nullptr);
diff --git a/libi2pd/LeaseSet.h b/libi2pd/LeaseSet.h
index 566c4655..4b1311a5 100644
--- a/libi2pd/LeaseSet.h
+++ b/libi2pd/LeaseSet.h
@@ -96,6 +96,9 @@ namespace data
void Encrypt (const uint8_t * data, uint8_t * encrypted) const;
bool IsDestination () const { return true; };
+ // used in webconsole
+ void ExpireLease () { m_ExpirationTime = i2p::util::GetSecondsSinceEpoch (); };
+
protected:
void UpdateLeasesBegin ();