I2P Address: [http://git.idk.i2p]

Skip to content
Snippets Groups Projects
Commit 9012baf5 authored by zzz's avatar zzz
Browse files

plugin links

parent 3c835579
No related branches found
No related tags found
No related merge requests found
package net.i2p.router.web; package net.i2p.router.web;
import java.util.HashMap;
import java.util.Iterator; import java.util.Iterator;
import java.util.Map; import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import net.i2p.I2PAppContext;
public class NavHelper extends HelperBase { public class NavHelper {
private static Map _apps = new HashMap(); private static Map<String, String> _apps = new ConcurrentHashMap();
public NavHelper() {}
/** /**
* To register a new client application so that it shows up on the router * To register a new client application so that it shows up on the router
...@@ -25,13 +24,17 @@ public class NavHelper extends HelperBase { ...@@ -25,13 +24,17 @@ public class NavHelper extends HelperBase {
_apps.remove(name); _apps.remove(name);
} }
public String getClientAppLinks() { /**
* Fixme, this translates with the router console bundle, not
* the plugin bundle
*/
public static String getClientAppLinks(I2PAppContext ctx) {
StringBuilder buf = new StringBuilder(1024); StringBuilder buf = new StringBuilder(1024);
for (Iterator iter = _apps.keySet().iterator(); iter.hasNext(); ) { for (Iterator<String> iter = _apps.keySet().iterator(); iter.hasNext(); ) {
String name = (String)iter.next(); String name = iter.next();
String path = (String)_apps.get(name); String path = _apps.get(name);
buf.append("<a href=\"").append(path).append("\">"); buf.append(" <a target=\"_top\" href=\"").append(path).append("\">");
buf.append(name).append("</a> |"); buf.append(Messages.getString(name, ctx)).append("</a>");
} }
return buf.toString(); return buf.toString();
} }
......
...@@ -131,6 +131,15 @@ public class PluginStarter implements Runnable { ...@@ -131,6 +131,15 @@ public class PluginStarter implements Runnable {
// add themes in console/themes // add themes in console/themes
// add summary bar link // add summary bar link
File pluginConfig = new File(pluginDir, "plugin.config");
if (pluginConfig.exists()) {
Properties props = new Properties();
DataHelper.loadProps(props, pluginConfig);
String name = props.getProperty("consoleLinkName");
String url = props.getProperty("consoleLinkURL");
if (name != null && url != null && name.length() > 0 && url.length() > 0)
NavHelper.registerApp(name, url);
}
return true; return true;
} }
......
...@@ -70,7 +70,11 @@ public class SummaryBarRenderer { ...@@ -70,7 +70,11 @@ public class SummaryBarRenderer {
.append(_("Anonymous resident webserver")) .append(_("Anonymous resident webserver"))
.append("\">") .append("\">")
.append(_("Webserver")) .append(_("Webserver"))
.append("</a></td></tr></table>\n" + .append("</a>")
.append(NavHelper.getClientAppLinks(_context))
.append("</td></tr></table>\n" +
"<hr><h3><a href=\"/config.jsp\" target=\"_top\" title=\"") "<hr><h3><a href=\"/config.jsp\" target=\"_top\" title=\"")
.append(_("Configure I2P Router")) .append(_("Configure I2P Router"))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment