forked from I2P_Developers/i2p.i2p
- countries.txt: Convert to mixed case, include in update - netdb.jsp: Hide all routers by default, sort and tag country names - oldstats.jsp: Move to stats.jsp - profiles.jsp: Show new DBH times instead of counts * Profiles: - Track last good and bad lookup times and last good and bad store times, to prep for floodfill changes - Don't reset last-heard-about at router startup * Checklist and Android readme fixups
50 lines
1.6 KiB
Java
50 lines
1.6 KiB
Java
package net.i2p.router.web;
|
|
|
|
import java.io.ByteArrayOutputStream;
|
|
import java.io.IOException;
|
|
import java.io.OutputStreamWriter;
|
|
|
|
|
|
public class NetDbHelper extends HelperBase {
|
|
private String _routerPrefix;
|
|
private int _full;
|
|
private boolean _lease = false;
|
|
|
|
public NetDbHelper() {}
|
|
|
|
public void setRouter(String r) { _routerPrefix = r; }
|
|
public void setFull(String f) {
|
|
try {
|
|
_full = Integer.parseInt(f);
|
|
} catch (NumberFormatException nfe) {}
|
|
}
|
|
public void setLease(String l) { _lease = "1".equals(l); }
|
|
|
|
public String getNetDbSummary() {
|
|
NetDbRenderer renderer = new NetDbRenderer(_context);
|
|
try {
|
|
if (_out != null) {
|
|
if (_routerPrefix != null)
|
|
renderer.renderRouterInfoHTML(_out, _routerPrefix);
|
|
else if (_lease)
|
|
renderer.renderLeaseSetHTML(_out);
|
|
else
|
|
renderer.renderStatusHTML(_out, _full);
|
|
return "";
|
|
} else {
|
|
ByteArrayOutputStream baos = new ByteArrayOutputStream(32*1024);
|
|
if (_routerPrefix != null)
|
|
renderer.renderRouterInfoHTML(new OutputStreamWriter(baos), _routerPrefix);
|
|
else if (_lease)
|
|
renderer.renderLeaseSetHTML(new OutputStreamWriter(baos));
|
|
else
|
|
renderer.renderStatusHTML(new OutputStreamWriter(baos), _full);
|
|
return new String(baos.toByteArray());
|
|
}
|
|
} catch (IOException ioe) {
|
|
ioe.printStackTrace();
|
|
return "";
|
|
}
|
|
}
|
|
}
|