Author: zothar
Date: 2006-11-19 22:18:40 +0000 (Sun, 19 Nov 2006)
New Revision: 11015

Modified:
   trunk/freenet/src/freenet/clients/http/DarknetConnectionsToadlet.java
   trunk/freenet/src/freenet/node/Node.java
Log:
Add network port list to bottom of /darknet/ page, hopefully making explaining 
some things to newbies a little easier (and possibly avoiding the need for them 
to enable advanced Darknet mode).

Modified: trunk/freenet/src/freenet/clients/http/DarknetConnectionsToadlet.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/DarknetConnectionsToadlet.java       
2006-11-19 19:44:39 UTC (rev 11014)
+++ trunk/freenet/src/freenet/clients/http/DarknetConnectionsToadlet.java       
2006-11-19 22:18:40 UTC (rev 11015)
@@ -534,6 +534,35 @@
                referenceInfobox.addChild("div", "class", 
"infobox-header").addChild("a", "href", "myref.fref", "My reference");
                referenceInfobox.addChild("div", "class", 
"infobox-content").addChild("pre", "id", "reference", 
node.exportPublicFieldSet().toString());

+               // our ports
+               HTMLNode portInfobox = contentNode.addChild("div", "class", 
"infobox infobox-normal");
+               portInfobox.addChild("div", "class", "infobox-header", "Node's 
Ports");
+               HTMLNode portInfoboxContent = portInfobox.addChild("div", 
"class", "infobox-content");
+               HTMLNode portInfoList = portInfoboxContent.addChild("ul");
+               SimpleFieldSet fproxyConfig = 
node.config.get("fproxy").exportFieldSet(true);
+               SimpleFieldSet fcpConfig = 
node.config.get("fcp").exportFieldSet(true);
+               SimpleFieldSet tmciConfig = 
node.config.get("console").exportFieldSet(true);
+               portInfoList.addChild("li", "FNP:\u00a0" + node.getFNPPort() + 
"/udp\u00a0\u00a0\u00a0(between nodes; this is usually the only port that you 
might want to port forward)");
+               try {
+                       if(fproxyConfig.getBoolean("enabled", false)) {
+                               portInfoList.addChild("li", "FProxy:\u00a0" + 
fproxyConfig.getInt("port") + "/tcp\u00a0\u00a0\u00a0(this web interface)");
+                       } else {
+                               portInfoList.addChild("li", 
"FProxy:\u00a0disabled/tcp\u00a0\u00a0\u00a0(this web interface)");
+                       }
+                       if(fcpConfig.getBoolean("enabled", false)) {
+                               portInfoList.addChild("li", "FCP:\u00a0" + 
fcpConfig.getInt("port") + "/tcp\u00a0\u00a0\u00a0(for Freenet clients such as 
Frost and Thaw)");
+                       } else {
+                               portInfoList.addChild("li", 
"FCP:\u00a0disabled/tcp\u00a0\u00a0\u00a0(for Freenet clients such as Frost and 
Thaw)");
+                       }
+                       if(tmciConfig.getBoolean("enabled", false)) {
+                               portInfoList.addChild("li", "TMCI:\u00a0" + 
tmciConfig.getInt("port") + "/tcp\u00a0\u00a0\u00a0(simple telnet-based 
command-line interface)");
+                       } else {
+                               portInfoList.addChild("li", 
"TMCI:\u00a0disabled/tcp\u00a0\u00a0\u00a0(simple telnet-based command-line 
interface)");
+                       }
+               } catch (FSParseException e) {
+                       // ignore
+               }
+               
                StringBuffer pageBuffer = new StringBuffer();
                pageNode.generate(pageBuffer);
                this.writeReply(ctx, 200, "text/html", "OK", 
pageBuffer.toString());

Modified: trunk/freenet/src/freenet/node/Node.java
===================================================================
--- trunk/freenet/src/freenet/node/Node.java    2006-11-19 19:44:39 UTC (rev 
11014)
+++ trunk/freenet/src/freenet/node/Node.java    2006-11-19 22:18:40 UTC (rev 
11015)
@@ -2619,6 +2619,10 @@
                return this.bindto;
        }

+       public int getFNPPort(){
+               return this.portNumber;
+       }
+       
        public int getIdentityHash(){
                return Fields.hashCode(identityHash);
        }


Reply via email to