From 8ec070724989ba41fdce6ec511b56336ca836e8e Mon Sep 17 00:00:00 2001 From: zzz Date: Mon, 31 Mar 2025 21:34:45 +0000 Subject: [PATCH] Console: Remove redundant LS rendering code --- .../i2p/router/web/helpers/NetDbRenderer.java | 61 ++----------------- 1 file changed, 6 insertions(+), 55 deletions(-) diff --git a/apps/routerconsole/java/src/net/i2p/router/web/helpers/NetDbRenderer.java b/apps/routerconsole/java/src/net/i2p/router/web/helpers/NetDbRenderer.java index 1ce5ceb59..0d7a17754 100644 --- a/apps/routerconsole/java/src/net/i2p/router/web/helpers/NetDbRenderer.java +++ b/apps/routerconsole/java/src/net/i2p/router/web/helpers/NetDbRenderer.java @@ -707,6 +707,8 @@ class NetDbRenderer { int rapCount = 0; BigInteger median = null; int c = 0; + boolean linkSusi = _context.portMapper().isRegistered("susidns"); + long now = _context.clock().now(); // Summary if (debug) { @@ -721,59 +723,10 @@ class NetDbRenderer { TunnelPoolSettings in = _context.tunnelManager().getInboundSettings(myLeaseSet.getHash()); if (in != null && in.getDestinationNickname() != null) buf.append(" - ").append(DataHelper.escapeHTML(in.getDestinationNickname())); - buf.append("\n"); - boolean unpublished = ! _context.clientManager().shouldPublishLeaseSet(myLeaseSet.getHash()); - if (unpublished) { - buf.append("").append(_t("Local")).append(" "); - if (myLeaseSet.getType() == DatabaseEntry.KEY_TYPE_ENCRYPTED_LS2 || _context.keyRing().get(myLeaseSet.getHash()) != null) - buf.append(" (").append(_t("Encrypted")).append(")"); - buf.append(_t("Unpublished")).append(" "); - } else { - buf.append("").append(_t("Local")).append(" "); - if (myLeaseSet.getType() == DatabaseEntry.KEY_TYPE_ENCRYPTED_LS2 || _context.keyRing().get(myLeaseSet.getHash()) != null) - buf.append(" (").append(_t("Encrypted")).append(")"); - buf.append(_t("Published")).append(" "); - long exp = 0; - long now = _context.clock().now(); - if (myLeaseSet.getType() != DatabaseEntry.KEY_TYPE_LEASESET) { - LeaseSet2 ls2 = (LeaseSet2) myLeaseSet; - long pub = now - ls2.getPublished(); - buf.append(_t("{0} ago", DataHelper.formatDuration2(pub))); - exp = ls2.getExpires()-now; - buf.append(" - "); - } else { - exp = myLeaseSet.getLatestLeaseDate() - now; - } - if (exp > 0) - buf.append(_t("Expires in {0}", DataHelper.formatDuration2(exp))); - else - buf.append(_t("Expired {0} ago", DataHelper.formatDuration2(0-exp))); - } - buf.append("\n"); - buf.append("\n\n"); + buf.append("\n" + + "\n"); + renderLeaseSet(buf, myLeaseSet, true, now, linkSusi, null); + buf.append("\n"); } buf.append("Total Known Remote Leasesets:").append(leases.size()-1).append("\n"); } else { @@ -817,8 +770,6 @@ class NetDbRenderer { medianCount = rapCount / 2; } - boolean linkSusi = _context.portMapper().isRegistered("susidns"); - long now = _context.clock().now(); buf.append("
"); boolean ldebug = debug || client != null; for (LeaseSet ls : leases) {