Return the node "type" (full / topOnly / lite) in GET /admin/info endpoint.

This can used by the UI to hide features that aren't supported on lite nodes.
This commit is contained in:
CalDescent 2022-03-20 18:13:45 +00:00
parent a921db2cc6
commit 0e3a9ee2b2
2 changed files with 14 additions and 0 deletions

View File

@ -12,6 +12,7 @@ public class NodeInfo {
public long buildTimestamp;
public String nodeId;
public boolean isTestNet;
public String type;
public NodeInfo() {
}

View File

@ -119,10 +119,23 @@ public class AdminResource {
nodeInfo.buildTimestamp = Controller.getInstance().getBuildTimestamp();
nodeInfo.nodeId = Network.getInstance().getOurNodeId();
nodeInfo.isTestNet = Settings.getInstance().isTestNet();
nodeInfo.type = getNodeType();
return nodeInfo;
}
private String getNodeType() {
if (Settings.getInstance().isTopOnly()) {
return "topOnly";
}
else if (Settings.getInstance().isLite()) {
return "lite";
}
else {
return "full";
}
}
@GET
@Path("/status")
@Operation(