forked from I2P_Developers/i2p.i2p
* Console: Hide iframe on mobile browsers
* DataHelper: Speed up eq() (Ticket #437) * HTTPServer: Strip inbound X-Accept-Encoding header * netdb.jsp: HTML fixes * Plugins: Log error when console server not found * Reseed: Log tweak
This commit is contained in:
@ -111,6 +111,9 @@ public class Storage
|
||||
lengthsList.add(Long.valueOf(length));
|
||||
}
|
||||
|
||||
if (total <= 0)
|
||||
throw new IOException("Torrent contains no data");
|
||||
|
||||
int pc_size = MIN_PIECE_SIZE;
|
||||
int pcs = (int) ((total - 1)/pc_size) + 1;
|
||||
while (pcs > MAX_PIECES && pc_size < MAX_PIECE_SIZE)
|
||||
|
@ -138,9 +138,11 @@ public class I2PTunnelHTTPServer extends I2PTunnelServer {
|
||||
}
|
||||
if (_log.shouldLog(Log.INFO))
|
||||
_log.info("HTTP server encoding header: " + enc + "/" + altEnc);
|
||||
boolean useGZIP = ( (enc != null) && (enc.indexOf("x-i2p-gzip") >= 0) );
|
||||
if ( (!useGZIP) && (altEnc != null) && (altEnc.indexOf("x-i2p-gzip") >= 0) )
|
||||
useGZIP = true;
|
||||
boolean alt = (altEnc != null) && (altEnc.indexOf("x-i2p-gzip") >= 0);
|
||||
boolean useGZIP = alt || ( (enc != null) && (enc.indexOf("x-i2p-gzip") >= 0) );
|
||||
// Don't pass this on, outproxies should strip so I2P traffic isn't so obvious but they probably don't
|
||||
if (alt)
|
||||
headers.remove("X-Accept-encoding");
|
||||
|
||||
if (allowGZIP && useGZIP) {
|
||||
I2PAppThread req = new I2PAppThread(
|
||||
|
@ -69,8 +69,26 @@ public class CSSHelper extends HelperBase {
|
||||
* @since 0.8.5
|
||||
*/
|
||||
public boolean allowIFrame(String ua) {
|
||||
return ua == null || !(ua.startsWith("Lynx") || ua.startsWith("w3m") ||
|
||||
return ua == null ||
|
||||
// text
|
||||
!(ua.startsWith("Lynx") || ua.startsWith("w3m") ||
|
||||
ua.startsWith("ELinks") || ua.startsWith("Links") ||
|
||||
ua.startsWith("Dillo"));
|
||||
ua.startsWith("Dillo") ||
|
||||
// mobile
|
||||
// http://www.zytrax.com/tech/web/mobile_ids.html
|
||||
ua.contains("Android") || ua.contains("iPhone") ||
|
||||
ua.contains("iPod") || ua.contains("iPad") ||
|
||||
ua.contains("Kindle") || ua.contains("Mobile") ||
|
||||
ua.contains("Nintendo Wii") || ua.contains("Opera Mini") ||
|
||||
ua.contains("Palm") ||
|
||||
ua.contains("PLAYSTATION") || ua.contains("Playstation") ||
|
||||
ua.contains("Profile/MIDP-") || ua.contains("SymbianOS") ||
|
||||
ua.contains("Windows CE") || ua.contains("Windows Phone") ||
|
||||
ua.startsWith("BlackBerry") || ua.startsWith("DoCoMo") ||
|
||||
ua.startsWith("Nokia") || ua.startsWith("OPWV-SDK") ||
|
||||
ua.startsWith("MOT-") || ua.startsWith("SAMSUNG-") ||
|
||||
ua.startsWith("nook") || ua.startsWith("SCH-") ||
|
||||
ua.startsWith("SEC-") || ua.startsWith("SonyEricsson") ||
|
||||
ua.startsWith("Vodafone"));
|
||||
}
|
||||
}
|
||||
|
@ -24,7 +24,6 @@ import java.util.Properties;
|
||||
import java.util.Set;
|
||||
import java.util.TreeSet;
|
||||
|
||||
import net.i2p.crypto.TrustedUpdate;
|
||||
import net.i2p.data.DataHelper;
|
||||
import net.i2p.data.Destination;
|
||||
import net.i2p.data.Hash;
|
||||
@ -174,18 +173,19 @@ public class NetDbRenderer {
|
||||
}
|
||||
if (debug) {
|
||||
buf.append("<p><b>Total Leasesets: " + leases.size());
|
||||
buf.append("<p><b>Published (RAP) Leasesets: " + _context.netDb().getKnownLeaseSets());
|
||||
buf.append("<p>Mod Data: " + HexDump.dump(_context.routingKeyGenerator().getModData()) + "<p>");
|
||||
buf.append("<p>Network data (only valid if floodfill):");
|
||||
buf.append("<p>Center of Key Space (router hash): " + ourRKey.toBase64() + "<p>");
|
||||
buf.append("</b></p><p><b>Published (RAP) Leasesets: " + _context.netDb().getKnownLeaseSets());
|
||||
buf.append("</b></p><p><b>Mod Data: " + HexDump.dump(_context.routingKeyGenerator().getModData()));
|
||||
buf.append("</b></p><p><b>Network data (only valid if floodfill):");
|
||||
buf.append("</b></p><p><b>Center of Key Space (router hash): " + ourRKey.toBase64());
|
||||
if (median != null) {
|
||||
double log2 = biLog2(median);
|
||||
buf.append("<p>Median distance (bits): " + fmt.format(log2));
|
||||
buf.append("</b></p><p><b>Median distance (bits): " + fmt.format(log2));
|
||||
// 3 for 8 floodfills... -1 for median
|
||||
int total = (int) Math.round(Math.pow(2, 3 + 256 - 1 - log2));
|
||||
buf.append("<p>Estimated total floodfills: " + total);
|
||||
buf.append("<p>Estimated network total leasesets: " + (total * leases.size() / 8));
|
||||
buf.append("</b></p><p><b>Estimated total floodfills: " + total);
|
||||
buf.append("</b></p><p><b>Estimated network total leasesets: " + (total * leases.size() / 8));
|
||||
}
|
||||
buf.append("</b></p>");
|
||||
}
|
||||
out.write(buf.toString());
|
||||
out.flush();
|
||||
@ -405,11 +405,10 @@ public class NetDbRenderer {
|
||||
/**
|
||||
* what transport types
|
||||
*/
|
||||
private int classifyTransports(RouterInfo info) {
|
||||
private static int classifyTransports(RouterInfo info) {
|
||||
int rv = 0;
|
||||
String hash = info.getIdentity().getHash().toBase64();
|
||||
for (Iterator iter = info.getAddresses().iterator(); iter.hasNext(); ) {
|
||||
RouterAddress addr = (RouterAddress)iter.next();
|
||||
for (RouterAddress addr : info.getAddresses()) {
|
||||
String style = addr.getTransportStyle();
|
||||
if (style.equals("NTCP")) {
|
||||
rv |= NTCP;
|
||||
|
@ -95,7 +95,8 @@ public class PluginStarter implements Runnable {
|
||||
log.error("Cannot start nonexistent plugin: " + appName);
|
||||
return false;
|
||||
}
|
||||
//log.error("Starting plugin: " + appName);
|
||||
if (log.shouldLog(Log.INFO))
|
||||
log.info("Starting plugin: " + appName);
|
||||
|
||||
// register themes
|
||||
File dir = new File(pluginDir, "console/themes");
|
||||
@ -139,7 +140,8 @@ public class PluginStarter implements Runnable {
|
||||
}
|
||||
String enabled = props.getProperty(RouterConsoleRunner.PREFIX + warName + ENABLED);
|
||||
if (! "false".equals(enabled)) {
|
||||
//log.error("Starting webapp: " + warName);
|
||||
if (log.shouldLog(Log.INFO))
|
||||
log.info("Starting webapp: " + warName);
|
||||
String path = new File(webappDir, fileNames[i]).getCanonicalPath();
|
||||
WebAppStarter.startWebApp(ctx, server, warName, path);
|
||||
pluginWars.get(appName).add(warName);
|
||||
@ -149,6 +151,8 @@ public class PluginStarter implements Runnable {
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
log.error("No console web server to start plugins?");
|
||||
}
|
||||
|
||||
// add translation jars in console/locale
|
||||
|
@ -781,11 +781,10 @@ public class DataHelper {
|
||||
* This treats (null == null) as true, (null == (!null)) as false,
|
||||
* and unequal length arrays as false.
|
||||
*
|
||||
* @return Arrays.equals(lhs, rhs)
|
||||
*/
|
||||
public final static boolean eq(byte lhs[], byte rhs[]) {
|
||||
// this appears to be the way Arrays.equals is defined, so all the extra tests are unnecessary?
|
||||
boolean eq = (((lhs == null) && (rhs == null)) || ((lhs != null) && (rhs != null) && (Arrays.equals(lhs, rhs))));
|
||||
return eq;
|
||||
return Arrays.equals(lhs, rhs);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1,3 +1,11 @@
|
||||
2011-04-11 zzz
|
||||
* Console: Hide iframe on mobile browsers
|
||||
* DataHelper: Speed up eq() (Ticket #437)
|
||||
* HTTPServer: Strip inbound X-Accept-Encoding header
|
||||
* netdb.jsp: HTML fixes
|
||||
* Plugins: Log error when console server not found
|
||||
* Reseed: Log tweak
|
||||
|
||||
2011-04-02 m1xxy
|
||||
* routerconsole, i2psnark, ... I2P ahora también en español: ¡Bienvenidos los hispanohablantes!
|
||||
- routerconsole, i2ptunnel, i2psnark, SusiDNS, Susimail fully translated into Spanish
|
||||
|
@ -18,7 +18,7 @@ public class RouterVersion {
|
||||
/** deprecated */
|
||||
public final static String ID = "Monotone";
|
||||
public final static String VERSION = CoreVersion.VERSION;
|
||||
public final static long BUILD = 8;
|
||||
public final static long BUILD = 9;
|
||||
|
||||
/** for example "-test" */
|
||||
public final static String EXTRA = "";
|
||||
|
@ -35,9 +35,9 @@ public class ReseedChecker {
|
||||
if (!noReseedFile.exists() && !noReseedFileAlt1.exists() && !noReseedFileAlt2.exists() && !noReseedFileAlt3.exists()) {
|
||||
Log _log = context.logManager().getLog(ReseedChecker.class);
|
||||
if (count <= 1)
|
||||
_log.error("Downloading peer router information for a new I2P installation");
|
||||
_log.logAlways(Log.INFO, "Downloading peer router information for a new I2P installation");
|
||||
else
|
||||
_log.error("Very few routerInfo files remaining - reseeding now");
|
||||
_log.logAlways(Log.WARN, "Very few known peers remaining - reseeding now");
|
||||
Reseeder reseeder = new Reseeder(context);
|
||||
reseeder.requestReseed();
|
||||
}
|
||||
|
Reference in New Issue
Block a user