forked from I2P_Developers/i2p.i2p
propagate from branch 'i2p.i2p.zzz.ipv6' (head 5c147c6e394fae03752dcf497923a90e3f2db529)
to branch 'i2p.i2p' (head 7af6987d5546664f76589afe0cbeeb780f4b5d58)
This commit is contained in:
@ -14,7 +14,7 @@ public class ConfigTunnelsHelper extends HelperBase {
|
||||
private static final String HOPS = ngettext("1 hop", "{0} hops");
|
||||
private static final String TUNNELS = ngettext("1 tunnel", "{0} tunnels");
|
||||
|
||||
private static final String PROP_ADVANCED = "routerconsole.advanced";
|
||||
static final String PROP_ADVANCED = "routerconsole.advanced";
|
||||
|
||||
public String getForm() {
|
||||
StringBuilder buf = new StringBuilder(1024);
|
||||
|
@ -1,6 +1,9 @@
|
||||
package net.i2p.router.web;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.Reader;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
|
||||
@ -8,6 +11,7 @@ import net.i2p.data.DataHelper;
|
||||
import net.i2p.router.RouterContext;
|
||||
import net.i2p.router.update.ConsoleUpdateManager;
|
||||
import static net.i2p.update.UpdateType.*;
|
||||
import net.i2p.util.TranslateReader;
|
||||
|
||||
/**
|
||||
* If news file does not exist, use file from the initialNews directory
|
||||
@ -138,11 +142,36 @@ public class NewsHelper extends ContentHelper {
|
||||
return mgr.getStatus();
|
||||
}
|
||||
|
||||
private static final String BUNDLE_NAME = "net.i2p.router.news.messages";
|
||||
|
||||
/**
|
||||
* If we haven't downloaded news yet, use the translated initial news file
|
||||
*/
|
||||
@Override
|
||||
public String getContent() {
|
||||
File news = new File(_page);
|
||||
if (!news.exists())
|
||||
if (!news.exists()) {
|
||||
_page = (new File(_context.getBaseDir(), "docs/initialNews/initialNews.xml")).getAbsolutePath();
|
||||
// don't use super, translate on-the-fly
|
||||
Reader reader = null;
|
||||
try {
|
||||
char[] buf = new char[512];
|
||||
StringBuilder out = new StringBuilder(2048);
|
||||
reader = new TranslateReader(_context, BUNDLE_NAME, new FileInputStream(_page));
|
||||
int len;
|
||||
while((len = reader.read(buf)) > 0) {
|
||||
out.append(buf, 0, len);
|
||||
}
|
||||
return out.toString();
|
||||
} catch (IOException ioe) {
|
||||
return "";
|
||||
} finally {
|
||||
try {
|
||||
if (reader != null)
|
||||
reader.close();
|
||||
} catch (IOException foo) {}
|
||||
}
|
||||
}
|
||||
return super.getContent();
|
||||
}
|
||||
|
||||
|
@ -763,7 +763,7 @@ public class PluginStarter implements Runnable {
|
||||
/**
|
||||
* Returns <code>true</code> if one or more client threads are running in a given plugin.
|
||||
* @param pluginName
|
||||
* @return
|
||||
* @return true if running
|
||||
*/
|
||||
private static boolean isClientThreadRunning(String pluginName) {
|
||||
ThreadGroup group = pluginThreadGroups.get(pluginName);
|
||||
|
@ -39,8 +39,12 @@ public class TunnelRenderer {
|
||||
Map<Hash, TunnelPool> clientInboundPools = _context.tunnelManager().getInboundClientPools();
|
||||
Map<Hash, TunnelPool> clientOutboundPools = _context.tunnelManager().getOutboundClientPools();
|
||||
destinations = new ArrayList(clientInboundPools.keySet());
|
||||
boolean debug = _context.getBooleanProperty(ConfigTunnelsHelper.PROP_ADVANCED);
|
||||
for (int i = 0; i < destinations.size(); i++) {
|
||||
Hash client = destinations.get(i);
|
||||
boolean isLocal = _context.clientManager().isLocal(client);
|
||||
if ((!isLocal) && (!debug))
|
||||
continue;
|
||||
TunnelPool in = null;
|
||||
TunnelPool outPool = null;
|
||||
in = clientInboundPools.get(client);
|
||||
@ -53,7 +57,7 @@ public class TunnelRenderer {
|
||||
name = client.toBase64().substring(0,4);
|
||||
out.write("<h2><a name=\"" + client.toBase64().substring(0,4)
|
||||
+ "\" ></a>" + _("Client tunnels for") + ' ' + _(name));
|
||||
if (_context.clientManager().isLocal(client))
|
||||
if (isLocal)
|
||||
out.write(" (<a href=\"/configtunnels#" + client.toBase64().substring(0,4) +"\">" + _("configure") + "</a>)</h2>\n");
|
||||
else
|
||||
out.write(" (" + _("dead") + ")</h2>\n");
|
||||
|
Reference in New Issue
Block a user