Console: Show offline expiration on LS debug page

This commit is contained in:
zzz
2020-11-02 12:01:58 +00:00
parent a21a64e0c6
commit 057eca56d5
2 changed files with 17 additions and 3 deletions

View File

@@ -597,11 +597,16 @@ class NetDbRenderer {
if (type != DatabaseEntry.KEY_TYPE_LEASESET) { if (type != DatabaseEntry.KEY_TYPE_LEASESET) {
LeaseSet2 ls2 = (LeaseSet2) ls; LeaseSet2 ls2 = (LeaseSet2) ls;
buf.append("&nbsp;&nbsp;<b>Unpublished? </b>").append(ls2.isUnpublished()); buf.append("&nbsp;&nbsp;<b>Unpublished? </b>").append(ls2.isUnpublished());
boolean isOff = ls2.isOffline(); if (ls2.isOffline()) {
buf.append("&nbsp;&nbsp;<b>Offline signed? </b>").append(isOff); buf.append("&nbsp;&nbsp;<b>Offline signed: </b>");
if (isOff) exp = ls2.getTransientExpiration() - 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("&nbsp;&nbsp;<b>Type: </b>").append(ls2.getTransientSigningKey().getType()); buf.append("&nbsp;&nbsp;<b>Type: </b>").append(ls2.getTransientSigningKey().getType());
} }
}
buf.append("</td></tr>\n<tr><td colspan=\"2\">"); buf.append("</td></tr>\n<tr><td colspan=\"2\">");
//buf.append(dest.toBase32()).append("<br>"); //buf.append(dest.toBase32()).append("<br>");
buf.append("<b>Signature type:</b> "); buf.append("<b>Signature type:</b> ");

View File

@@ -252,6 +252,15 @@ public class LeaseSet2 extends LeaseSet {
return _transientSigningPublicKey; return _transientSigningPublicKey;
} }
/**
* Absolute time, not time from now.
* @return transient expiration time or 0 if not offline signed
* @since 0.9.48
*/
public long getTransientExpiration() {
return _transientExpires;
}
/** /**
* Destination must be previously set. * Destination must be previously set.
* *