forked from I2P_Developers/i2p.i2p
propagate from branch 'i2p.i2p' (head d2198c4bc21a9d06194cdb2dce24945ebc9d1542)
to branch 'i2p.i2p.zzz.dhtsnark' (head 59fc0206608a5d1323a0acfbcb151d862fe95f95)
This commit is contained in:
@ -23,8 +23,9 @@ trans.ar = apps/routerconsole/locale/messages_ar.po
|
||||
trans.cs = apps/routerconsole/locale/messages_cs.po
|
||||
trans.da = apps/routerconsole/locale/messages_da.po
|
||||
trans.de = apps/routerconsole/locale/messages_de.po
|
||||
trans.et_EE = apps/routerconsole/locale/messages_ee.po
|
||||
trans.el = apps/routerconsole/locale/messages_el.po
|
||||
trans.es = apps/routerconsole/locale/messages_es.po
|
||||
trans.et_EE = apps/routerconsole/locale/messages_ee.po
|
||||
trans.fi = apps/routerconsole/locale/messages_fi.po
|
||||
trans.fr = apps/routerconsole/locale/messages_fr.po
|
||||
trans.hu = apps/routerconsole/locale/messages_hu.po
|
||||
@ -62,6 +63,7 @@ trans.ar = apps/susidns/locale/messages_ar.po
|
||||
trans.cs = apps/susidns/locale/messages_cs.po
|
||||
trans.da = apps/susidns/locale/messages_da.po
|
||||
trans.de = apps/susidns/locale/messages_de.po
|
||||
trans.el = apps/susidns/locale/messages_el.po
|
||||
trans.es = apps/susidns/locale/messages_es.po
|
||||
trans.fr = apps/susidns/locale/messages_fr.po
|
||||
trans.hu = apps/susidns/locale/messages_hu.po
|
||||
@ -81,6 +83,7 @@ trans.ar = apps/desktopgui/locale/messages_ar.po
|
||||
trans.cs = apps/desktopgui/locale/messages_cs.po
|
||||
trans.da = apps/desktopgui/locale/messages_da.po
|
||||
trans.de = apps/desktopgui/locale/messages_de.po
|
||||
trans.el = apps/desktopgui/locale/messages_el.po
|
||||
trans.es = apps/desktopgui/locale/messages_es.po
|
||||
trans.fr = apps/desktopgui/locale/messages_fr.po
|
||||
trans.hu = apps/desktopgui/locale/messages_hu.po
|
||||
@ -115,6 +118,7 @@ source_file = debian/po/templates.pot
|
||||
source_lang = en
|
||||
trans.cs = debian/po/cs.po
|
||||
trans.de = debian/po/de.po
|
||||
trans.el = debian/po/el.po
|
||||
trans.es = debian/po/es.po
|
||||
trans.it = debian/po/it.po
|
||||
trans.hu = debian/po/hu.po
|
||||
|
@ -197,6 +197,7 @@ Applications:
|
||||
- Guernsey and Isle of Man flags from the Open Clip Art Library, released into the public domain
|
||||
- All other flag icons: public domain, courtesy mjames@gmail.com http://www.famfamfam.com/
|
||||
Silk icons: See licenses/LICENSE-SilkIcons.txt
|
||||
FatCow icons: See licenses/LICENSE-FatCowIcons.txt
|
||||
|
||||
GeoIP Data:
|
||||
Copyright (c) 2008 MaxMind, Inc. All Rights Reserved.
|
||||
@ -206,6 +207,10 @@ Applications:
|
||||
"Man with hat over face" & related images licensed under a Creative Commons 2.0 license.
|
||||
Original photos by Florian Kuhlmann. http://www.flickr.com/photos/floriankuhlmann/3117758155
|
||||
|
||||
I2PSnark light theme:
|
||||
"Creative Commons Cat" licensed under a Creative Commons Attribution 3.0 Unported License.
|
||||
Original photo by Boaz Arad. http://www.luxphile.com/2011/01/creative-commons-cat.html
|
||||
|
||||
SAM:
|
||||
Public domain.
|
||||
|
||||
|
@ -115,7 +115,6 @@ import net.i2p.util.SimpleTimer2;
|
||||
*/
|
||||
public class BOB {
|
||||
|
||||
private final static Log _log = new Log(BOB.class);
|
||||
public final static String PROP_CONFIG_LOCATION = "BOB.config";
|
||||
public final static String PROP_BOB_PORT = "BOB.port";
|
||||
public final static String PROP_BOB_HOST = "BOB.host";
|
||||
@ -137,7 +136,7 @@ public class BOB {
|
||||
*/
|
||||
public static void info(String arg) {
|
||||
System.out.println("INFO:" + arg);
|
||||
_log.info(arg);
|
||||
(new Log(BOB.class)).info(arg);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -147,7 +146,7 @@ public class BOB {
|
||||
*/
|
||||
public static void warn(String arg) {
|
||||
System.out.println("WARNING:" + arg);
|
||||
_log.warn(arg);
|
||||
(new Log(BOB.class)).warn(arg);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -157,7 +156,7 @@ public class BOB {
|
||||
*/
|
||||
public static void error(String arg) {
|
||||
System.out.println("ERROR: " + arg);
|
||||
_log.error(arg);
|
||||
(new Log(BOB.class)).error(arg);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -185,6 +184,7 @@ public class BOB {
|
||||
SimpleTimer2 Y2 = SimpleTimer2.getInstance();
|
||||
i = Y1.hashCode();
|
||||
i = Y2.hashCode();
|
||||
Log _log = new Log(BOB.class);
|
||||
try {
|
||||
{
|
||||
File cfg = new File(configLocation);
|
||||
@ -260,6 +260,7 @@ public class BOB {
|
||||
|
||||
i = 0;
|
||||
boolean g = false;
|
||||
spin.set(true);
|
||||
try {
|
||||
info("BOB is now running.");
|
||||
listener = new ServerSocket(Integer.parseInt(props.getProperty(PROP_BOB_PORT)), 10, InetAddress.getByName(props.getProperty(PROP_BOB_HOST)));
|
||||
|
@ -54,7 +54,7 @@ public class DoCMDS implements Runnable {
|
||||
|
||||
// FIX ME
|
||||
// I need a better way to do versioning, but this will do for now.
|
||||
public static final String BMAJ = "00", BMIN = "00", BREV = "0F", BEXT = "";
|
||||
public static final String BMAJ = "00", BMIN = "00", BREV = "10", BEXT = "";
|
||||
public static final String BOBversion = BMAJ + "." + BMIN + "." + BREV + BEXT;
|
||||
private Socket server;
|
||||
private Properties props;
|
||||
|
56
apps/desktopgui/locale/messages_el.po
Normal file
56
apps/desktopgui/locale/messages_el.po
Normal file
@ -0,0 +1,56 @@
|
||||
# I2P
|
||||
# Copyright (C) 2009 The I2P Project
|
||||
# This file is distributed under the same license as the desktopgui package.
|
||||
# To contribute translations, see http://www.i2p2.de/newdevelopers
|
||||
#
|
||||
# Translators:
|
||||
# <lixtetrax@grhack.net>, 2012.
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: I2P\n"
|
||||
"Report-Msgid-Bugs-To: https://trac.i2p2.de/\n"
|
||||
"POT-Creation-Date: 2011-03-03 18:29+0000\n"
|
||||
"PO-Revision-Date: 2012-07-02 11:28+0000\n"
|
||||
"Last-Translator: lixtetrax <lixtetrax@grhack.net>\n"
|
||||
"Language-Team: Greek (http://www.transifex.com/projects/p/I2P/language/el/)\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"Language: el\n"
|
||||
"Plural-Forms: nplurals=2; plural=(n != 1)\n"
|
||||
|
||||
#: src/net/i2p/desktopgui/ExternalTrayManager.java:23
|
||||
msgid "Start I2P"
|
||||
msgstr "Έναρξη Ι2Ρ"
|
||||
|
||||
#: src/net/i2p/desktopgui/ExternalTrayManager.java:38
|
||||
msgid "I2P is starting!"
|
||||
msgstr "Το Ι2Ρ ξεκίνησε!"
|
||||
|
||||
#: src/net/i2p/desktopgui/ExternalTrayManager.java:38
|
||||
msgid "Starting"
|
||||
msgstr "Έναρξη"
|
||||
|
||||
#: src/net/i2p/desktopgui/InternalTrayManager.java:26
|
||||
msgid "Launch I2P Browser"
|
||||
msgstr "Έναρξη φυλλομετρητή Ι2Ρ"
|
||||
|
||||
#: src/net/i2p/desktopgui/InternalTrayManager.java:50
|
||||
msgid "Configure desktopgui"
|
||||
msgstr "Παραμετροποίηση desktopgui"
|
||||
|
||||
#: src/net/i2p/desktopgui/InternalTrayManager.java:67
|
||||
msgid "Restart I2P"
|
||||
msgstr "Επανεκκίνηση Ι2Ρ"
|
||||
|
||||
#: src/net/i2p/desktopgui/InternalTrayManager.java:85
|
||||
msgid "Stop I2P"
|
||||
msgstr "Τερματισμός Ι2Ρ"
|
||||
|
||||
#: src/net/i2p/desktopgui/gui/DesktopguiConfigurationFrame.java:44
|
||||
msgid "Tray icon configuration"
|
||||
msgstr "Παραμετροποίηση εικονιδίου"
|
||||
|
||||
#: src/net/i2p/desktopgui/gui/DesktopguiConfigurationFrame.java:47
|
||||
msgid "Should tray icon be enabled?"
|
||||
msgstr "Ενεργοποίηση εικονιδίου;"
|
Binary file not shown.
Before Width: | Height: | Size: 379 B |
BIN
apps/i2psnark/icons/basket_put.png
Normal file
BIN
apps/i2psnark/icons/basket_put.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 733 B |
@ -67,7 +67,7 @@ public class ConnectionAcceptor implements Runnable
|
||||
thread = new I2PAppThread(this, "I2PSnark acceptor");
|
||||
thread.setDaemon(true);
|
||||
thread.start();
|
||||
SimpleScheduler.getInstance().addPeriodicEvent(new Cleaner(), BAD_CLEAN_INTERVAL);
|
||||
_util.getContext().simpleScheduler().addPeriodicEvent(new Cleaner(), BAD_CLEAN_INTERVAL);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -82,7 +82,7 @@ public class ConnectionAcceptor implements Runnable
|
||||
thread = new I2PAppThread(this, "I2PSnark acceptor");
|
||||
thread.setDaemon(true);
|
||||
thread.start();
|
||||
SimpleScheduler.getInstance().addPeriodicEvent(new Cleaner(), BAD_CLEAN_INTERVAL);
|
||||
_util.getContext().simpleScheduler().addPeriodicEvent(new Cleaner(), BAD_CLEAN_INTERVAL);
|
||||
}
|
||||
|
||||
public void halt()
|
||||
@ -146,7 +146,7 @@ public class ConnectionAcceptor implements Runnable
|
||||
}
|
||||
} else {
|
||||
if (socket.getPeerDestination().equals(_util.getMyDestination())) {
|
||||
_util.debug("Incoming connection from myself", Snark.ERROR);
|
||||
_log.error("Incoming connection from myself");
|
||||
try { socket.close(); } catch (IOException ioe) {}
|
||||
continue;
|
||||
}
|
||||
@ -163,13 +163,13 @@ public class ConnectionAcceptor implements Runnable
|
||||
catch (I2PException ioe)
|
||||
{
|
||||
if (!socketChanged) {
|
||||
_util.debug("Error while accepting: " + ioe, Snark.ERROR);
|
||||
_log.error("Error while accepting", ioe);
|
||||
stop = true;
|
||||
}
|
||||
}
|
||||
catch (IOException ioe)
|
||||
{
|
||||
_util.debug("Error while accepting: " + ioe, Snark.ERROR);
|
||||
_log.error("Error while accepting", ioe);
|
||||
stop = true;
|
||||
}
|
||||
// catch oom?
|
||||
|
@ -124,6 +124,9 @@ public class I2PSnarkUtil {
|
||||
}
|
||||
******/
|
||||
|
||||
/** @since 0.9.1 */
|
||||
public I2PAppContext getContext() { return _context; }
|
||||
|
||||
public boolean configured() { return _configured; }
|
||||
|
||||
public void setI2CPConfig(String i2cpHost, int i2cpPort, Map opts) {
|
||||
@ -314,7 +317,7 @@ public class I2PSnarkUtil {
|
||||
return rv;
|
||||
} catch (I2PException ie) {
|
||||
_shitlist.add(dest);
|
||||
SimpleScheduler.getInstance().addEvent(new Unshitlist(dest), 10*60*1000);
|
||||
_context.simpleScheduler().addEvent(new Unshitlist(dest), 10*60*1000);
|
||||
throw new IOException("Unable to reach the peer " + peer + ": " + ie.getMessage());
|
||||
}
|
||||
}
|
||||
@ -560,40 +563,6 @@ public class I2PSnarkUtil {
|
||||
return buf.toString();
|
||||
}
|
||||
|
||||
/** hook between snark's logger and an i2p log */
|
||||
void debug(String msg, int snarkDebugLevel) {
|
||||
debug(msg, snarkDebugLevel, null);
|
||||
}
|
||||
void debug(String msg, int snarkDebugLevel, Throwable t) {
|
||||
if (t instanceof OutOfMemoryError) {
|
||||
try { Thread.sleep(100); } catch (InterruptedException ie) {}
|
||||
try {
|
||||
t.printStackTrace();
|
||||
} catch (Throwable tt) {}
|
||||
try {
|
||||
System.out.println("OOM thread: " + Thread.currentThread().getName());
|
||||
} catch (Throwable tt) {}
|
||||
}
|
||||
switch (snarkDebugLevel) {
|
||||
case 0:
|
||||
case 1:
|
||||
_log.error(msg, t);
|
||||
break;
|
||||
case 2:
|
||||
_log.warn(msg, t);
|
||||
break;
|
||||
case 3:
|
||||
case 4:
|
||||
_log.info(msg, t);
|
||||
break;
|
||||
case 5:
|
||||
case 6:
|
||||
default:
|
||||
_log.debug(msg, t);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private static final String BUNDLE_NAME = "org.klomp.snark.web.messages";
|
||||
|
||||
/** lang in routerconsole.lang property, else current locale */
|
||||
|
@ -5,10 +5,10 @@ import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
|
||||
import net.i2p.I2PAppContext;
|
||||
import net.i2p.data.DataHelper;
|
||||
import net.i2p.util.RandomSource;
|
||||
|
||||
import org.klomp.snark.bencode.BDecoder;
|
||||
import org.klomp.snark.bencode.BEValue;
|
||||
@ -27,7 +27,6 @@ import org.klomp.snark.bencode.BEValue;
|
||||
*/
|
||||
class MagnetState {
|
||||
public static final int CHUNK_SIZE = 16*1024;
|
||||
private static final Random random = I2PAppContext.getGlobalContext().random();
|
||||
|
||||
private final byte[] infohash;
|
||||
private boolean complete;
|
||||
@ -129,7 +128,7 @@ class MagnetState {
|
||||
throw new IllegalArgumentException("not initialized");
|
||||
if (complete)
|
||||
throw new IllegalArgumentException("complete");
|
||||
int rand = random.nextInt(totalChunks);
|
||||
int rand = RandomSource.getInstance().nextInt(totalChunks);
|
||||
for (int i = 0; i < totalChunks; i++) {
|
||||
int chk = (i + rand) % totalChunks;
|
||||
if (!(have.get(chk) || requested.get(chk))) {
|
||||
|
@ -25,6 +25,8 @@ import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import net.i2p.I2PAppContext;
|
||||
import net.i2p.data.DataHelper;
|
||||
import net.i2p.util.Log;
|
||||
|
||||
/**
|
||||
* TimerTask that checks for good/bad up/downloader. Works together
|
||||
@ -36,16 +38,18 @@ class PeerCheckerTask implements Runnable
|
||||
|
||||
private final PeerCoordinator coordinator;
|
||||
private final I2PSnarkUtil _util;
|
||||
private final Log _log;
|
||||
private final Random random;
|
||||
private int _runCount;
|
||||
|
||||
PeerCheckerTask(I2PSnarkUtil util, PeerCoordinator coordinator)
|
||||
{
|
||||
_util = util;
|
||||
_log = util.getContext().logManager().getLog(PeerCheckerTask.class);
|
||||
random = util.getContext().random();
|
||||
this.coordinator = coordinator;
|
||||
}
|
||||
|
||||
private static final Random random = I2PAppContext.getGlobalContext().random();
|
||||
|
||||
public void run()
|
||||
{
|
||||
_runCount++;
|
||||
@ -82,6 +86,14 @@ class PeerCheckerTask implements Runnable
|
||||
continue;
|
||||
}
|
||||
|
||||
if (peer.getInactiveTime() > PeerCoordinator.MAX_INACTIVE) {
|
||||
if (_log.shouldLog(Log.WARN))
|
||||
_log.warn("Disconnecting peer idle " +
|
||||
DataHelper.formatDuration(peer.getInactiveTime()) + ": " + peer);
|
||||
peer.disconnect();
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!peer.isChoking())
|
||||
uploaders++;
|
||||
|
||||
@ -92,14 +104,15 @@ class PeerCheckerTask implements Runnable
|
||||
peer.setRateHistory(upload, download);
|
||||
peer.resetCounters();
|
||||
|
||||
_util.debug(peer + ":", Snark.DEBUG);
|
||||
_util.debug(" ul: " + upload*1024/KILOPERSECOND
|
||||
if (_log.shouldLog(Log.DEBUG)) {
|
||||
_log.debug(peer + ":"
|
||||
+ " ul: " + upload*1024/KILOPERSECOND
|
||||
+ " dl: " + download*1024/KILOPERSECOND
|
||||
+ " i: " + peer.isInterested()
|
||||
+ " I: " + peer.isInteresting()
|
||||
+ " c: " + peer.isChoking()
|
||||
+ " C: " + peer.isChoked(),
|
||||
Snark.DEBUG);
|
||||
+ " C: " + peer.isChoked());
|
||||
}
|
||||
|
||||
// Choke a percentage of them rather than all so it isn't so drastic...
|
||||
// unless this torrent is over the limit all by itself.
|
||||
@ -120,8 +133,8 @@ class PeerCheckerTask implements Runnable
|
||||
// Check if it still wants pieces from us.
|
||||
if (!peer.isInterested())
|
||||
{
|
||||
_util.debug("Choke uninterested peer: " + peer,
|
||||
Snark.INFO);
|
||||
if (_log.shouldLog(Log.DEBUG))
|
||||
_log.debug("Choke uninterested peer: " + peer);
|
||||
peer.setChoking(true);
|
||||
uploaders--;
|
||||
coordinator.uploaders--;
|
||||
@ -131,8 +144,8 @@ class PeerCheckerTask implements Runnable
|
||||
}
|
||||
else if (overBWLimitChoke)
|
||||
{
|
||||
_util.debug("BW limit (" + upload + "/" + uploaded + "), choke peer: " + peer,
|
||||
Snark.INFO);
|
||||
if (_log.shouldLog(Log.DEBUG))
|
||||
_log.debug("BW limit (" + upload + "/" + uploaded + "), choke peer: " + peer);
|
||||
peer.setChoking(true);
|
||||
uploaders--;
|
||||
coordinator.uploaders--;
|
||||
@ -144,7 +157,8 @@ class PeerCheckerTask implements Runnable
|
||||
else if (peer.isInteresting() && peer.isChoked())
|
||||
{
|
||||
// If they are choking us make someone else a downloader
|
||||
_util.debug("Choke choking peer: " + peer, Snark.DEBUG);
|
||||
if (_log.shouldLog(Log.DEBUG))
|
||||
_log.debug("Choke choking peer: " + peer);
|
||||
peer.setChoking(true);
|
||||
uploaders--;
|
||||
coordinator.uploaders--;
|
||||
@ -156,7 +170,8 @@ class PeerCheckerTask implements Runnable
|
||||
else if (!peer.isInteresting() && !coordinator.completed())
|
||||
{
|
||||
// If they aren't interesting make someone else a downloader
|
||||
_util.debug("Choke uninteresting peer: " + peer, Snark.DEBUG);
|
||||
if (_log.shouldLog(Log.DEBUG))
|
||||
_log.debug("Choke uninteresting peer: " + peer);
|
||||
peer.setChoking(true);
|
||||
uploaders--;
|
||||
coordinator.uploaders--;
|
||||
@ -170,8 +185,8 @@ class PeerCheckerTask implements Runnable
|
||||
&& download == 0)
|
||||
{
|
||||
// We are downloading but didn't receive anything...
|
||||
_util.debug("Choke downloader that doesn't deliver:"
|
||||
+ peer, Snark.DEBUG);
|
||||
if (_log.shouldLog(Log.DEBUG))
|
||||
_log.debug("Choke downloader that doesn't deliver: " + peer);
|
||||
peer.setChoking(true);
|
||||
uploaders--;
|
||||
coordinator.uploaders--;
|
||||
@ -198,6 +213,9 @@ class PeerCheckerTask implements Runnable
|
||||
// send PEX
|
||||
if ((_runCount % 17) == 0 && !peer.isCompleted())
|
||||
coordinator.sendPeers(peer);
|
||||
// cheap failsafe for seeds connected to seeds, stop pinging and hopefully
|
||||
// the inactive checker (above) will eventually disconnect it
|
||||
if (coordinator.getNeededLength() > 0 || !peer.isCompleted())
|
||||
peer.keepAlive();
|
||||
// announce them to local tracker (TrackerClient does this too)
|
||||
if (_util.getDHT() != null && (_runCount % 5) == 0) {
|
||||
@ -215,8 +233,8 @@ class PeerCheckerTask implements Runnable
|
||||
|| uploaders > uploadLimit)
|
||||
&& worstDownloader != null)
|
||||
{
|
||||
_util.debug("Choke worst downloader: " + worstDownloader,
|
||||
Snark.DEBUG);
|
||||
if (_log.shouldLog(Log.DEBUG))
|
||||
_log.debug("Choke worst downloader: " + worstDownloader);
|
||||
|
||||
worstDownloader.setChoking(true);
|
||||
coordinator.uploaders--;
|
||||
|
@ -22,6 +22,7 @@ package org.klomp.snark;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.Iterator;
|
||||
@ -68,6 +69,7 @@ class PeerCoordinator implements PeerListener
|
||||
// package local for access by CheckDownLoadersTask
|
||||
final static long CHECK_PERIOD = 40*1000; // 40 seconds
|
||||
final static int MAX_UPLOADERS = 6;
|
||||
public static final long MAX_INACTIVE = 8*60*1000;
|
||||
|
||||
/**
|
||||
* Approximation of the number of current uploaders.
|
||||
@ -130,7 +132,7 @@ class PeerCoordinator implements PeerListener
|
||||
private final MagnetState magnetState;
|
||||
private final CoordinatorListener listener;
|
||||
private final I2PSnarkUtil _util;
|
||||
private static final Random _random = I2PAppContext.getGlobalContext().random();
|
||||
private final Random _random;
|
||||
|
||||
/**
|
||||
* @param metainfo null if in magnet mode
|
||||
@ -140,6 +142,7 @@ class PeerCoordinator implements PeerListener
|
||||
CoordinatorListener listener, Snark torrent)
|
||||
{
|
||||
_util = util;
|
||||
_random = util.getContext().random();
|
||||
this.id = id;
|
||||
this.infohash = infohash;
|
||||
this.metainfo = metainfo;
|
||||
@ -157,7 +160,7 @@ class PeerCoordinator implements PeerListener
|
||||
// Install a timer to check the uploaders.
|
||||
// Randomize the first start time so multiple tasks are spread out,
|
||||
// this will help the behavior with global limits
|
||||
timer = new CheckEvent(new PeerCheckerTask(_util, this));
|
||||
timer = new CheckEvent(_util.getContext(), new PeerCheckerTask(_util, this));
|
||||
timer.schedule((CHECK_PERIOD / 2) + _random.nextInt((int) CHECK_PERIOD));
|
||||
}
|
||||
|
||||
@ -167,8 +170,8 @@ class PeerCoordinator implements PeerListener
|
||||
*/
|
||||
private static class CheckEvent extends SimpleTimer2.TimedEvent {
|
||||
private final PeerCheckerTask _task;
|
||||
public CheckEvent(PeerCheckerTask task) {
|
||||
super(SimpleTimer2.getInstance());
|
||||
public CheckEvent(I2PAppContext ctx, PeerCheckerTask task) {
|
||||
super(ctx.simpleTimer2());
|
||||
_task = task;
|
||||
}
|
||||
public void timeReached() {
|
||||
@ -377,8 +380,10 @@ class PeerCoordinator implements PeerListener
|
||||
}
|
||||
|
||||
/**
|
||||
* Reduce max if huge pieces to keep from ooming when leeching
|
||||
* @return 512K: 16; 1M: 11; 2M: 6
|
||||
* Formerly used to
|
||||
* reduce max if huge pieces to keep from ooming when leeching
|
||||
* but now we don't
|
||||
* @return usually 16
|
||||
*/
|
||||
private int getMaxConnections() {
|
||||
if (metainfo == null)
|
||||
@ -388,7 +393,7 @@ class PeerCoordinator implements PeerListener
|
||||
return 4;
|
||||
if (pieces <= 5)
|
||||
return 6;
|
||||
int size = metainfo.getPieceLength(0);
|
||||
//int size = metainfo.getPieceLength(0);
|
||||
int max = _util.getMaxConnections();
|
||||
// Now that we use temp files, no memory concern
|
||||
//if (size <= 512*1024 || completed())
|
||||
@ -434,6 +439,12 @@ class PeerCoordinator implements PeerListener
|
||||
*/
|
||||
public void restart() {
|
||||
halted = false;
|
||||
synchronized (uploaded_old) {
|
||||
Arrays.fill(uploaded_old, 0);
|
||||
}
|
||||
synchronized (downloaded_old) {
|
||||
Arrays.fill(downloaded_old, 0);
|
||||
}
|
||||
timer.schedule((CHECK_PERIOD / 2) + _random.nextInt((int) CHECK_PERIOD));
|
||||
}
|
||||
|
||||
@ -449,7 +460,7 @@ class PeerCoordinator implements PeerListener
|
||||
synchronized(peers)
|
||||
{
|
||||
Peer old = peerIDInList(peer.getPeerID(), peers);
|
||||
if ( (old != null) && (old.getInactiveTime() > 8*60*1000) ) {
|
||||
if ( (old != null) && (old.getInactiveTime() > MAX_INACTIVE) ) {
|
||||
// idle for 8 minutes, kill the old con (32KB/8min = 68B/sec minimum for one block)
|
||||
if (_log.shouldLog(Log.WARN))
|
||||
_log.warn("Remomving old peer: " + peer + ": " + old + ", inactive for " + old.getInactiveTime());
|
||||
@ -543,7 +554,7 @@ class PeerCoordinator implements PeerListener
|
||||
need_more = (!peer.isConnected()) && peersize < getMaxConnections();
|
||||
// Check if we already have this peer before we build the connection
|
||||
Peer old = peerIDInList(peer.getPeerID(), peers);
|
||||
need_more = need_more && ((old == null) || (old.getInactiveTime() > 8*60*1000));
|
||||
need_more = need_more && ((old == null) || (old.getInactiveTime() > MAX_INACTIVE));
|
||||
}
|
||||
|
||||
if (need_more)
|
||||
@ -974,11 +985,8 @@ class PeerCoordinator implements PeerListener
|
||||
|
||||
// Announce to the world we have it!
|
||||
// Disconnect from other seeders when we get the last piece
|
||||
List<Peer> toDisconnect = new ArrayList();
|
||||
Iterator<Peer> it = peers.iterator();
|
||||
while (it.hasNext())
|
||||
{
|
||||
Peer p = it.next();
|
||||
List<Peer> toDisconnect = done ? new ArrayList() : null;
|
||||
for (Peer p : peers) {
|
||||
if (p.isConnected())
|
||||
{
|
||||
if (done && p.isCompleted())
|
||||
@ -987,14 +995,12 @@ class PeerCoordinator implements PeerListener
|
||||
p.have(piece);
|
||||
}
|
||||
}
|
||||
it = toDisconnect.iterator();
|
||||
while (it.hasNext())
|
||||
{
|
||||
Peer p = it.next();
|
||||
|
||||
if (done) {
|
||||
for (Peer p : toDisconnect) {
|
||||
p.disconnect(true);
|
||||
}
|
||||
|
||||
if (done) {
|
||||
// put msg on the console if partial, since Storage won't do it
|
||||
if (!completed())
|
||||
snark.storageCompleted(storage);
|
||||
|
@ -35,6 +35,7 @@ import net.i2p.I2PAppContext;
|
||||
import net.i2p.client.streaming.I2PServerSocket;
|
||||
import net.i2p.data.Destination;
|
||||
import net.i2p.util.I2PThread;
|
||||
import net.i2p.util.Log;
|
||||
|
||||
/**
|
||||
* Main Snark program startup class.
|
||||
@ -47,29 +48,6 @@ public class Snark
|
||||
private final static int MIN_PORT = 6881;
|
||||
private final static int MAX_PORT = 6889;
|
||||
|
||||
// Error messages (non-fatal)
|
||||
public final static int ERROR = 1;
|
||||
|
||||
// Warning messages
|
||||
public final static int WARNING = 2;
|
||||
|
||||
// Notices (peer level)
|
||||
public final static int NOTICE = 3;
|
||||
|
||||
// Info messages (protocol policy level)
|
||||
public final static int INFO = 4;
|
||||
|
||||
// Debug info (protocol level)
|
||||
public final static int DEBUG = 5;
|
||||
|
||||
// Very low level stuff (network level)
|
||||
public final static int ALL = 6;
|
||||
|
||||
/**
|
||||
* What level of debug info to show.
|
||||
*/
|
||||
//public static int debug = NOTICE;
|
||||
|
||||
// Whether or not to ask the user for commands while sharing
|
||||
//private static boolean command_interpreter = true;
|
||||
|
||||
@ -249,12 +227,13 @@ public class Snark
|
||||
private TrackerClient trackerclient;
|
||||
private String rootDataDir = ".";
|
||||
private final CompleteListener completeListener;
|
||||
private boolean stopped;
|
||||
private boolean starting;
|
||||
private volatile boolean stopped;
|
||||
private volatile boolean starting;
|
||||
private byte[] id;
|
||||
private final byte[] infoHash;
|
||||
private String additionalTrackerURL;
|
||||
private final I2PSnarkUtil _util;
|
||||
private final Log _log;
|
||||
private final PeerCoordinatorSet _peerCoordinatorSet;
|
||||
private String trackerProblems;
|
||||
private int trackerSeenPeers;
|
||||
@ -308,6 +287,7 @@ public class Snark
|
||||
|
||||
completeListener = complistener;
|
||||
_util = util;
|
||||
_log = util.getContext().logManager().getLog(Snark.class);
|
||||
_peerCoordinatorSet = peerCoordinatorSet;
|
||||
acceptor = connectionAcceptor;
|
||||
|
||||
@ -318,7 +298,8 @@ public class Snark
|
||||
activity = "Network setup";
|
||||
|
||||
id = generateID();
|
||||
debug("My peer id: " + PeerID.idencode(id), Snark.INFO);
|
||||
if (_log.shouldLog(Log.INFO))
|
||||
_log.info("My peer id: " + PeerID.idencode(id));
|
||||
|
||||
/*
|
||||
* Don't start a tunnel if the torrent isn't going to be started.
|
||||
@ -404,8 +385,8 @@ public class Snark
|
||||
try { in.close(); } catch (IOException ioe) {}
|
||||
}
|
||||
|
||||
infoHash = x_infoHash; // final
|
||||
debug(meta.toString(), INFO);
|
||||
if (_log.shouldLog(Log.INFO))
|
||||
_log.info(meta.toString());
|
||||
|
||||
// When the metainfo torrent was created from an existing file/dir
|
||||
// it already exists.
|
||||
@ -466,6 +447,7 @@ public class Snark
|
||||
{
|
||||
completeListener = complistener;
|
||||
_util = util;
|
||||
_log = util.getContext().logManager().getLog(Snark.class);
|
||||
_peerCoordinatorSet = peerCoordinatorSet;
|
||||
acceptor = connectionAcceptor;
|
||||
this.torrent = torrent;
|
||||
@ -533,9 +515,11 @@ public class Snark
|
||||
fatal("Unable to listen for I2P connections");
|
||||
else {
|
||||
Destination d = serversocket.getManager().getSession().getMyDestination();
|
||||
debug("Listening on I2P destination " + d.toBase64() + " / " + d.calculateHash().toBase64(), NOTICE);
|
||||
if (_log.shouldLog(Log.INFO))
|
||||
_log.info("Listening on I2P destination " + d.toBase64() + " / " + d.calculateHash().toBase64());
|
||||
}
|
||||
debug("Starting PeerCoordinator, ConnectionAcceptor, and TrackerClient", NOTICE);
|
||||
if (_log.shouldLog(Log.INFO))
|
||||
_log.info("Starting PeerCoordinator, ConnectionAcceptor, and TrackerClient");
|
||||
activity = "Collecting pieces";
|
||||
coordinator = new PeerCoordinator(_util, id, infoHash, meta, storage, this, this);
|
||||
if (_peerCoordinatorSet != null) {
|
||||
@ -575,7 +559,8 @@ public class Snark
|
||||
}
|
||||
trackerclient.start();
|
||||
} else {
|
||||
debug("NOT starting TrackerClient???", NOTICE);
|
||||
if (_log.shouldLog(Log.INFO))
|
||||
_log.info("NOT starting TrackerClient???");
|
||||
}
|
||||
}
|
||||
|
||||
@ -1019,22 +1004,13 @@ public class Snark
|
||||
private static void usage()
|
||||
{
|
||||
System.out.println
|
||||
("Usage: snark [--debug [level]] [--no-commands] [--port <port>]");
|
||||
("Usage: snark [--no-commands] [--port <port>]");
|
||||
System.out.println
|
||||
(" [--eepproxy hostname portnum]");
|
||||
System.out.println
|
||||
(" [--i2cp routerHost routerPort ['name=val name=val name=val']]");
|
||||
System.out.println
|
||||
(" (<url>|<file>)");
|
||||
System.out.println
|
||||
(" --debug\tShows some extra info and stacktraces");
|
||||
System.out.println
|
||||
(" level\tHow much debug details to show");
|
||||
System.out.println
|
||||
(" \t(defaults to "
|
||||
+ NOTICE + ", with --debug to "
|
||||
+ INFO + ", highest level is "
|
||||
+ ALL + ").");
|
||||
System.out.println
|
||||
(" --no-commands\tDon't read interactive commands or show usage info.");
|
||||
System.out.println
|
||||
@ -1073,7 +1049,7 @@ public class Snark
|
||||
*/
|
||||
private void fatal(String s, Throwable t)
|
||||
{
|
||||
_util.debug(s, ERROR, t);
|
||||
_log.error(s, t);
|
||||
//System.err.println("snark: " + s + ((t == null) ? "" : (": " + t)));
|
||||
//if (debug >= INFO && t != null)
|
||||
// t.printStackTrace();
|
||||
@ -1085,14 +1061,6 @@ public class Snark
|
||||
throw new RuntimeException(s, t);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show debug info if debug is true.
|
||||
*/
|
||||
private void debug(String s, int level)
|
||||
{
|
||||
_util.debug(s, level, null);
|
||||
}
|
||||
|
||||
/** CoordinatorListener - this does nothing */
|
||||
public void peerChange(PeerCoordinator coordinator, Peer peer)
|
||||
{
|
||||
@ -1170,9 +1138,10 @@ public class Snark
|
||||
// + " pieces: ");
|
||||
checking = true;
|
||||
}
|
||||
if (!checking)
|
||||
debug("Got " + (checked ? "" : "BAD ") + "piece: " + num,
|
||||
Snark.INFO);
|
||||
if (!checking) {
|
||||
if (_log.shouldLog(Log.INFO))
|
||||
_log.info("Got " + (checked ? "" : "BAD ") + "piece: " + num);
|
||||
}
|
||||
}
|
||||
|
||||
public void storageAllChecked(Storage storage)
|
||||
@ -1188,7 +1157,8 @@ public class Snark
|
||||
|
||||
public void storageCompleted(Storage storage)
|
||||
{
|
||||
debug("Completely received " + torrent, Snark.INFO);
|
||||
if (_log.shouldLog(Log.INFO))
|
||||
_log.info("Completely received " + torrent);
|
||||
//storage.close();
|
||||
//System.out.println("Completely received: " + torrent);
|
||||
if (completeListener != null)
|
||||
@ -1261,7 +1231,8 @@ public class Snark
|
||||
total += c.getCurrentUploadRate();
|
||||
}
|
||||
long limit = 1024l * _util.getMaxUpBW();
|
||||
debug("Total up bw: " + total + " Limit: " + limit, Snark.NOTICE);
|
||||
if (_log.shouldLog(Log.INFO))
|
||||
_log.info("Total up bw: " + total + " Limit: " + limit);
|
||||
return total > limit;
|
||||
}
|
||||
|
||||
|
@ -1726,7 +1726,7 @@ public class SnarkManager implements Snark.CompleteListener {
|
||||
if (count > 0) {
|
||||
// Schedule this even for final shutdown, as there's a chance
|
||||
// that it's just this webapp that is stopping.
|
||||
SimpleScheduler.getInstance().addEvent(new Disconnector(), 60*1000);
|
||||
_context.simpleScheduler().addEvent(new Disconnector(), 60*1000);
|
||||
addMessage(_("Closing I2P tunnel after notifying trackers."));
|
||||
if (finalShutdown) {
|
||||
try { Thread.sleep(5*1000); } catch (InterruptedException ie) {}
|
||||
|
@ -34,6 +34,7 @@ import java.util.StringTokenizer;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import net.i2p.crypto.SHA1;
|
||||
import net.i2p.util.Log;
|
||||
import net.i2p.util.SecureFile;
|
||||
|
||||
/**
|
||||
@ -55,6 +56,7 @@ public class Storage
|
||||
|
||||
private final StorageListener listener;
|
||||
private final I2PSnarkUtil _util;
|
||||
private final Log _log;
|
||||
|
||||
private /* FIXME final FIXME */ BitField bitfield; // BitField to represent the pieces
|
||||
private int needed; // Number of pieces needed
|
||||
@ -87,6 +89,7 @@ public class Storage
|
||||
throws IOException
|
||||
{
|
||||
_util = util;
|
||||
_log = util.getContext().logManager().getLog(Storage.class);
|
||||
this.metainfo = metainfo;
|
||||
this.listener = listener;
|
||||
needed = metainfo.getPieces();
|
||||
@ -110,6 +113,7 @@ public class Storage
|
||||
throws IOException
|
||||
{
|
||||
_util = util;
|
||||
_log = util.getContext().logManager().getLog(Storage.class);
|
||||
this.listener = listener;
|
||||
// Create names, rafs and lengths arrays.
|
||||
getFiles(baseFile);
|
||||
@ -232,8 +236,9 @@ public class Storage
|
||||
File[] files = f.listFiles();
|
||||
if (files == null)
|
||||
{
|
||||
_util.debug("WARNING: Skipping '" + f
|
||||
+ "' not a normal file.", Snark.WARNING);
|
||||
if (_log.shouldLog(Log.WARN))
|
||||
_log.warn("WARNING: Skipping '" + f
|
||||
+ "' not a normal file.");
|
||||
return;
|
||||
}
|
||||
for (int i = 0; i < files.length; i++)
|
||||
@ -457,7 +462,8 @@ public class Storage
|
||||
if (files == null)
|
||||
{
|
||||
// Create base as file.
|
||||
_util.debug("Creating/Checking file: " + base, Snark.NOTICE);
|
||||
if (_log.shouldLog(Log.INFO))
|
||||
_log.info("Creating/Checking file: " + base);
|
||||
if (!base.createNewFile() && !base.exists())
|
||||
throw new IOException("Could not create file " + base);
|
||||
|
||||
@ -481,7 +487,8 @@ public class Storage
|
||||
else
|
||||
{
|
||||
// Create base as dir.
|
||||
_util.debug("Creating/Checking directory: " + base, Snark.NOTICE);
|
||||
if (_log.shouldLog(Log.INFO))
|
||||
_log.info("Creating/Checking directory: " + base);
|
||||
if (!base.mkdir() && !base.isDirectory())
|
||||
throw new IOException("Could not create directory " + base);
|
||||
|
||||
@ -540,19 +547,22 @@ public class Storage
|
||||
bitfield = savedBitField;
|
||||
needed = metainfo.getPieces() - bitfield.count();
|
||||
_probablyComplete = complete();
|
||||
_util.debug("Found saved state and files unchanged, skipping check", Snark.NOTICE);
|
||||
if (_log.shouldLog(Log.INFO))
|
||||
_log.info("Found saved state and files unchanged, skipping check");
|
||||
} else {
|
||||
// the following sets the needed variable
|
||||
changed = true;
|
||||
checkCreateFiles(false);
|
||||
}
|
||||
if (complete()) {
|
||||
_util.debug("Torrent is complete", Snark.NOTICE);
|
||||
if (_log.shouldLog(Log.INFO))
|
||||
_log.info("Torrent is complete");
|
||||
} else {
|
||||
// fixme saved priorities
|
||||
if (files != null)
|
||||
priorities = new int[files.size()];
|
||||
_util.debug("Still need " + needed + " out of " + metainfo.getPieces() + " pieces", Snark.NOTICE);
|
||||
if (_log.shouldLog(Log.INFO))
|
||||
_log.info("Still need " + needed + " out of " + metainfo.getPieces() + " pieces");
|
||||
}
|
||||
}
|
||||
|
||||
@ -731,7 +741,7 @@ public class Storage
|
||||
String msg = "File '" + names[i] + "' exists, but has wrong length (expected " +
|
||||
lengths[i] + " but found " + length + ") - repairing corruption";
|
||||
SnarkManager.instance().addMessage(msg);
|
||||
_util.debug(msg, Snark.ERROR);
|
||||
_log.error(msg);
|
||||
changed = true;
|
||||
resume = true;
|
||||
_probablyComplete = false; // to force RW
|
||||
@ -844,7 +854,8 @@ public class Storage
|
||||
*/
|
||||
private void balloonFile(int nr) throws IOException
|
||||
{
|
||||
_util.debug("Ballooning " + nr + ": " + RAFfile[nr], Snark.INFO);
|
||||
if (_log.shouldLog(Log.INFO))
|
||||
_log.info("Ballooning " + nr + ": " + RAFfile[nr]);
|
||||
long remaining = lengths[nr];
|
||||
final int ZEROBLOCKSIZE = (int) Math.min(remaining, 32*1024);
|
||||
byte[] zeros = new byte[ZEROBLOCKSIZE];
|
||||
@ -875,7 +886,7 @@ public class Storage
|
||||
closeRAF(i);
|
||||
}
|
||||
} catch (IOException ioe) {
|
||||
_util.debug("Error closing " + RAFfile[i], Snark.ERROR, ioe);
|
||||
_log.error("Error closing " + RAFfile[i], ioe);
|
||||
// gobble gobble
|
||||
}
|
||||
}
|
||||
@ -896,7 +907,8 @@ public class Storage
|
||||
try {
|
||||
bs = new byte[len];
|
||||
} catch (OutOfMemoryError oom) {
|
||||
_util.debug("Out of memory, can't honor request for piece " + piece, Snark.WARNING, oom);
|
||||
if (_log.shouldLog(Log.WARN))
|
||||
_log.warn("Out of memory, can't honor request for piece " + piece, oom);
|
||||
return null;
|
||||
}
|
||||
getUncheckedPiece(piece, bs, off, len);
|
||||
@ -1000,8 +1012,9 @@ public class Storage
|
||||
if (needed > 0) {
|
||||
if (listener != null)
|
||||
listener.setWantedPieces(this);
|
||||
_util.debug("WARNING: Not really done, missing " + needed
|
||||
+ " pieces", Snark.WARNING);
|
||||
if (_log.shouldLog(Log.WARN))
|
||||
_log.warn("WARNING: Not really done, missing " + needed
|
||||
+ " pieces");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -62,7 +62,7 @@ import net.i2p.util.SimpleTimer2;
|
||||
* @author Mark Wielaard (mark@klomp.org)
|
||||
*/
|
||||
public class TrackerClient implements Runnable {
|
||||
private final Log _log = I2PAppContext.getGlobalContext().logManager().getLog(TrackerClient.class);
|
||||
private final Log _log;
|
||||
private static final String NO_EVENT = "";
|
||||
private static final String STARTED_EVENT = "started";
|
||||
private static final String COMPLETED_EVENT = "completed";
|
||||
@ -116,6 +116,7 @@ public class TrackerClient implements Runnable {
|
||||
String id = urlencode(snark.getID());
|
||||
_threadName = "TrackerClient " + id.substring(id.length() - 12);
|
||||
_util = util;
|
||||
_log = util.getContext().logManager().getLog(TrackerClient.class);
|
||||
this.meta = meta;
|
||||
this.additionalTrackerURL = additionalTrackerURL;
|
||||
this.coordinator = coordinator;
|
||||
@ -183,7 +184,7 @@ public class TrackerClient implements Runnable {
|
||||
|
||||
private class Runner extends SimpleTimer2.TimedEvent {
|
||||
public Runner(long delay) {
|
||||
super(SimpleTimer2.getInstance(), delay);
|
||||
super(_util.getContext().simpleTimer2(), delay);
|
||||
}
|
||||
|
||||
public void timeReached() {
|
||||
@ -397,9 +398,10 @@ public class TrackerClient implements Runnable {
|
||||
catch (IOException ioe)
|
||||
{
|
||||
// Probably not fatal (if it doesn't last to long...)
|
||||
_util.debug
|
||||
if (_log.shouldLog(Log.WARN))
|
||||
_log.warn
|
||||
("WARNING: Could not contact tracker at '"
|
||||
+ tr.announce + "': " + ioe, Snark.WARNING);
|
||||
+ tr.announce + "': " + ioe);
|
||||
tr.trackerProblems = ioe.getMessage();
|
||||
// don't show secondary tracker problems to the user
|
||||
if (tr.isPrimary)
|
||||
@ -421,8 +423,9 @@ public class TrackerClient implements Runnable {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
_util.debug("Not announcing to " + tr.announce + " last announce was " +
|
||||
new Date(tr.lastRequestTime) + " interval is " + DataHelper.formatDuration(tr.interval), Snark.INFO);
|
||||
if (_log.shouldLog(Log.INFO))
|
||||
_log.info("Not announcing to " + tr.announce + " last announce was " +
|
||||
new Date(tr.lastRequestTime) + " interval is " + DataHelper.formatDuration(tr.interval));
|
||||
}
|
||||
if ((!tr.stop) && maxSeenPeers < tr.seenPeers)
|
||||
maxSeenPeers = tr.seenPeers;
|
||||
@ -432,7 +435,8 @@ public class TrackerClient implements Runnable {
|
||||
if (coordinator.needOutboundPeers() && (meta == null || !meta.isPrivate()) && !stop) {
|
||||
Set<PeerID> pids = coordinator.getPEXPeers();
|
||||
if (!pids.isEmpty()) {
|
||||
_util.debug("Got " + pids.size() + " from PEX", Snark.INFO);
|
||||
if (_log.shouldLog(Log.INFO))
|
||||
_log.info("Got " + pids.size() + " from PEX");
|
||||
List<Peer> peers = new ArrayList(pids.size());
|
||||
for (PeerID pID : pids) {
|
||||
peers.add(new Peer(pID, snark.getID(), snark.getInfoHash(), snark.getMetaInfo()));
|
||||
@ -448,7 +452,8 @@ public class TrackerClient implements Runnable {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
_util.debug("Not getting PEX peers", Snark.INFO);
|
||||
if (_log.shouldLog(Log.INFO))
|
||||
_log.info("Not getting PEX peers");
|
||||
}
|
||||
|
||||
// Get peers from DHT
|
||||
@ -460,13 +465,15 @@ public class TrackerClient implements Runnable {
|
||||
else
|
||||
numwant = _util.getMaxConnections();
|
||||
List<Hash> hashes = _util.getDHT().getPeers(snark.getInfoHash(), numwant, 2*60*1000);
|
||||
_util.debug("Got " + hashes + " from DHT", Snark.INFO);
|
||||
if (_log.shouldLog(Log.INFO))
|
||||
_log.info("Got " + hashes + " from DHT");
|
||||
// announce ourselves while the token is still good
|
||||
// FIXME this needs to be in its own thread
|
||||
if (!stop) {
|
||||
// announce only to the 1 closest
|
||||
int good = _util.getDHT().announce(snark.getInfoHash(), 1, 5*60*1000);
|
||||
_util.debug("Sent " + good + " good announces to DHT", Snark.INFO);
|
||||
if (_log.shouldLog(Log.INFO))
|
||||
_log.info("Sent " + good + " good announces to DHT");
|
||||
}
|
||||
|
||||
// now try these peers
|
||||
@ -487,7 +494,8 @@ public class TrackerClient implements Runnable {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
_util.debug("Not getting DHT peers", Snark.INFO);
|
||||
if (_log.shouldLog(Log.INFO))
|
||||
_log.info("Not getting DHT peers");
|
||||
}
|
||||
|
||||
|
||||
@ -498,7 +506,8 @@ public class TrackerClient implements Runnable {
|
||||
return;
|
||||
|
||||
if (!runStarted)
|
||||
_util.debug(" Retrying in one minute...", Snark.DEBUG);
|
||||
if (_log.shouldLog(Log.DEBUG))
|
||||
_log.debug(" Retrying in one minute...");
|
||||
|
||||
try {
|
||||
// Sleep some minutes...
|
||||
@ -527,7 +536,7 @@ public class TrackerClient implements Runnable {
|
||||
} // try
|
||||
catch (Throwable t)
|
||||
{
|
||||
_util.debug("TrackerClient: " + t, Snark.ERROR, t);
|
||||
_log.error("TrackerClient: " + t, t);
|
||||
if (t instanceof OutOfMemoryError)
|
||||
throw (OutOfMemoryError)t;
|
||||
}
|
||||
@ -620,7 +629,8 @@ public class TrackerClient implements Runnable {
|
||||
else
|
||||
buf.append(_util.getMaxConnections());
|
||||
String s = buf.toString();
|
||||
_util.debug("Sending TrackerClient request: " + s, Snark.INFO);
|
||||
if (_log.shouldLog(Log.INFO))
|
||||
_log.info("Sending TrackerClient request: " + s);
|
||||
|
||||
tr.lastRequestTime = System.currentTimeMillis();
|
||||
// Don't wait for a response to stopped when shutting down
|
||||
@ -636,7 +646,8 @@ public class TrackerClient implements Runnable {
|
||||
|
||||
TrackerInfo info = new TrackerInfo(in, snark.getID(),
|
||||
snark.getInfoHash(), snark.getMetaInfo());
|
||||
_util.debug("TrackerClient response: " + info, Snark.INFO);
|
||||
if (_log.shouldLog(Log.INFO))
|
||||
_log.info("TrackerClient response: " + info);
|
||||
|
||||
String failure = info.getFailureReason();
|
||||
if (failure != null)
|
||||
|
@ -243,11 +243,12 @@ public class FetchAndAdd extends Snark implements EepGet.StatusListener, Runnabl
|
||||
}
|
||||
|
||||
/**
|
||||
* @return torrent file bytes remaining or -1
|
||||
* @return -1 when done so the web will list us as "complete" instead of "seeding"
|
||||
*/
|
||||
@Override
|
||||
public long getRemainingLength() {
|
||||
return _remaining;
|
||||
long rv = _remaining;
|
||||
return rv > 0 ? rv : -1;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -232,9 +232,9 @@ public class I2PSnarkServlet extends DefaultServlet {
|
||||
//out.write("<meta http-equiv=\"refresh\" content=\"" + delay + ";/i2psnark/" + peerString + "\">\n");
|
||||
out.write("<script src=\"/js/ajax.js\" type=\"text/javascript\"></script>\n" +
|
||||
"<script type=\"text/javascript\">\n" +
|
||||
"var failMessage = \"<b>" + _("Router is down") + "<\\/b>\";\n" +
|
||||
"var failMessage = \"<div class=\\\"routerdown\\\"><b>" + _("Router is down") + "<\\/b><\\/div>\";\n" +
|
||||
"function requestAjax1() { ajax(\"/i2psnark/.ajax/xhr1.html" + peerString + "\", \"mainsection\", " + (delay*1000) + "); }\n" +
|
||||
"function initAjax(delayMs) { setTimeout(requestAjax1, " + (delay*1000) +"); }\n" +
|
||||
"function initAjax() { setTimeout(requestAjax1, " + (delay*1000) +"); }\n" +
|
||||
"</script>\n");
|
||||
}
|
||||
}
|
||||
@ -333,8 +333,11 @@ public class I2PSnarkServlet extends DefaultServlet {
|
||||
out.write("<input type=\"hidden\" name=\"p\" value=\"" + peerParam + "\" >\n");
|
||||
}
|
||||
out.write(TABLE_HEADER);
|
||||
out.write("<img alt=\"\" border=\"0\" src=\"" + _imgPath + "status.png\" > ");
|
||||
out.write("<img border=\"0\" src=\"" + _imgPath + "status.png\" title=\"");
|
||||
out.write(_("Status"));
|
||||
out.write("\" alt=\"");
|
||||
out.write(_("Status"));
|
||||
out.write("\"></th>\n<th>");
|
||||
if (_manager.util().connected() && !snarks.isEmpty()) {
|
||||
out.write(" <a href=\"/i2psnark/");
|
||||
if (peerParam != null) {
|
||||
@ -355,48 +358,53 @@ public class I2PSnarkServlet extends DefaultServlet {
|
||||
out.write("</a><br>\n");
|
||||
}
|
||||
out.write("</th>\n<th colspan=\"3\" align=\"left\">");
|
||||
out.write("<img border=\"0\" src=\"" + _imgPath + "torrent.png\" alt=\"\">");
|
||||
out.write("<img border=\"0\" src=\"" + _imgPath + "torrent.png\" title=\"");
|
||||
out.write(_("Torrent"));
|
||||
out.write("\" alt=\"");
|
||||
out.write(_("Torrent"));
|
||||
out.write("\">");
|
||||
out.write("</th>\n<th align=\"right\">");
|
||||
if (_manager.util().connected() && !snarks.isEmpty()) {
|
||||
out.write("<img border=\"0\" src=\"" + _imgPath + "eta.png\" alt=\"\" title=\"");
|
||||
out.write("<img border=\"0\" src=\"" + _imgPath + "eta.png\" title=\"");
|
||||
out.write(_("Estimated time remaining"));
|
||||
out.write("\">");
|
||||
out.write("\" alt=\"");
|
||||
// Translators: Please keep short or translate as " "
|
||||
out.write(_("ETA"));
|
||||
out.write("\">");
|
||||
}
|
||||
out.write("</th>\n<th align=\"right\">");
|
||||
out.write("<img border=\"0\" src=\"" + _imgPath + "head_rx.png\" alt=\"\" title=\"");
|
||||
out.write("<img border=\"0\" src=\"" + _imgPath + "head_rx.png\" title=\"");
|
||||
out.write(_("Downloaded"));
|
||||
out.write("\">");
|
||||
out.write("\" alt=\"");
|
||||
// Translators: Please keep short or translate as " "
|
||||
out.write(_("RX"));
|
||||
out.write("\">");
|
||||
out.write("</th>\n<th align=\"right\">");
|
||||
if (_manager.util().connected() && !snarks.isEmpty()) {
|
||||
out.write("<img border=\"0\" src=\"" + _imgPath + "head_tx.png\" alt=\"\" title=\"");
|
||||
out.write("<img border=\"0\" src=\"" + _imgPath + "head_tx.png\" title=\"");
|
||||
out.write(_("Uploaded"));
|
||||
out.write("\">");
|
||||
out.write("\" alt=\"");
|
||||
// Translators: Please keep short or translate as " "
|
||||
out.write(_("TX"));
|
||||
out.write("\">");
|
||||
}
|
||||
out.write("</th>\n<th align=\"right\">");
|
||||
if (_manager.util().connected() && !snarks.isEmpty()) {
|
||||
out.write("<img border=\"0\" src=\"" + _imgPath + "head_rxspeed.png\" title=\"");
|
||||
out.write(_("Down Rate"));
|
||||
out.write("\" alt=\"");
|
||||
out.write(_("RX"));
|
||||
out.write(" \">");
|
||||
// Translators: Please keep short or translate as " "
|
||||
out.write(_("Rate"));
|
||||
out.write(_("RX Rate"));
|
||||
out.write(" \">");
|
||||
}
|
||||
out.write("</th>\n<th align=\"right\">");
|
||||
if (_manager.util().connected() && !snarks.isEmpty()) {
|
||||
out.write("<img border=\"0\" src=\"" + _imgPath + "head_txspeed.png\" title=\"");
|
||||
out.write(_("Up Rate"));
|
||||
out.write("\" alt=\"");
|
||||
out.write(_("TX"));
|
||||
// Translators: Please keep short or translate as " "
|
||||
out.write(_("TX Rate"));
|
||||
out.write(" \">");
|
||||
out.write(_("Rate"));
|
||||
}
|
||||
out.write("</th>\n<th align=\"center\">");
|
||||
|
||||
@ -965,22 +973,25 @@ public class I2PSnarkServlet extends DefaultServlet {
|
||||
String statusString;
|
||||
if (err != null) {
|
||||
if (isRunning && curPeers > 0 && !showPeers)
|
||||
statusString = "<img alt=\"\" border=\"0\" src=\"" + _imgPath + "trackererror.png\" title=\"" + err + "\"></td><td class=\"snarkTorrentStatus " + rowClass + "\">" + _("Tracker Error") +
|
||||
statusString = "<img alt=\"\" border=\"0\" src=\"" + _imgPath + "trackererror.png\" title=\"" + err + "\"></td>" +
|
||||
"<td class=\"snarkTorrentStatus " + rowClass + "\">" + _("Tracker Error") +
|
||||
": <a href=\"" + uri + "?p=" + Base64.encode(snark.getInfoHash()) + "\">" +
|
||||
curPeers + thinsp(noThinsp) +
|
||||
ngettext("1 peer", "{0} peers", knownPeers) + "</a>";
|
||||
else if (isRunning)
|
||||
statusString = "<img alt=\"\" border=\"0\" src=\"" + _imgPath + "trackererror.png\" title=\"" + err + "\"></td><td class=\"snarkTorrentStatus " + rowClass + "\">" + _("Tracker Error") +
|
||||
statusString = "<img alt=\"\" border=\"0\" src=\"" + _imgPath + "trackererror.png\" title=\"" + err + "\"></td>" +
|
||||
"<td class=\"snarkTorrentStatus " + rowClass + "\">" + _("Tracker Error") +
|
||||
": " + curPeers + thinsp(noThinsp) +
|
||||
ngettext("1 peer", "{0} peers", knownPeers);
|
||||
else {
|
||||
if (err.length() > MAX_DISPLAYED_ERROR_LENGTH)
|
||||
err = err.substring(0, MAX_DISPLAYED_ERROR_LENGTH) + "…";
|
||||
statusString = "<img alt=\"\" border=\"0\" src=\"" + _imgPath + "trackererror.png\" title=\"" + err + "\"></td><td class=\"snarkTorrentStatus " + rowClass + "\">" + _("Tracker Error") +
|
||||
"<br>" + err;
|
||||
statusString = "<img alt=\"\" border=\"0\" src=\"" + _imgPath + "trackererror.png\" title=\"" + err + "\"></td>" +
|
||||
"<td class=\"snarkTorrentStatus " + rowClass + "\">" + _("Tracker Error");
|
||||
}
|
||||
} else if (snark.isStarting()) {
|
||||
statusString = "<img alt=\"\" border=\"0\" src=\"" + _imgPath + "stalled.png\" ></td><td class=\"snarkTorrentStatus " + rowClass + "\">" + _("Starting");
|
||||
statusString = "<img alt=\"\" border=\"0\" src=\"" + _imgPath + "stalled.png\" title=\"" + _("Starting") + "\"></td>" +
|
||||
"<td class=\"snarkTorrentStatus " + rowClass + "\">" + _("Starting");
|
||||
} else if (remaining == 0 || needed == 0) { // < 0 means no meta size yet
|
||||
// partial complete or seeding
|
||||
if (isRunning) {
|
||||
@ -995,43 +1006,53 @@ public class I2PSnarkServlet extends DefaultServlet {
|
||||
txt = _("Complete");
|
||||
}
|
||||
if (curPeers > 0 && !showPeers)
|
||||
statusString = "<img alt=\"\" border=\"0\" src=\"" + _imgPath + img + ".png\" ></td><td class=\"snarkTorrentStatus " + rowClass + "\">" + txt +
|
||||
statusString = "<img alt=\"\" border=\"0\" src=\"" + _imgPath + img + ".png\" title=\"" + txt + "\"></td>" +
|
||||
"<td class=\"snarkTorrentStatus " + rowClass + "\">" + txt +
|
||||
": <a href=\"" + uri + "?p=" + Base64.encode(snark.getInfoHash()) + "\">" +
|
||||
curPeers + thinsp(noThinsp) +
|
||||
ngettext("1 peer", "{0} peers", knownPeers) + "</a>";
|
||||
else
|
||||
statusString = "<img alt=\"\" border=\"0\" src=\"" + _imgPath + img + ".png\" ></td><td class=\"snarkTorrentStatus " + rowClass + "\">" + txt +
|
||||
statusString = "<img alt=\"\" border=\"0\" src=\"" + _imgPath + img + ".png\" title=\"" + txt + "\"></td>" +
|
||||
"<td class=\"snarkTorrentStatus " + rowClass + "\">" + txt +
|
||||
": " + curPeers + thinsp(noThinsp) +
|
||||
ngettext("1 peer", "{0} peers", knownPeers);
|
||||
} else {
|
||||
statusString = "<img alt=\"\" border=\"0\" src=\"" + _imgPath + "complete.png\" ></td><td class=\"snarkTorrentStatus " + rowClass + "\">" + _("Complete");
|
||||
statusString = "<img alt=\"\" border=\"0\" src=\"" + _imgPath + "complete.png\" title=\"" + _("Complete") + "\"></td>" +
|
||||
"<td class=\"snarkTorrentStatus " + rowClass + "\">" + _("Complete");
|
||||
}
|
||||
} else {
|
||||
if (isRunning && curPeers > 0 && downBps > 0 && !showPeers)
|
||||
statusString = "<img alt=\"\" border=\"0\" src=\"" + _imgPath + "downloading.png\" ></td><td class=\"snarkTorrentStatus " + rowClass + "\">" + _("OK") +
|
||||
statusString = "<img alt=\"\" border=\"0\" src=\"" + _imgPath + "downloading.png\" title=\"" + _("OK") + "\"></td>" +
|
||||
"<td class=\"snarkTorrentStatus " + rowClass + "\">" + _("OK") +
|
||||
": <a href=\"" + uri + "?p=" + Base64.encode(snark.getInfoHash()) + "\">" +
|
||||
curPeers + thinsp(noThinsp) +
|
||||
ngettext("1 peer", "{0} peers", knownPeers) + "</a>";
|
||||
else if (isRunning && curPeers > 0 && downBps > 0)
|
||||
statusString = "<img alt=\"\" border=\"0\" src=\"" + _imgPath + "downloading.png\" ></td><td class=\"snarkTorrentStatus " + rowClass + "\">" + _("OK") +
|
||||
statusString = "<img alt=\"\" border=\"0\" src=\"" + _imgPath + "downloading.png\" title=\"" + _("OK") + "\"></td>" +
|
||||
"<td class=\"snarkTorrentStatus " + rowClass + "\">" + _("OK") +
|
||||
": " + curPeers + thinsp(noThinsp) +
|
||||
ngettext("1 peer", "{0} peers", knownPeers);
|
||||
else if (isRunning && curPeers > 0 && !showPeers)
|
||||
statusString = "<img alt=\"\" border=\"0\" src=\"" + _imgPath + "stalled.png\" ></td><td class=\"snarkTorrentStatus " + rowClass + "\">" + _("Stalled") +
|
||||
statusString = "<img alt=\"\" border=\"0\" src=\"" + _imgPath + "stalled.png\" title=\"" + _("Stalled") + "\"></td>" +
|
||||
"<td class=\"snarkTorrentStatus " + rowClass + "\">" + _("Stalled") +
|
||||
": <a href=\"" + uri + "?p=" + Base64.encode(snark.getInfoHash()) + "\">" +
|
||||
curPeers + thinsp(noThinsp) +
|
||||
ngettext("1 peer", "{0} peers", knownPeers) + "</a>";
|
||||
else if (isRunning && curPeers > 0)
|
||||
statusString = "<img alt=\"\" border=\"0\" src=\"" + _imgPath + "stalled.png\" ></td><td class=\"snarkTorrentStatus " + rowClass + "\">" + _("Stalled") +
|
||||
statusString = "<img alt=\"\" border=\"0\" src=\"" + _imgPath + "stalled.png\" title=\"" + _("Stalled") + "\"></td>" +
|
||||
"<td class=\"snarkTorrentStatus " + rowClass + "\">" + _("Stalled") +
|
||||
": " + curPeers + thinsp(noThinsp) +
|
||||
ngettext("1 peer", "{0} peers", knownPeers);
|
||||
else if (isRunning && knownPeers > 0)
|
||||
statusString = "<img alt=\"\" border=\"0\" src=\"" + _imgPath + "nopeers.png\" ></td><td class=\"snarkTorrentStatus " + rowClass + "\">" + _("No Peers") +
|
||||
statusString = "<img alt=\"\" border=\"0\" src=\"" + _imgPath + "nopeers.png\" title=\"" + _("No Peers") + "\"></td>" +
|
||||
"<td class=\"snarkTorrentStatus " + rowClass + "\">" + _("No Peers") +
|
||||
": 0" + thinsp(noThinsp) + knownPeers ;
|
||||
else if (isRunning)
|
||||
statusString = "<img alt=\"\" border=\"0\" src=\"" + _imgPath + "nopeers.png\" ></td><td class=\"snarkTorrentStatus " + rowClass + "\">" + _("No Peers");
|
||||
statusString = "<img alt=\"\" border=\"0\" src=\"" + _imgPath + "nopeers.png\" title=\"" + _("No Peers") + "\"></td>" +
|
||||
"<td class=\"snarkTorrentStatus " + rowClass + "\">" + _("No Peers");
|
||||
else
|
||||
statusString = "<img alt=\"\" border=\"0\" src=\"" + _imgPath + "stopped.png\" ></td><td class=\"snarkTorrentStatus " + rowClass + "\">" + _("Stopped");
|
||||
statusString = "<img alt=\"\" border=\"0\" src=\"" + _imgPath + "stopped.png\" title=\"" + _("Stopped") + "\"></td>" +
|
||||
"<td class=\"snarkTorrentStatus " + rowClass + "\">" + _("Stopped");
|
||||
}
|
||||
|
||||
out.write("<tr class=\"" + rowClass + "\">");
|
||||
@ -1074,11 +1095,11 @@ public class I2PSnarkServlet extends DefaultServlet {
|
||||
else if (isValid)
|
||||
icon = toIcon(meta.getName());
|
||||
else if (snark instanceof FetchAndAdd)
|
||||
icon = "arrow_down";
|
||||
icon = "basket_put";
|
||||
else
|
||||
icon = "magnet";
|
||||
if (isValid) {
|
||||
out.write(toImg(icon, _("Info")));
|
||||
out.write(toImg(icon));
|
||||
out.write("</a>");
|
||||
} else {
|
||||
out.write(toImg(icon));
|
||||
@ -1105,7 +1126,7 @@ public class I2PSnarkServlet extends DefaultServlet {
|
||||
|
||||
out.write("<td align=\"right\" class=\"snarkTorrentETA " + rowClass + "\">");
|
||||
if(isRunning && remainingSeconds > 0)
|
||||
out.write(DataHelper.formatDuration2(remainingSeconds*1000)); // (eta 6h)
|
||||
out.write(DataHelper.formatDuration2(Math.max(remainingSeconds, 10) * 1000)); // (eta 6h)
|
||||
out.write("</td>\n\t");
|
||||
out.write("<td align=\"right\" class=\"snarkTorrentDownloaded " + rowClass + "\">");
|
||||
if (remaining > 0)
|
||||
@ -1326,7 +1347,7 @@ public class I2PSnarkServlet extends DefaultServlet {
|
||||
* @return string or null
|
||||
* @since 0.8.4
|
||||
*/
|
||||
private String getTrackerLink(String announce, byte[] infohash) {
|
||||
private String getTrackerLinkUrl(String announce, byte[] infohash) {
|
||||
// temporarily hardcoded for postman* and anonymity, requires bytemonsoon patch for lookup by info_hash
|
||||
if (announce != null && (announce.startsWith("http://YRgrgTLG") || announce.startsWith("http://8EoJZIKr") ||
|
||||
announce.startsWith("http://lnQ6yoBT") || announce.startsWith("http://tracker2.postman.i2p/") ||
|
||||
@ -1342,15 +1363,29 @@ public class I2PSnarkServlet extends DefaultServlet {
|
||||
StringBuilder buf = new StringBuilder(128);
|
||||
buf.append("<a href=\"").append(baseURL).append("details.php?dllist=1&filelist=1&info_hash=")
|
||||
.append(TrackerClient.urlencode(infohash))
|
||||
.append("\" title=\"").append(_("Details at {0} tracker", name)).append("\" target=\"_blank\">" +
|
||||
"<img alt=\"").append(_("Info")).append("\" border=\"0\" src=\"")
|
||||
.append(_imgPath).append("details.png\"></a>");
|
||||
.append("\" title=\"").append(_("Details at {0} tracker", name)).append("\" target=\"_blank\">");
|
||||
return buf.toString();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string or null
|
||||
* @since 0.8.4
|
||||
*/
|
||||
private String getTrackerLink(String announce, byte[] infohash) {
|
||||
String linkUrl = getTrackerLinkUrl(announce, infohash);
|
||||
if (linkUrl != null) {
|
||||
StringBuilder buf = new StringBuilder(128);
|
||||
buf.append(linkUrl)
|
||||
.append("<img alt=\"").append(_("Info")).append("\" border=\"0\" src=\"")
|
||||
.append(_imgPath).append("details.png\"></a>");
|
||||
return buf.toString();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private void writeAddForm(PrintWriter out, HttpServletRequest req) throws IOException {
|
||||
// display incoming parameter if a GET so links will work
|
||||
String newURL = req.getParameter("newURL");
|
||||
@ -1562,9 +1597,9 @@ public class I2PSnarkServlet extends DefaultServlet {
|
||||
out.write(": <td><input type=\"text\" name=\"upBW\" class=\"r\" value=\""
|
||||
+ _manager.util().getMaxUpBW() + "\" size=\"4\" maxlength=\"4\" > KBps <i>");
|
||||
out.write(_("Half available bandwidth recommended."));
|
||||
out.write("<br><a href=\"/config.jsp\" target=\"blank\">");
|
||||
out.write(" [<a href=\"/config.jsp\" target=\"blank\">");
|
||||
out.write(_("View or change router bandwidth"));
|
||||
out.write("</a></i><br>\n" +
|
||||
out.write("</a>]</i><br>\n" +
|
||||
|
||||
"<tr><td>");
|
||||
out.write(_("Use open trackers also"));
|
||||
@ -1650,7 +1685,7 @@ public class I2PSnarkServlet extends DefaultServlet {
|
||||
"<img alt=\"\" border=\"0\" src=\"" + _imgPath + "config.png\"> ");
|
||||
buf.append(_("Trackers"));
|
||||
buf.append("</span><hr>\n" +
|
||||
"<table><tr><th>")
|
||||
"<table class=\"trackerconfig\"><tr><th>")
|
||||
//.append(_("Remove"))
|
||||
.append("</th><th>")
|
||||
.append(_("Name"))
|
||||
@ -1669,16 +1704,16 @@ public class I2PSnarkServlet extends DefaultServlet {
|
||||
String name = t.name;
|
||||
String homeURL = t.baseURL;
|
||||
String announceURL = t.announceURL.replace("=", "=");
|
||||
buf.append("<tr><td align=\"center\"><input type=\"checkbox\" class=\"optbox\" name=\"delete_")
|
||||
buf.append("<tr><td><input type=\"checkbox\" class=\"optbox\" name=\"delete_")
|
||||
.append(name).append("\" title=\"").append(_("Delete")).append("\">" +
|
||||
"</td><td align=\"left\">").append(name)
|
||||
.append("</td><td align=\"left\">").append(urlify(homeURL, 35))
|
||||
.append("</td><td align=\"center\"><input type=\"checkbox\" class=\"optbox\" name=\"open_")
|
||||
"</td><td>").append(name)
|
||||
.append("</td><td>").append(urlify(homeURL, 35))
|
||||
.append("</td><td><input type=\"checkbox\" class=\"optbox\" name=\"open_")
|
||||
.append(announceURL).append("\"");
|
||||
if (openTrackers.contains(t.announceURL))
|
||||
buf.append(" checked=\"checked\"");
|
||||
buf.append(">" +
|
||||
"</td><td align=\"center\"><input type=\"checkbox\" class=\"optbox\" name=\"private_")
|
||||
"</td><td><input type=\"checkbox\" class=\"optbox\" name=\"private_")
|
||||
.append(announceURL).append("\"");
|
||||
if (privateTrackers.contains(t.announceURL)) {
|
||||
buf.append(" checked=\"checked\"");
|
||||
@ -1691,17 +1726,17 @@ public class I2PSnarkServlet extends DefaultServlet {
|
||||
}
|
||||
}
|
||||
buf.append(">" +
|
||||
"</td><td align=\"left\">").append(urlify(announceURL, 35))
|
||||
"</td><td>").append(urlify(announceURL, 35))
|
||||
.append("</td></tr>\n");
|
||||
}
|
||||
buf.append("<tr><td align=\"center\"><b>")
|
||||
buf.append("<tr><td><b>")
|
||||
.append(_("Add")).append(":</b></td>" +
|
||||
"<td align=\"left\"><input type=\"text\" size=\"16\" name=\"tname\"></td>" +
|
||||
"<td align=\"left\"><input type=\"text\" size=\"40\" name=\"thurl\"></td>" +
|
||||
"<td align=\"center\"><input type=\"checkbox\" class=\"optbox\" name=\"_add_open_\"></td>" +
|
||||
"<td align=\"center\"><input type=\"checkbox\" class=\"optbox\" name=\"_add_private_\"></td>" +
|
||||
"<td align=\"left\"><input type=\"text\" size=\"40\" name=\"taurl\"></td></tr>\n" +
|
||||
"<tr><td colspan=\"2\"></td><td colspan=\"4\" align=\"left\">\n" +
|
||||
"<td><input type=\"text\" class=\"trackername\" name=\"tname\"></td>" +
|
||||
"<td><input type=\"text\" class=\"trackerhome\" name=\"thurl\"></td>" +
|
||||
"<td><input type=\"checkbox\" class=\"optbox\" name=\"_add_open_\"></td>" +
|
||||
"<td><input type=\"checkbox\" class=\"optbox\" name=\"_add_private_\"></td>" +
|
||||
"<td><input type=\"text\" class=\"trackerannounce\" name=\"taurl\"></td></tr>\n" +
|
||||
"<tr><td colspan=\"2\"></td><td colspan=\"4\">\n" +
|
||||
"<input type=\"submit\" name=\"taction\" class=\"default\" value=\"").append(_("Add tracker")).append("\">\n" +
|
||||
"<input type=\"submit\" name=\"taction\" class=\"delete\" value=\"").append(_("Delete selected")).append("\">\n" +
|
||||
"<input type=\"submit\" name=\"taction\" class=\"accept\" value=\"").append(_("Save tracker configuration")).append("\">\n" +
|
||||
@ -1984,7 +2019,7 @@ public class I2PSnarkServlet extends DefaultServlet {
|
||||
|
||||
private static final String TABLE_HEADER = "<table border=\"0\" class=\"snarkTorrents\" width=\"100%\" >\n" +
|
||||
"<thead>\n" +
|
||||
"<tr><th colspan=\"2\">";
|
||||
"<tr><th>";
|
||||
|
||||
private static final String FOOTER = "</div></center></body></html>";
|
||||
|
||||
@ -2059,40 +2094,34 @@ public class I2PSnarkServlet extends DefaultServlet {
|
||||
boolean showPriority = ls != null && snark != null && snark.getStorage() != null && !snark.getStorage().complete();
|
||||
if (showPriority)
|
||||
buf.append("<form action=\"").append(base).append("\" method=\"POST\">\n");
|
||||
buf.append("<TABLE BORDER=0 class=\"snarkTorrents\" ><thead>");
|
||||
if (snark != null) {
|
||||
// first row - torrent info
|
||||
// FIXME center
|
||||
buf.append("<tr><th colspan=\"" + (showPriority ? '4' : '3') + "\"><div>")
|
||||
.append(_("Torrent")).append(": ").append(snark.getBaseName());
|
||||
int pieces = snark.getPieces();
|
||||
double completion = (pieces - snark.getNeeded()) / (double) pieces;
|
||||
if (completion < 1.0)
|
||||
buf.append("<br>").append(_("Completion")).append(": ").append((new DecimalFormat("0.00%")).format(completion));
|
||||
else
|
||||
buf.append("<br>").append(_("Complete"));
|
||||
// else unknown
|
||||
long needed = snark.getNeededLength();
|
||||
if (needed > 0)
|
||||
buf.append("<br>").append(_("Remaining")).append(": ").append(formatSize(needed));
|
||||
buf.append("<br>").append(_("Size")).append(": ").append(formatSize(snark.getTotalLength()));
|
||||
MetaInfo meta = snark.getMetaInfo();
|
||||
if (meta != null) {
|
||||
List files = meta.getFiles();
|
||||
int fileCount = files != null ? files.size() : 1;
|
||||
buf.append("<br>").append(_("Files")).append(": ").append(fileCount);
|
||||
}
|
||||
buf.append("<br>").append(_("Pieces")).append(": ").append(pieces);
|
||||
buf.append("<br>").append(_("Piece size")).append(": ").append(formatSize(snark.getPieceLength(0)));
|
||||
// first table - torrent info
|
||||
buf.append("<table class=\"snarkTorrentInfo\">\n");
|
||||
buf.append("<tr><th><b>")
|
||||
.append(_("Torrent"))
|
||||
.append(":</b> ")
|
||||
.append(snark.getBaseName())
|
||||
.append("</th></tr>\n");
|
||||
|
||||
buf.append("<tr><td>")
|
||||
.append("<img alt=\"\" border=\"0\" src=\"" + _imgPath + "file.png\" > <b>")
|
||||
.append(_("Torrent file"))
|
||||
.append(":</b> ")
|
||||
.append(snark.getName())
|
||||
.append("</td></tr>\n");
|
||||
|
||||
MetaInfo meta = snark.getMetaInfo();
|
||||
if (meta != null) {
|
||||
String announce = meta.getAnnounce();
|
||||
if (announce != null) {
|
||||
buf.append("<br>");
|
||||
buf.append("<tr><td>");
|
||||
String trackerLink = getTrackerLink(announce, snark.getInfoHash());
|
||||
if (trackerLink != null)
|
||||
buf.append(trackerLink).append(' ');
|
||||
buf.append(_("Tracker")).append(": ");
|
||||
buf.append("<b>").append(_("Tracker")).append(":</b> ");
|
||||
String trackerLinkUrl = getTrackerLinkUrl(announce, snark.getInfoHash());
|
||||
if (trackerLinkUrl != null)
|
||||
buf.append(trackerLinkUrl);
|
||||
if (announce.startsWith("http://"))
|
||||
announce = announce.substring(7);
|
||||
int slsh = announce.indexOf('/');
|
||||
@ -2101,53 +2130,119 @@ public class I2PSnarkServlet extends DefaultServlet {
|
||||
if (announce.length() > 67)
|
||||
announce = announce.substring(0, 40) + "…" + announce.substring(announce.length() - 8);
|
||||
buf.append(announce);
|
||||
if (trackerLinkUrl != null)
|
||||
buf.append("</a>");
|
||||
buf.append("</td></tr>");
|
||||
}
|
||||
}
|
||||
|
||||
String hex = I2PSnarkUtil.toHex(snark.getInfoHash());
|
||||
if (meta == null || !meta.isPrivate()) {
|
||||
buf.append("<br>").append(toImg("magnet", _("Magnet link"))).append(" <a href=\"")
|
||||
buf.append("<tr><td><a href=\"")
|
||||
.append(MAGNET_FULL).append(hex).append("\">")
|
||||
.append(MAGNET_FULL).append(hex).append("</a>");
|
||||
.append(toImg("magnet", _("Magnet link")))
|
||||
.append("</a> <b>Magnet:</b> <a href=\"")
|
||||
.append(MAGNET_FULL).append(hex).append("\">")
|
||||
.append(MAGNET_FULL).append(hex).append("</a>")
|
||||
.append("</td></tr>\n");
|
||||
} else {
|
||||
buf.append("<br>").append(_("Private torrent"));
|
||||
buf.append("<tr><td>")
|
||||
.append(_("Private torrent"))
|
||||
.append("</td></tr>\n");
|
||||
}
|
||||
// We don't have the hash of the torrent file
|
||||
//buf.append("<br>").append(_("Maggot link")).append(": <a href=\"").append(MAGGOT).append(hex).append(':').append(hex).append("\">")
|
||||
// .append(MAGGOT).append(hex).append(':').append(hex).append("</a>");
|
||||
buf.append("<br>").append(_("Torrent file")).append(": ").append(snark.getName());
|
||||
buf.append("</div></th></tr>");
|
||||
//buf.append("<tr><td>").append(_("Maggot link")).append(": <a href=\"").append(MAGGOT).append(hex).append(':').append(hex).append("\">")
|
||||
// .append(MAGGOT).append(hex).append(':').append(hex).append("</a></td></tr>");
|
||||
|
||||
buf.append("<tr><td>")
|
||||
.append("<img alt=\"\" border=\"0\" src=\"" + _imgPath + "size.png\" > <b>")
|
||||
.append(_("Size"))
|
||||
.append(":</b> ")
|
||||
.append(formatSize(snark.getTotalLength()));
|
||||
int pieces = snark.getPieces();
|
||||
double completion = (pieces - snark.getNeeded()) / (double) pieces;
|
||||
if (completion < 1.0)
|
||||
buf.append(" <img alt=\"\" border=\"0\" src=\"" + _imgPath + "head_rx.png\" > <b>")
|
||||
.append(_("Completion"))
|
||||
.append(":</b> ")
|
||||
.append((new DecimalFormat("0.00%")).format(completion));
|
||||
else
|
||||
buf.append(" <img alt=\"\" border=\"0\" src=\"" + _imgPath + "head_rx.png\" > ")
|
||||
.append(_("Complete"));
|
||||
// else unknown
|
||||
long needed = snark.getNeededLength();
|
||||
if (needed > 0)
|
||||
buf.append(" <img alt=\"\" border=\"0\" src=\"" + _imgPath + "head_rx.png\" > <b>")
|
||||
.append(_("Remaining"))
|
||||
.append(":</b> ")
|
||||
.append(formatSize(needed));
|
||||
if (meta != null) {
|
||||
List files = meta.getFiles();
|
||||
int fileCount = files != null ? files.size() : 1;
|
||||
buf.append(" <img alt=\"\" border=\"0\" src=\"" + _imgPath + "file.png\" > <b>")
|
||||
.append(_("Files"))
|
||||
.append(":</b> ")
|
||||
.append(fileCount);
|
||||
}
|
||||
buf.append(" <img alt=\"\" border=\"0\" src=\"" + _imgPath + "file.png\" > <b>")
|
||||
.append(_("Pieces"))
|
||||
.append(":</b> ")
|
||||
.append(pieces);
|
||||
buf.append(" <img alt=\"\" border=\"0\" src=\"" + _imgPath + "file.png\" > <b>")
|
||||
.append(_("Piece size"))
|
||||
.append(":</b> ")
|
||||
.append(formatSize(snark.getPieceLength(0)))
|
||||
.append("</td></tr>\n");
|
||||
} else {
|
||||
// shouldn't happen
|
||||
buf.append("<tr><th>Not found<br>resource=\"").append(r.toString())
|
||||
.append("\"<br>base=\"").append(base)
|
||||
.append("\"<br>torrent=\"").append(torrentName)
|
||||
.append("\"</th></tr>");
|
||||
.append("\"</th></tr>\n");
|
||||
}
|
||||
buf.append("</table>\n");
|
||||
if (ls == null) {
|
||||
// We are only showing the torrent info section
|
||||
buf.append("</thead></table></div></div></BODY></HTML>");
|
||||
buf.append("</div></div></BODY></HTML>");
|
||||
return buf.toString();
|
||||
}
|
||||
|
||||
// second row - dir info
|
||||
buf.append("<tr><th>")
|
||||
.append("<img alt=\"\" border=\"0\" src=\"" + _imgPath + "file.png\" > ")
|
||||
.append(_("Directory")).append(": ").append(directory).append("</th><th align=\"right\">")
|
||||
.append("<img alt=\"\" border=\"0\" src=\"" + _imgPath + "size.png\" > ")
|
||||
.append(_("Size"));
|
||||
buf.append("</th><th class=\"headerstatus\">")
|
||||
.append("<img alt=\"\" border=\"0\" src=\"" + _imgPath + "status.png\" > ")
|
||||
.append(_("Status")).append("</th>");
|
||||
// second table - dir info
|
||||
buf.append("<table class=\"snarkDirInfo\"><thead>\n");
|
||||
buf.append("<tr>\n")
|
||||
.append("<th colspan=2>")
|
||||
.append("<img border=\"0\" src=\"" + _imgPath + "file.png\" title=\"")
|
||||
.append(_("Directory"))
|
||||
.append(": ")
|
||||
.append(directory)
|
||||
.append("\" alt=\"")
|
||||
.append(_("Directory"))
|
||||
.append("\"></th>\n");
|
||||
buf.append("<th align=\"right\">")
|
||||
.append("<img border=\"0\" src=\"" + _imgPath + "size.png\" title=\"")
|
||||
.append(_("Size"))
|
||||
.append("\" alt=\"")
|
||||
.append(_("Size"))
|
||||
.append("\"></th>\n");
|
||||
buf.append("<th class=\"headerstatus\">")
|
||||
.append("<img border=\"0\" src=\"" + _imgPath + "status.png\" title=\"")
|
||||
.append(_("Status"))
|
||||
.append("\" alt=\"")
|
||||
.append(_("Status"))
|
||||
.append("\"></th>\n");
|
||||
if (showPriority)
|
||||
buf.append("<th class=\"headerpriority\">")
|
||||
.append("<img alt=\"\" border=\"0\" src=\"" + _imgPath + "priority.png\" > ")
|
||||
.append(_("Priority")).append("</th>");
|
||||
buf.append("</tr></thead>\n");
|
||||
buf.append("<tr><td colspan=\"" + (showPriority ? '4' : '3') + "\" class=\"ParentDir\"><A HREF=\"");
|
||||
.append("<img border=\"0\" src=\"" + _imgPath + "priority.png\" title=\"")
|
||||
.append(_("Priority"))
|
||||
.append("\" alt=\"")
|
||||
.append(_("Priority"))
|
||||
.append("\"></th>\n");
|
||||
buf.append("</tr>\n</thead>\n");
|
||||
buf.append("<tr><td colspan=\"" + (showPriority ? '5' : '4') + "\" class=\"ParentDir\"><A HREF=\"");
|
||||
buf.append(URIUtil.addPaths(base,"../"));
|
||||
buf.append("\"><img alt=\"\" border=\"0\" src=\"" + _imgPath + "up.png\"> ")
|
||||
.append(_("Up to higher level directory")).append("</A></td></tr>\n");
|
||||
.append(_("Up to higher level directory"))
|
||||
.append("</A></td></tr>\n");
|
||||
|
||||
|
||||
//DateFormat dfmt=DateFormat.getDateTimeInstance(DateFormat.MEDIUM,
|
||||
@ -2163,8 +2258,7 @@ public class I2PSnarkServlet extends DefaultServlet {
|
||||
Resource item = r.addPath(ls[i]);
|
||||
|
||||
String rowClass = (i % 2 == 0 ? "snarkTorrentEven" : "snarkTorrentOdd");
|
||||
buf.append("<TR class=\"").append(rowClass).append("\"><TD class=\"snarkFileName ")
|
||||
.append(rowClass).append("\">");
|
||||
buf.append("<TR class=\"").append(rowClass).append("\">");
|
||||
|
||||
// Get completeness and status string
|
||||
boolean complete = false;
|
||||
@ -2200,7 +2294,7 @@ public class I2PSnarkServlet extends DefaultServlet {
|
||||
status = toImg("clock_red");
|
||||
status += " " +
|
||||
(100 * (length - remaining) / length) + "% " + _("complete") +
|
||||
" (" + DataHelper.formatSize2(remaining) + _("bytes remaining") + ")";
|
||||
" (" + DataHelper.formatSize2(remaining) + "B " + _("remaining") + ")";
|
||||
}
|
||||
} else {
|
||||
status = "Not a file?";
|
||||
@ -2216,6 +2310,8 @@ public class I2PSnarkServlet extends DefaultServlet {
|
||||
path=URIUtil.addPaths(path,"/");
|
||||
String icon = toIcon(item);
|
||||
|
||||
buf.append("<TD class=\"snarkFileIcon ")
|
||||
.append(rowClass).append("\">");
|
||||
if (complete) {
|
||||
buf.append("<a href=\"").append(path).append("\">");
|
||||
// thumbnail ?
|
||||
@ -2227,12 +2323,13 @@ public class I2PSnarkServlet extends DefaultServlet {
|
||||
} else {
|
||||
buf.append(toImg(icon, _("Open"))).append("</a>");
|
||||
}
|
||||
buf.append("<A HREF=\"");
|
||||
buf.append(path);
|
||||
buf.append("\">");
|
||||
} else {
|
||||
buf.append(toImg(icon)).append(' ');
|
||||
buf.append(toImg(icon));
|
||||
}
|
||||
buf.append("</TD><TD class=\"snarkFileName ")
|
||||
.append(rowClass).append("\">");
|
||||
if (complete)
|
||||
buf.append("<a href=\"").append(path).append("\">");
|
||||
buf.append(ls[i]);
|
||||
if (complete)
|
||||
buf.append("</a>");
|
||||
@ -2269,11 +2366,11 @@ public class I2PSnarkServlet extends DefaultServlet {
|
||||
buf.append("</TR>\n");
|
||||
}
|
||||
if (showSaveButton) {
|
||||
buf.append("<thead><tr><th colspan=\"3\"> </th><th class=\"headerpriority\"><input type=\"submit\" value=\"");
|
||||
buf.append("<thead><tr><th colspan=\"4\"> </th><th class=\"headerpriority\"><input type=\"submit\" value=\"");
|
||||
buf.append(_("Save priorities"));
|
||||
buf.append("\" name=\"foo\" ></th></tr></thead>\n");
|
||||
}
|
||||
buf.append("</TABLE>\n");
|
||||
buf.append("</table>\n");
|
||||
if (showPriority)
|
||||
buf.append("</form>");
|
||||
buf.append("</div></div></BODY></HTML>\n");
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -74,6 +74,9 @@ public class I2PTunnelServer extends I2PTunnelTask implements Runnable {
|
||||
protected int localPort = DEFAULT_LOCALPORT;
|
||||
|
||||
/**
|
||||
* Warning, blocks in constructor while connecting to router and building tunnels;
|
||||
* TODO move that to startRunning()
|
||||
*
|
||||
* @param privData Base64-encoded private key data,
|
||||
* format is specified in {@link net.i2p.data.PrivateKeyFile PrivateKeyFile}
|
||||
* @throws IllegalArgumentException if the I2CP configuration is b0rked so
|
||||
@ -87,6 +90,9 @@ public class I2PTunnelServer extends I2PTunnelTask implements Runnable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Warning, blocks in constructor while connecting to router and building tunnels;
|
||||
* TODO move that to startRunning()
|
||||
*
|
||||
* @param privkey file containing the private key data,
|
||||
* format is specified in {@link net.i2p.data.PrivateKeyFile PrivateKeyFile}
|
||||
* @param privkeyname the name of the privKey file, not clear why we need this too
|
||||
@ -111,6 +117,9 @@ public class I2PTunnelServer extends I2PTunnelTask implements Runnable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Warning, blocks in constructor while connecting to router and building tunnels;
|
||||
* TODO move that to startRunning()
|
||||
*
|
||||
* @param privData stream containing the private key data,
|
||||
* format is specified in {@link net.i2p.data.PrivateKeyFile PrivateKeyFile}
|
||||
* @param privkeyname the name of the privKey file, not clear why we need this too
|
||||
@ -124,6 +133,8 @@ public class I2PTunnelServer extends I2PTunnelTask implements Runnable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Non-blocking
|
||||
*
|
||||
* @param sktMgr the existing socket manager
|
||||
* @since 0.8.9
|
||||
*/
|
||||
@ -142,6 +153,9 @@ public class I2PTunnelServer extends I2PTunnelTask implements Runnable {
|
||||
private static final int MAX_RETRIES = 4;
|
||||
|
||||
/**
|
||||
* Warning, blocks while connecting to router and building tunnels;
|
||||
* TODO move that to startRunning()
|
||||
*
|
||||
* @param privData stream containing the private key data,
|
||||
* format is specified in {@link net.i2p.data.PrivateKeyFile PrivateKeyFile}
|
||||
* @param privkeyname the name of the privKey file, not clear why we need this too
|
||||
@ -236,6 +250,7 @@ public class I2PTunnelServer extends I2PTunnelTask implements Runnable {
|
||||
/**
|
||||
* Start running the I2PTunnelServer.
|
||||
*
|
||||
* TODO: Wait to connect to router until here.
|
||||
*/
|
||||
public void startRunning() {
|
||||
// prevent JVM exit when running outside the router
|
||||
|
@ -156,8 +156,8 @@ public class TunnelController implements Logging {
|
||||
}
|
||||
String type = getType();
|
||||
if ( (type == null) || (type.length() <= 0) ) {
|
||||
if (_log.shouldLog(Log.WARN))
|
||||
_log.warn("Cannot start the tunnel - no type specified");
|
||||
if (_log.shouldLog(Log.ERROR))
|
||||
_log.error("Cannot start the tunnel - no type specified");
|
||||
return;
|
||||
}
|
||||
// Config options may have changed since instantiation, so do this again.
|
||||
@ -455,6 +455,25 @@ public class TunnelController implements Logging {
|
||||
}
|
||||
}
|
||||
_config = props;
|
||||
|
||||
// Set up some per-type defaults
|
||||
// This really isn't the best spot to do this but for servers in particular,
|
||||
// it's hard to override settings in the subclass since the session connect
|
||||
// is done in the I2PTunnelServer constructor.
|
||||
String type = getType();
|
||||
if (type != null) {
|
||||
if (type.equals("httpserver") || type.equals("streamrserver")) {
|
||||
if (!_config.containsKey("option.shouldBundleReplyInfo"))
|
||||
_config.setProperty("option.shouldBundleReplyInfo", "false");
|
||||
} else if (type.contains("irc") || type.equals("streamrclient")) {
|
||||
// maybe a bad idea for ircclient if DCC is enabled
|
||||
if (!_config.containsKey("option.crypto.tagsToSend"))
|
||||
_config.setProperty("option.crypto.tagsToSend", "20");
|
||||
if (!_config.containsKey("option.crypto.lowTagThreshold"))
|
||||
_config.setProperty("option.crypto.lowTagThreshold", "14");
|
||||
}
|
||||
}
|
||||
|
||||
// tell i2ptunnel, who will tell the TunnelTask, who will tell the SocketManager
|
||||
setSessionOptions();
|
||||
if (_running && _sessions != null) {
|
||||
@ -467,6 +486,9 @@ public class TunnelController implements Logging {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return a copy
|
||||
*/
|
||||
public Properties getConfig(String prefix) {
|
||||
Properties rv = new Properties();
|
||||
for (Map.Entry e : _config.entrySet()) {
|
||||
|
@ -19,9 +19,10 @@
|
||||
<title><%=intl._("I2P Tunnel Manager - Edit Client Tunnel")%></title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
||||
<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=UTF-8" />
|
||||
<link href="/themes/console/images/favicon.ico" type="image/x-icon" rel="shortcut icon" />
|
||||
|
||||
<% if (editBean.allowCSS()) {
|
||||
%><link href="/themes/console/images/favicon.ico" type="image/x-icon" rel="shortcut icon" />
|
||||
%><link rel="icon" href="<%=editBean.getTheme()%>images/favicon.ico" />
|
||||
<link href="<%=editBean.getTheme()%>default.css" rel="stylesheet" type="text/css" />
|
||||
<link href="<%=editBean.getTheme()%>i2ptunnel.css" rel="stylesheet" type="text/css" />
|
||||
<% }
|
||||
|
@ -19,9 +19,10 @@
|
||||
<title><%=intl._("I2P Tunnel Manager - Edit Server Tunnel")%></title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
||||
<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=UTF-8" />
|
||||
<link href="/themes/console/images/favicon.ico" type="image/x-icon" rel="shortcut icon" />
|
||||
|
||||
<% if (editBean.allowCSS()) {
|
||||
%><link href="/themes/console/images/favicon.ico" type="image/x-icon" rel="shortcut icon" />
|
||||
%><link rel="icon" href="<%=editBean.getTheme()%>images/favicon.ico" />
|
||||
<link href="<%=editBean.getTheme()%>default.css" rel="stylesheet" type="text/css" />
|
||||
<link href="<%=editBean.getTheme()%>i2ptunnel.css" rel="stylesheet" type="text/css" />
|
||||
<% }
|
||||
|
@ -24,7 +24,8 @@
|
||||
<link href="/themes/console/images/favicon.ico" type="image/x-icon" rel="shortcut icon" />
|
||||
|
||||
<% if (indexBean.allowCSS()) {
|
||||
%><link href="<%=indexBean.getTheme()%>default.css" rel="stylesheet" type="text/css" />
|
||||
%><link rel="icon" href="<%=indexBean.getTheme()%>images/favicon.ico" />
|
||||
<link href="<%=indexBean.getTheme()%>default.css" rel="stylesheet" type="text/css" />
|
||||
<link href="<%=indexBean.getTheme()%>i2ptunnel.css" rel="stylesheet" type="text/css" />
|
||||
<% }
|
||||
%>
|
||||
@ -115,7 +116,7 @@
|
||||
<%
|
||||
if (("httpserver".equals(indexBean.getInternalType(curServer)) || ("httpbidirserver".equals(indexBean.getInternalType(curServer)))) && indexBean.getTunnelStatus(curServer) == IndexBean.RUNNING) {
|
||||
%><label><%=intl._("Preview")%>:</label>
|
||||
<a class="control" title="Test HTTP server through I2P" href="http://<%=indexBean.getDestHashBase32(curServer)%>.b32.i2p"><%=intl._("Preview")%></a>
|
||||
<a class="control" title="Test HTTP server through I2P" href="http://<%=indexBean.getDestHashBase32(curServer)%>.b32.i2p" target="_parent"><%=intl._("Preview")%></a>
|
||||
<%
|
||||
} else if (indexBean.getTunnelStatus(curServer) == IndexBean.RUNNING) {
|
||||
%><span class="text"><%=intl._("Base32 Address")%>:<br /><%=indexBean.getDestHashBase32(curServer)%>.b32.i2p</span>
|
||||
|
@ -57,7 +57,8 @@
|
||||
<link href="/themes/console/images/favicon.ico" type="image/x-icon" rel="shortcut icon" />
|
||||
|
||||
<% if (editBean.allowCSS()) {
|
||||
%><link href="<%=editBean.getTheme()%>default.css" rel="stylesheet" type="text/css" />
|
||||
%><link rel="icon" href="<%=editBean.getTheme()%>images/favicon.ico" />
|
||||
<link href="<%=editBean.getTheme()%>default.css" rel="stylesheet" type="text/css" />
|
||||
<link href="<%=editBean.getTheme()%>i2ptunnel.css" rel="stylesheet" type="text/css" />
|
||||
<% }
|
||||
%>
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -19,6 +19,8 @@ public class CSSHelper extends HelperBase {
|
||||
private static final String FORCE = "classic";
|
||||
public static final String PROP_REFRESH = "routerconsole.summaryRefresh";
|
||||
public static final String DEFAULT_REFRESH = "60";
|
||||
public static final int MIN_REFRESH = 3;
|
||||
public static final String PROP_DISABLE_REFRESH = "routerconsole.summaryDisableRefresh";
|
||||
private static final String PROP_XFRAME = "routerconsole.disableXFrame";
|
||||
|
||||
public String getTheme(String userAgent) {
|
||||
@ -70,12 +72,42 @@ public class CSSHelper extends HelperBase {
|
||||
|
||||
/** change refresh and save it */
|
||||
public void setRefresh(String r) {
|
||||
try {
|
||||
if (Integer.parseInt(r) < MIN_REFRESH)
|
||||
r = "" + MIN_REFRESH;
|
||||
} catch (Exception e) {
|
||||
}
|
||||
_context.router().saveConfig(PROP_REFRESH, r);
|
||||
}
|
||||
|
||||
/** @return refresh time in seconds, as a string */
|
||||
public String getRefresh() {
|
||||
return _context.getProperty(PROP_REFRESH, DEFAULT_REFRESH);
|
||||
String r = _context.getProperty(PROP_REFRESH, DEFAULT_REFRESH);
|
||||
try {
|
||||
if (Integer.parseInt(r) < MIN_REFRESH)
|
||||
r = "" + MIN_REFRESH;
|
||||
} catch (Exception e) {
|
||||
}
|
||||
return r;
|
||||
}
|
||||
|
||||
/**
|
||||
* change disable refresh boolean and save it
|
||||
* @since 0.9.1
|
||||
*/
|
||||
public void setDisableRefresh(String r) {
|
||||
String disableRefresh = "false";
|
||||
if ("0".equals(r))
|
||||
disableRefresh = "true";
|
||||
_context.router().saveConfig(PROP_DISABLE_REFRESH, disableRefresh);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return true if refresh is disabled
|
||||
* @since 0.9.1
|
||||
*/
|
||||
public boolean getDisableRefresh() {
|
||||
return _context.getBooleanProperty(PROP_DISABLE_REFRESH);
|
||||
}
|
||||
|
||||
/** translate the title and display consistently */
|
||||
|
@ -72,7 +72,13 @@ public class ConfigHomeHandler extends FormHandler {
|
||||
}
|
||||
name = DataHelper.escapeHTML(name).replace(",", ","); // HomeHelper.S
|
||||
url = DataHelper.escapeHTML(url).replace(",", ",");
|
||||
HomeHelper.App app = new HomeHelper.App(name, "", url, "/themes/console/images/itoopie_sm.png");
|
||||
HomeHelper.App app = null;
|
||||
if ("1".equals(group))
|
||||
app = new HomeHelper.App(name, "", url, "/themes/console/images/eepsite.png");
|
||||
else if ("2".equals(group))
|
||||
app = new HomeHelper.App(name, "", url, "/themes/console/images/title_window.png");
|
||||
else
|
||||
app = new HomeHelper.App(name, "", url, "/themes/console/images/question.png");
|
||||
apps.add(app);
|
||||
addFormNotice(_("Added") + ": " + app.name);
|
||||
} else {
|
||||
|
@ -11,12 +11,12 @@ public class ConfigNavHelper extends HelperBase {
|
||||
|
||||
/** configX.jsp */
|
||||
private static final String pages[] =
|
||||
{"", "net", "ui", "home", "service", "update", "tunnels",
|
||||
{"", "net", "ui", "sidebar", "home", "service", "update", "tunnels",
|
||||
"clients", "peer", "keyring", "logging", "stats",
|
||||
"reseed", "advanced" };
|
||||
|
||||
private static final String titles[] =
|
||||
{_x("Bandwidth"), _x("Network"), _x("UI"), _x("Home Page"),
|
||||
{_x("Bandwidth"), _x("Network"), _x("UI"), _x("Summary Bar"), _x("Home Page"),
|
||||
_x("Service"), _x("Update"), _x("Tunnels"),
|
||||
_x("Clients"), _x("Peers"), _x("Keyring"), _x("Logging"), _x("Stats"),
|
||||
_x("Reseeding"), _x("Advanced") };
|
||||
|
@ -0,0 +1,168 @@
|
||||
package net.i2p.router.web;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.TreeMap;
|
||||
|
||||
import net.i2p.data.DataHelper;
|
||||
|
||||
/**
|
||||
* Simple summary bar configuration.
|
||||
*
|
||||
* @since 0.9.1
|
||||
*/
|
||||
public class ConfigSummaryHandler extends FormHandler {
|
||||
|
||||
private Map _settings;
|
||||
|
||||
@Override
|
||||
protected void processForm() {
|
||||
if (_action == null) return;
|
||||
String group = getJettyString("group");
|
||||
boolean deleting = _action.equals(_("Delete selected"));
|
||||
boolean adding = _action.equals(_("Add item"));
|
||||
boolean saving = _action.equals(_("Save order"));
|
||||
boolean moving = _action.startsWith("move_");
|
||||
if (_action.equals(_("Save")) && "0".equals(group)) {
|
||||
try {
|
||||
int refreshInterval = Integer.parseInt(getJettyString("refreshInterval"));
|
||||
if (refreshInterval >= CSSHelper.MIN_REFRESH) {
|
||||
_context.router().saveConfig(CSSHelper.PROP_REFRESH, "" + refreshInterval);
|
||||
addFormNotice(_("Refresh interval changed"));
|
||||
} else
|
||||
addFormError(_("Refresh interval must be at least {0} seconds", CSSHelper.MIN_REFRESH));
|
||||
} catch (java.lang.NumberFormatException e) {
|
||||
addFormError(_("Refresh interval must be a number"));
|
||||
return;
|
||||
}
|
||||
} else if (_action.equals(_("Restore full default"))) {
|
||||
_context.router().saveConfig(SummaryHelper.PROP_SUMMARYBAR + "default", SummaryHelper.DEFAULT_FULL);
|
||||
addFormNotice(_("Full summary bar default restored.") + " " +
|
||||
_("Summary bar will refresh shortly."));
|
||||
} else if (_action.equals(_("Restore minimal default"))) {
|
||||
_context.router().saveConfig(SummaryHelper.PROP_SUMMARYBAR + "default", SummaryHelper.DEFAULT_MINIMAL);
|
||||
addFormNotice(_("Minimal summary bar default restored.") + " " +
|
||||
_("Summary bar will refresh shortly."));
|
||||
} else if (adding || deleting || saving || moving) {
|
||||
Map<Integer, String> sections = new TreeMap<Integer, String>();
|
||||
for (Object o : _settings.keySet()) {
|
||||
if (!(o instanceof String))
|
||||
continue;
|
||||
String k = (String) o;
|
||||
if (!k.startsWith("order_"))
|
||||
continue;
|
||||
String v = getJettyString(k);
|
||||
k = k.substring(6);
|
||||
k = k.substring(k.indexOf('_') + 1);
|
||||
try {
|
||||
int order = Integer.parseInt(v);
|
||||
sections.put(order, k);
|
||||
} catch (java.lang.NumberFormatException e) {
|
||||
addFormError(_("Order must be an integer"));
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (adding) {
|
||||
String name = getJettyString("name");
|
||||
if (name == null || name.length() <= 0) {
|
||||
addFormError(_("No section selected"));
|
||||
return;
|
||||
}
|
||||
String order = getJettyString("order");
|
||||
if (order == null || order.length() <= 0) {
|
||||
addFormError(_("No order entered"));
|
||||
return;
|
||||
}
|
||||
name = DataHelper.escapeHTML(name).replace(",", ",");
|
||||
order = DataHelper.escapeHTML(order).replace(",", ",");
|
||||
try {
|
||||
int ki = Integer.parseInt(order);
|
||||
sections.put(ki, name);
|
||||
addFormNotice(_("Added") + ": " + name);
|
||||
} catch (java.lang.NumberFormatException e) {
|
||||
addFormError(_("Order must be an integer"));
|
||||
return;
|
||||
}
|
||||
} else if (deleting) {
|
||||
Set<Integer> toDelete = new HashSet();
|
||||
for (Object o : _settings.keySet()) {
|
||||
if (!(o instanceof String))
|
||||
continue;
|
||||
String k = (String) o;
|
||||
if (!k.startsWith("delete_"))
|
||||
continue;
|
||||
k = k.substring(7);
|
||||
try {
|
||||
int ki = Integer.parseInt(k);
|
||||
toDelete.add(ki);
|
||||
} catch (java.lang.NumberFormatException e) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
for (Iterator<Integer> iter = sections.keySet().iterator(); iter.hasNext(); ) {
|
||||
int i = iter.next();
|
||||
if (toDelete.contains(i)) {
|
||||
String removedName = sections.get(i);
|
||||
iter.remove();
|
||||
addFormNotice(_("Removed") + ": " + removedName);
|
||||
}
|
||||
}
|
||||
} else if (moving) {
|
||||
String parts[] = _action.split("_");
|
||||
try {
|
||||
int from = Integer.parseInt(parts[1]);
|
||||
int to = 0;
|
||||
if ("up".equals(parts[2]))
|
||||
to = from - 1;
|
||||
if ("down".equals(parts[2]))
|
||||
to = from + 1;
|
||||
if ("bottom".equals(parts[2]))
|
||||
to = sections.size() - 1;
|
||||
int n = -1;
|
||||
if ("down".equals(parts[2]) || "bottom".equals(parts[2]))
|
||||
n = 1;
|
||||
for (int i = from; n * i < n * to; i += n) {
|
||||
String temp = sections.get(i + n);
|
||||
sections.put(i + n, sections.get(i));
|
||||
sections.put(i, temp);
|
||||
}
|
||||
addFormNotice(_("Moved") + ": " + sections.get(to));
|
||||
} catch (java.lang.NumberFormatException e) {
|
||||
addFormError(_("Order must be an integer"));
|
||||
return;
|
||||
}
|
||||
}
|
||||
SummaryHelper.saveSummaryBarSections(_context, "default", sections);
|
||||
addFormNotice(_("Saved order of sections.") + " " +
|
||||
_("Summary bar will refresh shortly."));
|
||||
} else {
|
||||
addFormError(_("Unsupported"));
|
||||
}
|
||||
}
|
||||
|
||||
public void setSettings(Map settings) { _settings = new HashMap(settings); }
|
||||
|
||||
/** curses Jetty for returning arrays */
|
||||
private String getJettyString(String key) {
|
||||
String[] arr = (String[]) _settings.get(key);
|
||||
if (arr == null)
|
||||
return null;
|
||||
return arr[0].trim();
|
||||
}
|
||||
|
||||
public void setMovingAction() {
|
||||
for (Object o : _settings.keySet()) {
|
||||
if (!(o instanceof String))
|
||||
continue;
|
||||
String k = (String) o;
|
||||
if (k.startsWith("move_") && k.endsWith(".x") && _settings.get(k) != null) {
|
||||
_action = k.substring(0, k.length() - 2);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -53,14 +53,14 @@ public class ConfigUIHelper extends HelperBase {
|
||||
* Any language-specific flag added to the icon set must be
|
||||
* added to the top-level build.xml for the updater.
|
||||
*/
|
||||
private static final String langs[] = {"ar", "cs", "da", "de", "ee", "en", "es", "fi",
|
||||
private static final String langs[] = {"ar", "cs", "da", "de", "ee", "el", "en", "es", "fi",
|
||||
"fr", "hu", "it", "nl", "pl", "pt", "ru",
|
||||
"sv", "uk", "vi", "zh"};
|
||||
private static final String flags[] = {"lang_ar", "cz", "dk", "de", "ee", "us", "es", "fi",
|
||||
private static final String flags[] = {"lang_ar", "cz", "dk", "de", "ee", "gr", "us", "es", "fi",
|
||||
"fr", "hu", "it", "nl", "pl", "pt", "ru",
|
||||
"se", "ua", "vn", "cn"};
|
||||
private static final String xlangs[] = {_x("Arabic"), _x("Czech"), _x("Danish"),
|
||||
_x("German"), _x("Estonian"), _x("English"), _x("Spanish"), _x("Finnish"),
|
||||
_x("German"), _x("Estonian"), _x("Greek"), _x("English"), _x("Spanish"), _x("Finnish"),
|
||||
_x("French"), _x("Hungarian"), _x("Italian"), _x("Dutch"), _x("Polish"),
|
||||
_x("Portuguese"), _x("Russian"), _x("Swedish"),
|
||||
_x("Ukrainian"), _x("Vietnamese"), _x("Chinese")};
|
||||
|
@ -191,7 +191,8 @@ public class GraphHelper extends FormHandler {
|
||||
}
|
||||
|
||||
// FIXME jrobin doesn't support setting the timezone, will have to mod TimeAxis.java
|
||||
_out.write("<p><i>" + _("All times are UTC.") + "</i></p>\n");
|
||||
// 0.9.1 - all graphs currently state UTC on them, so this text blurb is unnecessary,
|
||||
//_out.write("<p><i>" + _("All times are UTC.") + "</i></p>\n");
|
||||
} catch (IOException ioe) {
|
||||
ioe.printStackTrace();
|
||||
}
|
||||
|
@ -24,38 +24,40 @@ public class HomeHelper extends HelperBase {
|
||||
private static final String PROP_SEARCH = "routerconsole.showSearch";
|
||||
|
||||
static final String DEFAULT_SERVICES =
|
||||
_x("Addressbook") + S + _x("Manage your I2P hosts file here (I2P domain name resolution)") + S + "/susidns/index" + S + I + "book_addresses.png" + S +
|
||||
_x("Configure Bandwidth") + S + _x("I2P Bandwidth Configuration") + S + "/config" + S + I + "wrench_orange.png" + S +
|
||||
_x("Addressbook") + S + _x("Manage your I2P hosts file here (I2P domain name resolution)") + S + "/dns" + S + I + "book_addresses.png" + S +
|
||||
_x("Configure Bandwidth") + S + _x("I2P Bandwidth Configuration") + S + "/config" + S + I + "action_log.png" + S +
|
||||
_x("Configure Language") + S + _x("Console Language Selection") + S + "/configui" + S + I + "wrench_orange.png" + S +
|
||||
_x("Customize Home Page") + S + _x("I2P Home Page Configuration") + S + "/confighome" + S + I + "wrench_orange.png" + S +
|
||||
_x("Customize Home Page") + S + _x("I2P Home Page Configuration") + S + "/confighome" + S + I + "home_page.png" + S +
|
||||
_x("Email") + S + _x("Anonymous webmail client") + S + "/susimail/susimail" + S + I + "email.png" + S +
|
||||
_x("Help") + S + _x("I2P Router Help") + S + "/help" + S + I + "help.png" + S +
|
||||
_x("Router Console") + S + _x("I2P Router Console") + S + "/console" + S + I + "wrench_orange.png" + S +
|
||||
_x("Torrents") + S + _x("Built-in anonymous BitTorrent Client") + S + "/i2psnark/" + S + I + "film.png" + S +
|
||||
_x("Website") + S + _x("Local web server") + S + "http://127.0.0.1:7658/" + S + I + "server.png" + S +
|
||||
_x("Help") + S + _x("I2P Router Help") + S + "/help" + S + I + "support.png" + S +
|
||||
_x("Router Console") + S + _x("I2P Router Console") + S + "/console" + S + I + "toolbox.png" + S +
|
||||
_x("Torrents") + S + _x("Built-in anonymous BitTorrent Client") + S + "/i2psnark/" + S + I + "magnet.png" + S +
|
||||
_x("Website") + S + _x("Local web server") + S + "http://127.0.0.1:7658/" + S + I + "server_32x32.png" + S +
|
||||
"";
|
||||
|
||||
static final String DEFAULT_FAVORITES =
|
||||
_x("Bug Reports") + S + _x("Bug tracker") + S + "http://trac.i2p2.i2p/report/1" + S + I + "bug.png" + S +
|
||||
_x("Dev Forum") + S + _x("Development forum") + S + "http://zzz.i2p/" + S + I + "itoopie_sm.png" + S +
|
||||
_x("diftracker") + S + _x("Bittorrent tracker") + S + "http://diftracker.i2p/" + S + I + "itoopie_sm.png" + S +
|
||||
"echelon.i2p" + S + _x("I2P Applications") + S + "http://echelon.i2p/" + S + I + "itoopie_sm.png" + S +
|
||||
_x("FAQ") + S + _x("Frequently Asked Questions") + S + "http://www.i2p2.i2p/faq" + S + I + "help.png" + S +
|
||||
_x("Forum") + S + _x("Community forum") + S + "http://forum.i2p/" + S + I + "itoopie_sm.png" + S +
|
||||
//"ident.i2p" + S + _x("Short message service") + S + "http://ident.i2p/" + S + I + "itoopie_sm.png" + S +
|
||||
_x("Javadocs") + S + _x("Technical documentation") + S + "http://i2p-javadocs.i2p/" + S + I + "book.png" + S +
|
||||
_x("Key Server") + S + _x("OpenPGP Keyserver") + S + "http://keys.i2p/" + S + I + "book.png" + S +
|
||||
_x("killyourtv.i2p") + S + _x("Debian and Tahoe-LAFS repositories") + S + "http://killyourtv.i2p/" + S + I + "itoopie_sm.png" + S +
|
||||
_x("Pastebin") + S + _x("I2P Pastebin") + S + "http://pastethis.i2p/" + S + I + "itoopie_sm.png" + S +
|
||||
"Planet I2P" + S + _x("I2P News") + S + "http://planet.i2p/" + S + I + "itoopie_sm.png" + S +
|
||||
"colombo-bt.i2p" + S + _x("The Italian Bittorrent Resource") + S + "http://colombo-bt.i2p/" + S + I + "colomboicon.png" + S +
|
||||
_x("Dev Forum") + S + _x("Development forum") + S + "http://zzz.i2p/" + S + I + "eepsite.png" + S +
|
||||
_x("diftracker") + S + _x("Bittorrent tracker") + S + "http://diftracker.i2p/" + S + I + "eepsite.png" + S +
|
||||
"echelon.i2p" + S + _x("I2P Applications") + S + "http://echelon.i2p/" + S + I + "eepsite.png" + S +
|
||||
_x("FAQ") + S + _x("Frequently Asked Questions") + S + "http://www.i2p2.i2p/faq" + S + I + "question.png" + S +
|
||||
_x("Forum") + S + _x("Community forum") + S + "http://forum.i2p/" + S + I + "eepsite.png" + S +
|
||||
_x("Anonymous Git Hosting") + S + _x("A public anonymous Git hosting site - supports pulling via Git and HTTP and pushing via SSH") + S + "http://git.repo.i2p/" + S + I + "git-logo.png" + S +
|
||||
"Ident " + _x("Microblog") + S + _x("Your premier microblogging service on I2P") + S + "http://id3nt.i2p/" + S + I + "ident_icon_blue.png" + S +
|
||||
_x("Javadocs") + S + _x("Technical documentation") + S + "http://i2p-javadocs.i2p/" + S + I + "education.png" + S +
|
||||
//_x("Key Server") + S + _x("OpenPGP Keyserver") + S + "http://keys.i2p/" + S + I + "education.png" + S +
|
||||
_x("killyourtv.i2p") + S + _x("Debian and Tahoe-LAFS repositories") + S + "http://killyourtv.i2p/" + S + I + "eepsite.png" + S +
|
||||
_x("Pastebin") + S + _x("I2P Pastebin") + S + "http://pastethis.i2p/" + S + I + "eepsite.png" + S +
|
||||
"Planet I2P" + S + _x("I2P News") + S + "http://planet.i2p/" + S + I + "eepsite.png" + S +
|
||||
_x("Plugins") + S + _x("Add-on directory") + S + "http://plugins.i2p/" + S + I + "plugin.png" + S +
|
||||
_x("Postman's Tracker") + S + _x("Bittorrent tracker") + S + "http://tracker2.postman.i2p/" + S + I + "itoopie_sm.png" + S +
|
||||
_x("Project Website") + S + _x("I2P home page") + S + "http://www.i2p2.i2p/" + S + I + "help.png" + S +
|
||||
"stats.i2p" + S + _x("I2P Netowrk Statistics") + S + "http://stats.i2p/cgi-bin/dashboard.cgi" + S + I + "itoopie_sm.png" + S +
|
||||
_x("Technical Docs") + S + _x("Technical documentation") + S + "http://www.i2p2.i2p/how" + S + I + "book.png" + S +
|
||||
_x("Trac Wiki") + S + S + "http://trac.i2p2.i2p/" + S + I + "itoopie_sm.png" + S +
|
||||
_x("Ugha's Wiki") + S + S + "http://ugha.i2p/" + S + I + "itoopie_sm.png" + S +
|
||||
_x("Sponge's main site") + S + _x("Seedless and the Robert BitTorrent applications") + S + "http://sponge.i2p/" + S + I + "itoopie_sm.png" + S +
|
||||
_x("Postman's Tracker") + S + _x("Bittorrent tracker") + S + "http://tracker2.postman.i2p/" + S + I + "eepsite.png" + S +
|
||||
_x("Project Website") + S + _x("I2P home page") + S + "http://www.i2p2.i2p/" + S + I + "info_rhombus.png" + S +
|
||||
"stats.i2p" + S + _x("I2P Netowrk Statistics") + S + "http://stats.i2p/cgi-bin/dashboard.cgi" + S + I + "eepsite.png" + S +
|
||||
_x("Technical Docs") + S + _x("Technical documentation") + S + "http://www.i2p2.i2p/how" + S + I + "education.png" + S +
|
||||
_x("Trac Wiki") + S + S + "http://trac.i2p2.i2p/" + S + I + "eepsite.png" + S +
|
||||
_x("Ugha's Wiki") + S + S + "http://ugha.i2p/" + S + I + "eepsite.png" + S +
|
||||
_x("Sponge's main site") + S + _x("Seedless and the Robert BitTorrent applications") + S + "http://sponge.i2p/" + S + I + "eepsite.png" + S +
|
||||
"";
|
||||
|
||||
|
||||
|
@ -123,7 +123,7 @@ public class PluginUpdateChecker extends UpdateHandler {
|
||||
}
|
||||
|
||||
private void scheduleStatusClean(String msg) {
|
||||
SimpleScheduler.getInstance().addEvent(new Cleaner(msg), 20*60*1000);
|
||||
_context.simpleScheduler().addEvent(new Cleaner(msg), 20*60*1000);
|
||||
}
|
||||
|
||||
private class Cleaner implements SimpleTimer.TimedEvent {
|
||||
@ -158,7 +158,7 @@ public class PluginUpdateChecker extends UpdateHandler {
|
||||
try {
|
||||
_get = new PartialEepGet(_context, proxyHost, proxyPort, _baos, _xpi2pURL, TrustedUpdate.HEADER_BYTES);
|
||||
_get.addStatusListener(PluginUpdateCheckerRunner.this);
|
||||
_get.fetch();
|
||||
_get.fetch(CONNECT_TIMEOUT);
|
||||
} catch (Throwable t) {
|
||||
_log.error("Error checking update for plugin", t);
|
||||
}
|
||||
|
@ -98,7 +98,7 @@ public class PluginUpdateHandler extends UpdateHandler {
|
||||
}
|
||||
|
||||
private void scheduleStatusClean(String msg) {
|
||||
SimpleScheduler.getInstance().addEvent(new Cleaner(msg), 20*60*1000);
|
||||
_context.simpleScheduler().addEvent(new Cleaner(msg), 20*60*1000);
|
||||
}
|
||||
|
||||
private class Cleaner implements SimpleTimer.TimedEvent {
|
||||
@ -149,7 +149,7 @@ public class PluginUpdateHandler extends UpdateHandler {
|
||||
else
|
||||
_get = new EepGet(_context, 1, _updateFile, _xpi2pURL, false);
|
||||
_get.addStatusListener(PluginUpdateRunner.this);
|
||||
_get.fetch();
|
||||
_get.fetch(CONNECT_TIMEOUT, -1, shouldProxy ? INACTIVITY_TIMEOUT : NOPROXY_INACTIVITY_TIMEOUT);
|
||||
} catch (Throwable t) {
|
||||
_log.error("Error downloading plugin", t);
|
||||
}
|
||||
|
@ -3,6 +3,10 @@ package net.i2p.router.web;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.Writer;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import net.i2p.data.DataHelper;
|
||||
import net.i2p.router.RouterContext;
|
||||
@ -12,6 +16,57 @@ import net.i2p.router.RouterContext;
|
||||
*
|
||||
*/
|
||||
public class SummaryBarRenderer {
|
||||
// Commented out because broken. Replaced by if-elseif blob below.
|
||||
/*static final Map<String, java.lang.reflect.Method> ALL_SECTIONS;
|
||||
static {
|
||||
Map<String, java.lang.reflect.Method> aMap = new HashMap<String, java.lang.reflect.Method>();;
|
||||
try {
|
||||
aMap.put("HelpAndFAQ", SummaryBarRenderer.class.getMethod("renderHelpAndFAQHTML"));
|
||||
aMap.put("I2PServices", SummaryBarRenderer.class.getMethod("renderI2PServicesHTML"));
|
||||
aMap.put("I2PInternals", SummaryBarRenderer.class.getMethod("renderI2PInternalsHTML"));
|
||||
aMap.put("General", SummaryBarRenderer.class.getMethod("renderGeneralHTML"));
|
||||
aMap.put("ShortGeneral", SummaryBarRenderer.class.getMethod("renderShortGeneralHTML"));
|
||||
aMap.put("NetworkReachability", SummaryBarRenderer.class.getMethod("renderNetworkReachabilityHTML"));
|
||||
aMap.put("UpdateStatus", SummaryBarRenderer.class.getMethod("renderUpdateStatusHTML"));
|
||||
aMap.put("RestartStatus", SummaryBarRenderer.class.getMethod("renderRestartStatusHTMLHTML"));
|
||||
aMap.put("Peers", SummaryBarRenderer.class.getMethod("renderPeersHTML"));
|
||||
aMap.put("FirewallAndReseedStatus", SummaryBarRenderer.class.getMethod("renderFirewallAndReseedStatusHTML"));
|
||||
aMap.put("Bandwidth", SummaryBarRenderer.class.getMethod("renderBandwidthHTML"));
|
||||
aMap.put("Tunnels", SummaryBarRenderer.class.getMethod("renderTunnelsHTML"));
|
||||
aMap.put("Congestion", SummaryBarRenderer.class.getMethod("renderCongestionHTML"));
|
||||
aMap.put("TunnelStatus", SummaryBarRenderer.class.getMethod("renderTunnelStatusHTML"));
|
||||
aMap.put("Destinations", SummaryBarRenderer.class.getMethod("renderDestinationsHTML"));
|
||||
aMap.put("NewsHeadings", SummaryBarRenderer.class.getMethod("renderNewsHeadingsHTML"));
|
||||
} catch (java.lang.NoSuchMethodException e) {
|
||||
}
|
||||
ALL_SECTIONS = Collections.unmodifiableMap(aMap);
|
||||
}*/
|
||||
static final String ALL_SECTIONS[] =
|
||||
{"HelpAndFAQ", "I2PServices", "I2PInternals", "General", "ShortGeneral", "NetworkReachability",
|
||||
"UpdateStatus", "RestartStatus", "Peers", "FirewallAndReseedStatus", "Bandwidth", "Tunnels",
|
||||
"Congestion", "TunnelStatus", "Destinations", "NewsHeadings" };
|
||||
static final Map<String, String> SECTION_NAMES;
|
||||
static {
|
||||
Map<String, String> aMap = new HashMap<String, String>();;
|
||||
aMap.put("HelpAndFAQ", "Help & FAQ");
|
||||
aMap.put("I2PServices", "I2P Services");
|
||||
aMap.put("I2PInternals", "I2P Internals");
|
||||
aMap.put("General", "General");
|
||||
aMap.put("ShortGeneral", "Short General");
|
||||
aMap.put("NetworkReachability", "Network Reachability");
|
||||
aMap.put("UpdateStatus", "Update Status");
|
||||
aMap.put("RestartStatus", "Restart Status");
|
||||
aMap.put("Peers", "Peers");
|
||||
aMap.put("FirewallAndReseedStatus", "Firewall & Reseed Status");
|
||||
aMap.put("Bandwidth", "Bandwidth");
|
||||
aMap.put("Tunnels", "Tunnels");
|
||||
aMap.put("Congestion", "Congestion");
|
||||
aMap.put("TunnelStatus", "Tunnel Status");
|
||||
aMap.put("Destinations", "Local Destinations");
|
||||
aMap.put("NewsHeadings", "News & Updates");
|
||||
SECTION_NAMES = Collections.unmodifiableMap(aMap);
|
||||
}
|
||||
|
||||
private final RouterContext _context;
|
||||
private final SummaryHelper _helper;
|
||||
|
||||
@ -25,36 +80,74 @@ public class SummaryBarRenderer {
|
||||
* on lower-level directory errors.
|
||||
*/
|
||||
public void renderSummaryHTML(Writer out) throws IOException {
|
||||
String requestURI = _helper.getRequestURI();
|
||||
String page = requestURI.replace("/", "").replace(".jsp", "");
|
||||
List<String> sections = _helper.getSummaryBarSections(page);
|
||||
StringBuilder buf = new StringBuilder(8*1024);
|
||||
String theme = _context.getProperty(CSSHelper.PROP_THEME_NAME, CSSHelper.DEFAULT_THEME);
|
||||
for (String section : sections) {
|
||||
// Commented out because broken. Replaced by if-elseif blob below.
|
||||
/*try {
|
||||
String section = (String)ALL_SECTIONS.get(sections[i]).invoke(this);
|
||||
if (section != null && section != "") {
|
||||
out.write("<hr>" + i + "<hr>\n" + section);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
out.write("<hr>" +i + " - Exception<hr>\n" + e);
|
||||
}*/
|
||||
buf.setLength(0);
|
||||
|
||||
// TODO - the bar would render more cleanly if we specified the img height and width here,
|
||||
// but unfortunately the images in the different themes are different sizes.
|
||||
// They range in height from 37 to 43 px. But there's a -2 bottom margin...
|
||||
// So put it in a div.
|
||||
buf.append("<div style=\"height: 36px;\"><a href=\"/\" target=\"_top\"><img src=\"")
|
||||
.append(CSSHelper.BASE_THEME_PATH)
|
||||
.append(theme)
|
||||
.append("/images/i2plogo.png\" alt=\"")
|
||||
.append(_("I2P Router Console"))
|
||||
.append("\" title=\"")
|
||||
.append(_("I2P Router Console"))
|
||||
.append("\"></a></div><hr>")
|
||||
buf.append("<hr>\n");
|
||||
if ("HelpAndFAQ".equals(section))
|
||||
buf.append(renderHelpAndFAQHTML());
|
||||
else if ("I2PServices".equals(section))
|
||||
buf.append(renderI2PServicesHTML());
|
||||
else if ("I2PInternals".equals(section))
|
||||
buf.append(renderI2PInternalsHTML());
|
||||
else if ("General".equals(section))
|
||||
buf.append(renderGeneralHTML());
|
||||
else if ("ShortGeneral".equals(section))
|
||||
buf.append(renderShortGeneralHTML());
|
||||
else if ("NetworkReachability".equals(section))
|
||||
buf.append(renderNetworkReachabilityHTML());
|
||||
else if ("UpdateStatus".equals(section))
|
||||
buf.append(renderUpdateStatusHTML());
|
||||
else if ("RestartStatus".equals(section))
|
||||
buf.append(renderRestartStatusHTML());
|
||||
else if ("Peers".equals(section))
|
||||
buf.append(renderPeersHTML());
|
||||
else if ("FirewallAndReseedStatus".equals(section))
|
||||
buf.append(renderFirewallAndReseedStatusHTML());
|
||||
else if ("Bandwidth".equals(section))
|
||||
buf.append(renderBandwidthHTML());
|
||||
else if ("Tunnels".equals(section))
|
||||
buf.append(renderTunnelsHTML());
|
||||
else if ("Congestion".equals(section))
|
||||
buf.append(renderCongestionHTML());
|
||||
else if ("TunnelStatus".equals(section))
|
||||
buf.append(renderTunnelStatusHTML());
|
||||
else if ("Destinations".equals(section))
|
||||
buf.append(renderDestinationsHTML());
|
||||
else if ("NewsHeadings".equals(section))
|
||||
buf.append(renderNewsHeadingsHTML());
|
||||
|
||||
.append("<h3><a href=\"/help\" target=\"_top\" title=\"")
|
||||
// Only output section if there's more than the <hr> to print
|
||||
if (buf.length() > 5)
|
||||
out.write(buf.toString());
|
||||
}
|
||||
}
|
||||
|
||||
public String renderHelpAndFAQHTML() {
|
||||
StringBuilder buf = new StringBuilder(512);
|
||||
buf.append("<h3><a href=\"/help\" target=\"_top\" title=\"")
|
||||
.append(_("I2P Router Help & FAQ"))
|
||||
.append("\">")
|
||||
.append(_("Help & FAQ"))
|
||||
.append("</a></h3><hr>");
|
||||
.append("</a></h3>");
|
||||
return buf.toString();
|
||||
}
|
||||
|
||||
File lpath = new File(_context.getBaseDir(), "docs/toolbar.html");
|
||||
// you better have target="_top" for the links in there...
|
||||
if (lpath.exists()) {
|
||||
ContentHelper linkhelper = new ContentHelper();
|
||||
linkhelper.setPage(lpath.getAbsolutePath());
|
||||
linkhelper.setMaxLines("100");
|
||||
buf.append(linkhelper.getContent());
|
||||
} else {
|
||||
public String renderI2PServicesHTML() {
|
||||
StringBuilder buf = new StringBuilder(512);
|
||||
buf.append("<h3><a href=\"/configclients\" target=\"_top\" title=\"")
|
||||
.append(_("Configure startup of clients and webapps (services); manually start dormant services"))
|
||||
.append("\">")
|
||||
@ -63,7 +156,7 @@ public class SummaryBarRenderer {
|
||||
|
||||
"<hr class=\"b\"><table><tr><td>" +
|
||||
|
||||
"<a href=\"/susimail/susimail\" target=\"blank\" title=\"")
|
||||
"<a href=\"/susimail/susimail\" target=\"_blank\" title=\"")
|
||||
.append(_("Anonymous webmail client"))
|
||||
.append("\">")
|
||||
.append(_("Email"))
|
||||
@ -83,9 +176,13 @@ public class SummaryBarRenderer {
|
||||
|
||||
.append(NavHelper.getClientAppLinks(_context))
|
||||
|
||||
.append("</td></tr></table>\n" +
|
||||
.append("</td></tr></table>\n");
|
||||
return buf.toString();
|
||||
}
|
||||
|
||||
"<hr><h3><a href=\"/config\" target=\"_top\" title=\"")
|
||||
public String renderI2PInternalsHTML() {
|
||||
StringBuilder buf = new StringBuilder(512);
|
||||
buf.append("<h3><a href=\"/config\" target=\"_top\" title=\"")
|
||||
.append(_("Configure I2P Router"))
|
||||
.append("\">")
|
||||
.append(_("I2P Internals"))
|
||||
@ -143,13 +240,13 @@ public class SummaryBarRenderer {
|
||||
.append(_("Stats"))
|
||||
.append("</a>\n" +
|
||||
|
||||
"<a href=\"/i2ptunnel/\" target=\"_blank\" title=\"")
|
||||
"<a href=\"/i2ptunnelmgr\" target=\"_top\" title=\"")
|
||||
.append(_("Local Destinations"))
|
||||
.append("\">")
|
||||
.append(_("I2PTunnel"))
|
||||
.append("</a>\n" +
|
||||
|
||||
"<a href=\"/susidns/index\" target=\"_blank\" title=\"")
|
||||
"<a href=\"/dns\" target=\"_top\" title=\"")
|
||||
.append(_("Manage your I2P hosts file here (I2P domain name resolution)"))
|
||||
.append("\">")
|
||||
.append(_("Addressbook"))
|
||||
@ -159,21 +256,23 @@ public class SummaryBarRenderer {
|
||||
if (javadoc.exists())
|
||||
buf.append("<a href=\"/javadoc/index.html\" target=\"_blank\">Javadoc</a>\n");
|
||||
buf.append("</td></tr></table>\n");
|
||||
|
||||
out.write(buf.toString());
|
||||
buf.setLength(0);
|
||||
return buf.toString();
|
||||
}
|
||||
|
||||
|
||||
|
||||
buf.append("<hr><h3><a href=\"/help\" target=\"_top\" title=\"")
|
||||
public String renderGeneralHTML() {
|
||||
if (_helper == null) return "";
|
||||
StringBuilder buf = new StringBuilder(512);
|
||||
buf.append("<h3><a href=\"/help\" target=\"_top\" title=\"")
|
||||
.append(_("I2P Router Help"))
|
||||
.append("\">")
|
||||
.append(_("General"))
|
||||
.append("</a></h3><hr class=\"b\">\n" +
|
||||
|
||||
"<table><tr>" +
|
||||
"<td align=\"left\"><b>")
|
||||
"<td align=\"left\"><b title=\"")
|
||||
.append(_("Your Local Identity is your unique I2P router identity, similar to an ip address but tailored to I2P. "))
|
||||
.append(_("Never disclose this to anyone, as it can reveal your real world ip."))
|
||||
.append("\">")
|
||||
.append(_("Local Identity"))
|
||||
.append(":</b></td>" +
|
||||
"<td align=\"right\">" +
|
||||
@ -187,7 +286,10 @@ public class SummaryBarRenderer {
|
||||
.append(_("show"))
|
||||
.append("</a></td></tr>\n" +
|
||||
|
||||
"<tr><td align=\"left\"><b>")
|
||||
"<tr title=\"")
|
||||
.append(_("The version of the I2P software we are running"))
|
||||
.append("\">" +
|
||||
"<td align=\"left\"><b>")
|
||||
.append(_("Version"))
|
||||
.append(":</b></td>" +
|
||||
"<td align=\"right\">")
|
||||
@ -202,24 +304,74 @@ public class SummaryBarRenderer {
|
||||
.append(":</b></td>" +
|
||||
"<td align=\"right\">")
|
||||
.append(_helper.getUptime())
|
||||
.append("</td></tr></table>\n" +
|
||||
.append("</td></tr></table>\n");
|
||||
return buf.toString();
|
||||
}
|
||||
|
||||
"<hr><h4><a href=\"/confignet#help\" target=\"_top\" title=\"")
|
||||
public String renderShortGeneralHTML() {
|
||||
if (_helper == null) return "";
|
||||
StringBuilder buf = new StringBuilder(512);
|
||||
buf.append("<table>" +
|
||||
"<tr title=\"")
|
||||
.append(_("The version of the I2P software we are running"))
|
||||
.append("\">" +
|
||||
"<td align=\"left\"><b>")
|
||||
.append(_("Version"))
|
||||
.append(":</b></td>" +
|
||||
"<td align=\"right\">")
|
||||
.append(_helper.getVersion())
|
||||
.append("</td></tr>\n" +
|
||||
|
||||
"<tr title=\"")
|
||||
.append(_("How long we've been running for this session"))
|
||||
.append("\">" +
|
||||
"<td align=\"left\"><b>")
|
||||
.append(_("Uptime"))
|
||||
.append(":</b></td>" +
|
||||
"<td align=\"right\">")
|
||||
.append(_helper.getUptime())
|
||||
.append("</td></tr></table>\n");
|
||||
return buf.toString();
|
||||
}
|
||||
|
||||
public String renderNetworkReachabilityHTML() {
|
||||
if (_helper == null) return "";
|
||||
StringBuilder buf = new StringBuilder(512);
|
||||
buf.append("<h4><a href=\"/confignet#help\" target=\"_top\" title=\"")
|
||||
.append(_("Help with configuring your firewall and router for optimal I2P performance"))
|
||||
.append("\">")
|
||||
.append(_("Network"))
|
||||
.append(": ")
|
||||
.append(_helper.getReachability())
|
||||
.append("</a></h4><hr>\n")
|
||||
.append("</a></h4>\n");
|
||||
return buf.toString();
|
||||
}
|
||||
|
||||
public String renderUpdateStatusHTML() {
|
||||
if (_helper == null) return "";
|
||||
String updateStatus = _helper.getUpdateStatus();
|
||||
if ("".equals(updateStatus)) return "";
|
||||
StringBuilder buf = new StringBuilder(512);
|
||||
buf.append("<h3><a href=\"/configupdate\" target=\"_top\" title=\"")
|
||||
.append(_("Configure I2P Updates"))
|
||||
.append("\">")
|
||||
.append(_("I2P Update"))
|
||||
.append("</a></h3><hr class=\"b\">\n");
|
||||
buf.append(updateStatus);
|
||||
return buf.toString();
|
||||
}
|
||||
|
||||
.append(_helper.getUpdateStatus())
|
||||
public String renderRestartStatusHTML() {
|
||||
if (_helper == null) return "";
|
||||
StringBuilder buf = new StringBuilder(512);
|
||||
buf.append(_helper.getRestartStatus());
|
||||
return buf.toString();
|
||||
}
|
||||
|
||||
|
||||
.append(_helper.getRestartStatus())
|
||||
|
||||
|
||||
.append("<hr><h3><a href=\"/peers\" target=\"_top\" title=\"")
|
||||
public String renderPeersHTML() {
|
||||
if (_helper == null) return "";
|
||||
StringBuilder buf = new StringBuilder(512);
|
||||
buf.append("<h3><a href=\"/peers\" target=\"_top\" title=\"")
|
||||
.append(_("Show all current peer connections"))
|
||||
.append("\">")
|
||||
.append(_("Peers"))
|
||||
@ -227,7 +379,10 @@ public class SummaryBarRenderer {
|
||||
|
||||
"<table>\n" +
|
||||
|
||||
"<tr><td align=\"left\"><b>")
|
||||
"<tr title=\"")
|
||||
.append(_("Peers we've been talking to in the last few minutes/last hour"))
|
||||
.append("\">" +
|
||||
"<td align=\"left\"><b>")
|
||||
.append(_("Active"))
|
||||
.append(":</b></td><td align=\"right\">");
|
||||
int active = _helper.getActivePeers();
|
||||
@ -236,38 +391,56 @@ public class SummaryBarRenderer {
|
||||
.append(Math.max(active, _helper.getActiveProfiles()))
|
||||
.append("</td></tr>\n" +
|
||||
|
||||
"<tr><td align=\"left\"><b>")
|
||||
"<tr title=\"")
|
||||
.append(_("The number of peers available for building client tunnels"))
|
||||
.append("\">" +
|
||||
"<td align=\"left\"><b>")
|
||||
.append(_("Fast"))
|
||||
.append(":</b></td><td align=\"right\">")
|
||||
.append(_helper.getFastPeers())
|
||||
.append("</td></tr>\n" +
|
||||
|
||||
"<tr><td align=\"left\"><b>")
|
||||
"<tr title=\"")
|
||||
.append(_("The number of peers available for building exploratory tunnels"))
|
||||
.append("\">" +
|
||||
"<td align=\"left\"><b>")
|
||||
.append(_("High capacity"))
|
||||
.append(":</b></td><td align=\"right\">")
|
||||
.append(_helper.getHighCapacityPeers())
|
||||
.append("</td></tr>\n" +
|
||||
|
||||
"<tr><td align=\"left\"><b>")
|
||||
"<tr title=\"")
|
||||
.append(_("The number of peers available for network database inquries"))
|
||||
.append("\">" +
|
||||
"<td align=\"left\"><b>")
|
||||
.append(_("Integrated"))
|
||||
.append(":</b></td><td align=\"right\">")
|
||||
.append(_helper.getWellIntegratedPeers())
|
||||
.append("</td></tr>\n" +
|
||||
|
||||
"<tr><td align=\"left\"><b>")
|
||||
"<tr title=\"")
|
||||
.append(_("The total number of peers in our network database"))
|
||||
.append("\">" +
|
||||
"<td align=\"left\"><b>")
|
||||
.append(_("Known"))
|
||||
.append(":</b></td><td align=\"right\">")
|
||||
.append(_helper.getAllPeers())
|
||||
.append("</td></tr>\n" +
|
||||
|
||||
"</table><hr>\n");
|
||||
|
||||
|
||||
out.write(buf.toString());
|
||||
buf.setLength(0);
|
||||
"</table>\n");
|
||||
return buf.toString();
|
||||
}
|
||||
|
||||
public String renderFirewallAndReseedStatusHTML() {
|
||||
if (_helper == null) return "";
|
||||
StringBuilder buf = new StringBuilder(512);
|
||||
buf.append(_helper.getFirewallAndReseedStatus());
|
||||
return buf.toString();
|
||||
}
|
||||
|
||||
public String renderBandwidthHTML() {
|
||||
if (_helper == null) return "";
|
||||
StringBuilder buf = new StringBuilder(512);
|
||||
buf.append("<h3><a href=\"/config\" title=\"")
|
||||
.append(_("Configure router bandwidth allocation"))
|
||||
.append("\" target=\"_top\">")
|
||||
@ -303,82 +476,181 @@ public class SummaryBarRenderer {
|
||||
.append(_helper.getInboundTransferred())
|
||||
.append(SummaryHelper.THINSP)
|
||||
.append(_helper.getOutboundTransferred())
|
||||
.append("</td></tr></table>\n" +
|
||||
.append("</td></tr>\n" +
|
||||
|
||||
"<hr><h3><a href=\"/tunnels\" target=\"_top\" title=\"")
|
||||
"</table>\n");
|
||||
return buf.toString();
|
||||
}
|
||||
|
||||
public String renderTunnelsHTML() {
|
||||
if (_helper == null) return "";
|
||||
StringBuilder buf = new StringBuilder(512);
|
||||
buf.append("<h3><a href=\"/tunnels\" target=\"_top\" title=\"")
|
||||
.append(_("View existing tunnels and tunnel build status"))
|
||||
.append("\">")
|
||||
.append(_("Tunnels"))
|
||||
.append("</a></h3><hr class=\"b\">" +
|
||||
"<table>\n" +
|
||||
|
||||
"<tr><td align=\"left\"><b>")
|
||||
"<tr title=\"")
|
||||
.append(_("Used for building and testing tunnels, and communicating with floodfill peers"))
|
||||
.append("\">" +
|
||||
"<td align=\"left\"><b>")
|
||||
.append(_("Exploratory"))
|
||||
.append(":</b></td><td align=\"right\">")
|
||||
.append(_helper.getInboundTunnels() + _helper.getOutboundTunnels())
|
||||
.append("</td></tr>\n" +
|
||||
|
||||
"<tr><td align=\"left\"><b>")
|
||||
"<tr title=\"")
|
||||
.append(_("Tunnels we are using to provide or access services on the network"))
|
||||
.append("\">" +
|
||||
"<td align=\"left\"><b>")
|
||||
.append(_("Client"))
|
||||
.append(":</b></td><td align=\"right\">")
|
||||
.append(_helper.getInboundClientTunnels() + _helper.getOutboundClientTunnels())
|
||||
.append("</td></tr>\n" +
|
||||
|
||||
"<tr><td align=\"left\"><b>")
|
||||
"<tr title=\"")
|
||||
.append(_("Tunnels we are participating in, directly contributing bandwith to the network"))
|
||||
.append("\">" +
|
||||
"<td align=\"left\"><b>")
|
||||
.append(_("Participating"))
|
||||
.append(":</b></td><td align=\"right\">")
|
||||
.append(_helper.getParticipatingTunnels())
|
||||
.append("</td></tr>\n" +
|
||||
|
||||
"<tr><td align=\"left\"><b>")
|
||||
"<tr title=\"")
|
||||
.append(_("The ratio of tunnel hops we provide to tunnel hops we use - a value greater than 1.00 indicates a positive contribution to the network"))
|
||||
.append("\">" +
|
||||
"<td align=\"left\"><b>")
|
||||
.append(_("Share ratio"))
|
||||
.append(":</b></td><td align=\"right\">")
|
||||
.append(_helper.getShareRatio())
|
||||
.append("</td></tr>\n" +
|
||||
|
||||
"</table><hr><h3><a href=\"/jobs\" target=\"_top\" title=\"")
|
||||
"</table>\n");
|
||||
return buf.toString();
|
||||
}
|
||||
|
||||
public String renderCongestionHTML() {
|
||||
if (_helper == null) return "";
|
||||
StringBuilder buf = new StringBuilder(512);
|
||||
buf.append("<h3><a href=\"/jobs\" target=\"_top\" title=\"")
|
||||
.append(_("What's in the router's job queue?"))
|
||||
.append("\">")
|
||||
.append(_("Congestion"))
|
||||
.append("</a></h3><hr class=\"b\">" +
|
||||
"<table>\n" +
|
||||
|
||||
"<tr><td align=\"left\"><b>")
|
||||
"<tr title=\"")
|
||||
.append(_("Indicates router performance"))
|
||||
.append("\">" +
|
||||
"<td align=\"left\"><b>")
|
||||
.append(_("Job lag"))
|
||||
.append(":</b></td><td align=\"right\">")
|
||||
.append(_helper.getJobLag())
|
||||
.append("</td></tr>\n" +
|
||||
|
||||
"<tr><td align=\"left\"><b>")
|
||||
"<tr title=\"")
|
||||
.append(_("Indicates how quickly outbound messages to other I2P routers are sent"))
|
||||
.append("\">" +
|
||||
"<td align=\"left\"><b>")
|
||||
.append(_("Message delay"))
|
||||
.append(":</b></td><td align=\"right\">")
|
||||
.append(_helper.getMessageDelay())
|
||||
.append("</td></tr>\n");
|
||||
|
||||
if (!_context.getBooleanPropertyDefaultTrue("router.disableTunnelTesting")) {
|
||||
buf.append("<tr><td align=\"left\"><b>")
|
||||
buf.append("<tr title=\"")
|
||||
.append(_("Round trip time for a tunnel test"))
|
||||
.append("\">" +
|
||||
"<td align=\"left\"><b>")
|
||||
.append(_("Tunnel lag"))
|
||||
.append(":</b></td><td align=\"right\">")
|
||||
.append(_helper.getTunnelLag())
|
||||
.append("</td></tr>\n");
|
||||
}
|
||||
|
||||
buf.append("<tr><td align=\"left\"><b>")
|
||||
buf.append("<tr title=\"")
|
||||
.append(_("Queued requests from other routers to participate in tunnels"))
|
||||
.append("\">" +
|
||||
"<td align=\"left\"><b>")
|
||||
.append(_("Backlog"))
|
||||
.append(":</b></td><td align=\"right\">")
|
||||
.append(_helper.getInboundBacklog())
|
||||
.append("</td></tr>\n" +
|
||||
|
||||
"</table><hr><h4>")
|
||||
"</table>\n");
|
||||
return buf.toString();
|
||||
}
|
||||
|
||||
public String renderTunnelStatusHTML() {
|
||||
if (_helper == null) return "";
|
||||
StringBuilder buf = new StringBuilder(50);
|
||||
buf.append("<h4>")
|
||||
.append(_(_helper.getTunnelStatus()))
|
||||
.append("</h4><hr>\n")
|
||||
.append("</h4>\n");
|
||||
return buf.toString();
|
||||
}
|
||||
|
||||
.append(_helper.getDestinations())
|
||||
.append("<hr>\n");
|
||||
public String renderDestinationsHTML() {
|
||||
if (_helper == null) return "";
|
||||
StringBuilder buf = new StringBuilder(512);
|
||||
buf.append(_helper.getDestinations());
|
||||
return buf.toString();
|
||||
}
|
||||
|
||||
|
||||
|
||||
out.write(buf.toString());
|
||||
/** @since 0.9.1 */
|
||||
public String renderNewsHeadingsHTML() {
|
||||
if (_helper == null) return "";
|
||||
NewsHelper newshelper = _helper.getNewsHelper();
|
||||
if (newshelper == null || newshelper.shouldShowNews()) return "";
|
||||
StringBuilder buf = new StringBuilder(512);
|
||||
String consoleNonce = System.getProperty("router.consoleNonce");
|
||||
if (consoleNonce != null) {
|
||||
// Set up title and pre-headings stuff.
|
||||
buf.append("<h3><a href=\"/configupdate\">")
|
||||
.append(_("News & Updates"))
|
||||
.append("</a></h3><hr class=\"b\"><div class=\"newsheadings\">\n");
|
||||
// Get news content.
|
||||
String newsContent = newshelper.getContent();
|
||||
if (newsContent != "") {
|
||||
buf.append("<ul>\n");
|
||||
// Parse news content for headings.
|
||||
int start = newsContent.indexOf("<h3>");
|
||||
while (start >= 0) {
|
||||
// Add offset to start:
|
||||
// 4 - gets rid of <h3>
|
||||
// 16 - gets rid of the date as well (assuming form "<h3>yyyy-mm-dd: Foobarbaz...")
|
||||
newsContent = newsContent.substring(start+16, newsContent.length());
|
||||
int end = newsContent.indexOf("</h3>");
|
||||
if (end >= 0) {
|
||||
String heading = newsContent.substring(0, end);
|
||||
buf.append("<li>")
|
||||
.append(heading)
|
||||
.append("</li>\n");
|
||||
}
|
||||
start = newsContent.indexOf("<h3>");
|
||||
}
|
||||
buf.append("</ul>\n");
|
||||
// Set up string containing <a> to show news.
|
||||
String requestURI = _helper.getRequestURI();
|
||||
if (requestURI.contains("/home")) {
|
||||
buf.append("<a href=\"/?news=1&consoleNonce=")
|
||||
.append(consoleNonce)
|
||||
.append("\">")
|
||||
.append(_("Show news"))
|
||||
.append("</a>\n");
|
||||
}
|
||||
} else {
|
||||
buf.append("<center><i>")
|
||||
.append(_("none"))
|
||||
.append("</i></center>");
|
||||
}
|
||||
// Add post-headings stuff.
|
||||
buf.append("</div>\n");
|
||||
}
|
||||
return buf.toString();
|
||||
}
|
||||
|
||||
/** translate a string */
|
||||
|
@ -4,10 +4,13 @@ import java.io.IOException;
|
||||
import java.text.Collator;
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.TreeSet;
|
||||
|
||||
import net.i2p.data.DataHelper;
|
||||
import net.i2p.data.Destination;
|
||||
@ -17,6 +20,7 @@ import net.i2p.data.RouterAddress;
|
||||
import net.i2p.data.RouterInfo;
|
||||
import net.i2p.router.CommSystemFacade;
|
||||
import net.i2p.router.Router;
|
||||
import net.i2p.router.RouterContext;
|
||||
import net.i2p.router.RouterVersion;
|
||||
import net.i2p.router.TunnelPoolSettings;
|
||||
import net.i2p.router.networkdb.kademlia.FloodfillNetworkDatabaseFacade;
|
||||
@ -35,6 +39,35 @@ public class SummaryHelper extends HelperBase {
|
||||
// Opera 10.63 doesn't have the char, TODO check UA
|
||||
//static final String THINSP = " / ";
|
||||
static final String THINSP = " / ";
|
||||
private static final char S = ',';
|
||||
static final String PROP_SUMMARYBAR = "routerconsole.summaryBar.";
|
||||
|
||||
static final String DEFAULT_FULL =
|
||||
"HelpAndFAQ" + S +
|
||||
"I2PServices" + S +
|
||||
"I2PInternals" + S +
|
||||
"General" + S +
|
||||
"NetworkReachability" + S +
|
||||
"UpdateStatus" + S +
|
||||
"RestartStatus" + S +
|
||||
"Peers" + S +
|
||||
"FirewallAndReseedStatus" + S +
|
||||
"Bandwidth" + S +
|
||||
"Tunnels" + S +
|
||||
"Congestion" + S +
|
||||
"TunnelStatus" + S +
|
||||
"Destinations" + S +
|
||||
"";
|
||||
|
||||
static final String DEFAULT_MINIMAL =
|
||||
"ShortGeneral" + S +
|
||||
"NewsHeadings" + S +
|
||||
"UpdateStatus" + S +
|
||||
"NetworkReachability" + S +
|
||||
"RestartStatus" + S +
|
||||
"FirewallAndReseedStatus" + S +
|
||||
"Destinations" + S +
|
||||
"";
|
||||
|
||||
/**
|
||||
* Retrieve the shortened 4 character ident for the router located within
|
||||
@ -375,7 +408,7 @@ public class SummaryHelper extends HelperBase {
|
||||
List<Destination> clients = new ArrayList(_context.clientManager().listClients());
|
||||
|
||||
StringBuilder buf = new StringBuilder(512);
|
||||
buf.append("<h3><a href=\"/i2ptunnel/\" target=\"_blank\" title=\"").append(_("Add/remove/edit & control your client and server tunnels")).append("\">").append(_("Local Destinations")).append("</a></h3><hr class=\"b\"><div class=\"tunnels\">");
|
||||
buf.append("<h3><a href=\"/i2ptunnelmgr\" target=\"_top\" title=\"").append(_("Add/remove/edit & control your client and server tunnels")).append("\">").append(_("Local Destinations")).append("</a></h3><hr class=\"b\"><div class=\"tunnels\">");
|
||||
if (!clients.isEmpty()) {
|
||||
Collections.sort(clients, new AlphaComparator());
|
||||
buf.append("<table>");
|
||||
@ -618,7 +651,7 @@ public class SummaryHelper extends HelperBase {
|
||||
// display all the time so we display the final failure message, and plugin update messages too
|
||||
String status = UpdateHandler.getStatus();
|
||||
if (status.length() > 0) {
|
||||
buf.append("<h4>").append(status).append("</h4><hr>\n");
|
||||
buf.append("<h4>").append(status).append("</h4>\n");
|
||||
}
|
||||
if (updateAvailable() || unsignedUpdateAvailable()) {
|
||||
if ("true".equals(System.getProperty(UpdateHandler.PROP_UPDATE_IN_PROGRESS))) {
|
||||
@ -706,10 +739,32 @@ public class SummaryHelper extends HelperBase {
|
||||
}
|
||||
if (buf.length() <= 0)
|
||||
return "";
|
||||
buf.append("<hr>");
|
||||
return buf.toString();
|
||||
}
|
||||
|
||||
private NewsHelper _newshelper;
|
||||
public void storeNewsHelper(NewsHelper n) { _newshelper = n; }
|
||||
public NewsHelper getNewsHelper() { return _newshelper; }
|
||||
|
||||
public List<String> getSummaryBarSections(String page) {
|
||||
String config = "";
|
||||
if ("home".equals(page)) {
|
||||
config = _context.getProperty(PROP_SUMMARYBAR + page, DEFAULT_MINIMAL);
|
||||
} else {
|
||||
config = _context.getProperty(PROP_SUMMARYBAR + page);
|
||||
if (config == null)
|
||||
config = _context.getProperty(PROP_SUMMARYBAR + "default", DEFAULT_FULL);
|
||||
}
|
||||
return Arrays.asList(config.split("" + S));
|
||||
}
|
||||
|
||||
static void saveSummaryBarSections(RouterContext ctx, String page, Map<Integer, String> sections) {
|
||||
StringBuilder buf = new StringBuilder(512);
|
||||
for(String section : sections.values())
|
||||
buf.append(section).append(S);
|
||||
ctx.router().saveConfig(PROP_SUMMARYBAR + page, buf.toString());
|
||||
}
|
||||
|
||||
/** output the summary bar to _out */
|
||||
public void renderSummaryBar() throws IOException {
|
||||
SummaryBarRenderer renderer = new SummaryBarRenderer(_context, this);
|
||||
@ -733,4 +788,92 @@ public class SummaryHelper extends HelperBase {
|
||||
private String _requestURI;
|
||||
public void setRequestURI(String s) { _requestURI = s; }
|
||||
public String getRequestURI() { return _requestURI; }
|
||||
|
||||
public String getConfigTable() {
|
||||
String[] allSections = SummaryBarRenderer.ALL_SECTIONS;
|
||||
Map<String, String> sectionNames = SummaryBarRenderer.SECTION_NAMES;
|
||||
List<String> sections = getSummaryBarSections("default");
|
||||
TreeSet<String> sortedSections = new TreeSet();
|
||||
|
||||
for (int i = 0; i < allSections.length; i++) {
|
||||
String section = allSections[i];
|
||||
if (!sections.contains(section))
|
||||
sortedSections.add(section);
|
||||
}
|
||||
|
||||
String theme = _context.getProperty(CSSHelper.PROP_THEME_NAME, CSSHelper.DEFAULT_THEME);
|
||||
String imgPath = CSSHelper.BASE_THEME_PATH + theme + "/images/";
|
||||
|
||||
StringBuilder buf = new StringBuilder(2048);
|
||||
buf.append("<table class=\"sidebarconf\"><tr><th>")
|
||||
.append(_("Remove"))
|
||||
.append("</th><th>")
|
||||
.append(_("Name"))
|
||||
.append("</th><th colspan=\"2\">")
|
||||
.append(_("Order"))
|
||||
.append("</th></tr>\n");
|
||||
for (String section : sections) {
|
||||
int i = sections.indexOf(section);
|
||||
buf.append("<tr><td align=\"center\"><input type=\"checkbox\" class=\"optbox\" name=\"delete_")
|
||||
.append(i)
|
||||
.append("\"></td><td align=\"left\">")
|
||||
.append(_(sectionNames.get(section)))
|
||||
.append("</td><td align=\"right\"><input type=\"hidden\" name=\"order_")
|
||||
.append(i + "_" + section)
|
||||
.append("\" value=\"")
|
||||
.append(i)
|
||||
.append("\">");
|
||||
if (i > 0) {
|
||||
buf.append("<input type=\"image\" class=\"buttonTop\" name=\"move_")
|
||||
.append(i)
|
||||
.append("_top\" alt=\"")
|
||||
.append(_("Top"))
|
||||
.append("\" src=\"" + imgPath + "move_top.png\">");
|
||||
buf.append("<input type=\"image\" class=\"buttonUp\" name=\"move_")
|
||||
.append(i)
|
||||
.append("_up\" alt=\"")
|
||||
.append(_("Up"))
|
||||
.append("\" src=\"" + imgPath + "move_up.png\">");
|
||||
}
|
||||
buf.append("</td><td align=\"left\">");
|
||||
if (i < sections.size() - 1) {
|
||||
buf.append("<input type=\"image\" class=\"buttonDown\" name=\"move_")
|
||||
.append(i)
|
||||
.append("_down\" alt=\"")
|
||||
.append(_("Down"))
|
||||
.append("\" src=\"" + imgPath + "move_down.png\">");
|
||||
buf.append("<input type=\"image\" class=\"buttonBottom\" name=\"move_")
|
||||
.append(i)
|
||||
.append("_bottom\" alt=\"")
|
||||
.append(_("Bottom"))
|
||||
.append("\" src=\"" + imgPath + "move_bottom.png\">");
|
||||
}
|
||||
buf.append("</td></tr>\n");
|
||||
}
|
||||
buf.append("<tr><td align=\"center\">" +
|
||||
"<input type=\"submit\" name=\"action\" class=\"delete\" value=\"")
|
||||
.append(_("Delete selected"))
|
||||
.append("\"></td><td align=\"left\"><b>")
|
||||
.append(_("Add")).append(":</b> " +
|
||||
"<select name=\"name\">\n" +
|
||||
"<option value=\"\" selected=\"selected\">")
|
||||
.append(_("Select a section to add"))
|
||||
.append("</option>\n");
|
||||
|
||||
for (String s : sortedSections) {
|
||||
buf.append("<option value=\"").append(s).append("\">")
|
||||
.append(sectionNames.get(s)).append("</option>\n");
|
||||
}
|
||||
|
||||
buf.append("</select>\n" +
|
||||
"<input type=\"hidden\" name=\"order\" value=\"")
|
||||
.append(sections.size())
|
||||
.append("\"></td>" +
|
||||
"<td align=\"center\" colspan=\"2\">" +
|
||||
"<input type=\"submit\" name=\"action\" class=\"add\" value=\"")
|
||||
.append(_("Add item"))
|
||||
.append("\"></td></tr>")
|
||||
.append("</table>\n");
|
||||
return buf.toString();
|
||||
}
|
||||
}
|
||||
|
@ -75,7 +75,7 @@ public class UnsignedUpdateHandler extends UpdateHandler {
|
||||
// 40 retries!!
|
||||
_get = new EepGet(_context, proxyHost, proxyPort, 40, _updateFile, _zipURL, false);
|
||||
_get.addStatusListener(UnsignedUpdateRunner.this);
|
||||
_get.fetch();
|
||||
_get.fetch(CONNECT_TIMEOUT, -1, INACTIVITY_TIMEOUT);
|
||||
} catch (Throwable t) {
|
||||
_log.error("Error updating", t);
|
||||
}
|
||||
|
@ -45,6 +45,10 @@ public class UpdateHandler {
|
||||
static final String PROP_UPDATE_IN_PROGRESS = "net.i2p.router.web.UpdateHandler.updateInProgress";
|
||||
protected static final String PROP_LAST_UPDATE_TIME = "router.updateLastDownloaded";
|
||||
|
||||
protected static final long CONNECT_TIMEOUT = 55*1000;
|
||||
protected static final long INACTIVITY_TIMEOUT = 5*60*1000;
|
||||
protected static final long NOPROXY_INACTIVITY_TIMEOUT = 60*1000;
|
||||
|
||||
public UpdateHandler() {
|
||||
this(ContextHelper.getContext(null));
|
||||
}
|
||||
@ -193,7 +197,7 @@ public class UpdateHandler {
|
||||
// no retries
|
||||
_get = new PartialEepGet(_context, proxyHost, proxyPort, _baos, updateURL, TrustedUpdate.HEADER_BYTES);
|
||||
_get.addStatusListener(UpdateRunner.this);
|
||||
_get.fetch();
|
||||
_get.fetch(CONNECT_TIMEOUT);
|
||||
} catch (Throwable t) {
|
||||
_isNewer = false;
|
||||
}
|
||||
@ -210,7 +214,7 @@ public class UpdateHandler {
|
||||
else
|
||||
_get = new EepGet(_context, 1, _updateFile, updateURL, false);
|
||||
_get.addStatusListener(UpdateRunner.this);
|
||||
_get.fetch();
|
||||
_get.fetch(CONNECT_TIMEOUT, -1, shouldProxy ? INACTIVITY_TIMEOUT : NOPROXY_INACTIVITY_TIMEOUT);
|
||||
} catch (Throwable t) {
|
||||
_log.error("Error updating", t);
|
||||
}
|
||||
@ -233,14 +237,16 @@ public class UpdateHandler {
|
||||
if (_isPartial)
|
||||
return;
|
||||
StringBuilder buf = new StringBuilder(64);
|
||||
buf.append("<b>").append(_("Updating")).append("</b> ");
|
||||
double pct = ((double)alreadyTransferred + (double)currentWrite) /
|
||||
((double)alreadyTransferred + (double)currentWrite + bytesRemaining);
|
||||
synchronized (_pct) {
|
||||
buf.append(_pct.format(pct));
|
||||
buf.append(_("{0} downloaded", _pct.format(pct)));
|
||||
}
|
||||
buf.append(":<br>\n");
|
||||
buf.append(_("{0}B transferred", DataHelper.formatSize2(currentWrite + alreadyTransferred)));
|
||||
buf.append("<br>\n");
|
||||
buf.append(DataHelper.formatSize2(currentWrite + alreadyTransferred))
|
||||
.append("B / ")
|
||||
.append(DataHelper.formatSize2(currentWrite + alreadyTransferred + bytesRemaining))
|
||||
.append("B");
|
||||
updateStatus(buf.toString());
|
||||
}
|
||||
public void transferComplete(long alreadyTransferred, long bytesTransferred, long bytesRemaining, String url, String outputFile, boolean notModified) {
|
||||
|
@ -6,7 +6,9 @@
|
||||
<html><head>
|
||||
<%@include file="css.jsi" %>
|
||||
<%=intl.title("configure bandwidth")%>
|
||||
</head><body>
|
||||
<script src="/js/ajax.js" type="text/javascript"></script>
|
||||
<%@include file="summaryajax.jsi" %>
|
||||
</head><body onload="initAjax()">
|
||||
|
||||
<%@include file="summary.jsi" %>
|
||||
|
||||
|
@ -6,7 +6,9 @@
|
||||
<html><head>
|
||||
<%@include file="css.jsi" %>
|
||||
<%=intl.title("config advanced")%>
|
||||
</head><body>
|
||||
<script src="/js/ajax.js" type="text/javascript"></script>
|
||||
<%@include file="summaryajax.jsi" %>
|
||||
</head><body onload="initAjax()">
|
||||
|
||||
<%@include file="summary.jsi" %>
|
||||
|
||||
|
@ -10,7 +10,10 @@ button span.hide{
|
||||
display:none;
|
||||
}
|
||||
input.default { width: 1px; height: 1px; visibility: hidden; }
|
||||
</style></head><body>
|
||||
</style>
|
||||
<script src="/js/ajax.js" type="text/javascript"></script>
|
||||
<%@include file="summaryajax.jsi" %>
|
||||
</head><body onload="initAjax()">
|
||||
|
||||
<%@include file="summary.jsi" %>
|
||||
|
||||
|
@ -12,7 +12,9 @@ input.default {
|
||||
visibility: hidden;
|
||||
}
|
||||
</style>
|
||||
</head><body>
|
||||
<script src="/js/ajax.js" type="text/javascript"></script>
|
||||
<%@include file="summaryajax.jsi" %>
|
||||
</head><body onload="initAjax()">
|
||||
|
||||
<%@include file="summary.jsi" %>
|
||||
<h1><%=intl._("I2P Home Page Configuration")%></h1>
|
||||
|
@ -5,7 +5,9 @@
|
||||
<html><head>
|
||||
<%@include file="css.jsi" %>
|
||||
<%=intl.title("config keyring")%>
|
||||
</head><body>
|
||||
<script src="/js/ajax.js" type="text/javascript"></script>
|
||||
<%@include file="summaryajax.jsi" %>
|
||||
</head><body onload="initAjax()">
|
||||
|
||||
<%@include file="summary.jsi" %>
|
||||
<h1><%=intl._("I2P Keyring Configuration")%></h1>
|
||||
|
@ -6,7 +6,9 @@
|
||||
<html><head>
|
||||
<%@include file="css.jsi" %>
|
||||
<%=intl.title("config logging")%>
|
||||
</head><body>
|
||||
<script src="/js/ajax.js" type="text/javascript"></script>
|
||||
<%@include file="summaryajax.jsi" %>
|
||||
</head><body onload="initAjax()">
|
||||
<jsp:useBean class="net.i2p.router.web.ConfigLoggingHelper" id="logginghelper" scope="request" />
|
||||
<jsp:setProperty name="logginghelper" property="contextId" value="<%=(String)session.getAttribute(\"i2p.contextId\")%>" />
|
||||
|
||||
|
@ -5,7 +5,9 @@
|
||||
<html><head>
|
||||
<%@include file="css.jsi" %>
|
||||
<%=intl.title("config networking")%>
|
||||
</head><body>
|
||||
<script src="/js/ajax.js" type="text/javascript"></script>
|
||||
<%@include file="summaryajax.jsi" %>
|
||||
</head><body onload="initAjax()">
|
||||
|
||||
<%@include file="summary.jsi" %>
|
||||
|
||||
|
@ -5,7 +5,9 @@
|
||||
<html><head>
|
||||
<%@include file="css.jsi" %>
|
||||
<%=intl.title("config peers")%>
|
||||
</head><body>
|
||||
<script src="/js/ajax.js" type="text/javascript"></script>
|
||||
<%@include file="summaryajax.jsi" %>
|
||||
</head><body onload="initAjax()">
|
||||
|
||||
<%@include file="summary.jsi" %>
|
||||
<h1><%=intl._("I2P Peer Configuration")%></h1>
|
||||
|
@ -5,7 +5,9 @@
|
||||
<html><head>
|
||||
<%@include file="css.jsi" %>
|
||||
<%=intl.title("config reseeding")%>
|
||||
</head><body>
|
||||
<script src="/js/ajax.js" type="text/javascript"></script>
|
||||
<%@include file="summaryajax.jsi" %>
|
||||
</head><body onload="initAjax()">
|
||||
|
||||
<%@include file="summary.jsi" %>
|
||||
|
||||
|
@ -5,7 +5,9 @@
|
||||
<html><head>
|
||||
<%@include file="css.jsi" %>
|
||||
<%=intl.title("config service")%>
|
||||
</head><body>
|
||||
<script src="/js/ajax.js" type="text/javascript"></script>
|
||||
<%@include file="summaryajax.jsi" %>
|
||||
</head><body onload="initAjax()">
|
||||
|
||||
<%@include file="summary.jsi" %>
|
||||
<h1><%=intl._("I2P Service Configuration")%></h1>
|
||||
|
58
apps/routerconsole/jsp/configsidebar.jsp
Normal file
58
apps/routerconsole/jsp/configsidebar.jsp
Normal file
@ -0,0 +1,58 @@
|
||||
<%@page contentType="text/html"%>
|
||||
<%@page pageEncoding="UTF-8"%>
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||
|
||||
<html><head>
|
||||
<%@include file="css.jsi" %>
|
||||
<%=intl.title("config summary bar")%>
|
||||
<style type='text/css'>
|
||||
input.default {
|
||||
width: 1px;
|
||||
height: 1px;
|
||||
visibility: hidden;
|
||||
}
|
||||
</style>
|
||||
<script src="/js/ajax.js" type="text/javascript"></script>
|
||||
<%@include file="summaryajax.jsi" %>
|
||||
</head><body onload="initAjax()">
|
||||
|
||||
<%@include file="summary.jsi" %>
|
||||
<h1><%=intl._("I2P Summary Bar Configuration")%></h1>
|
||||
<div class="main" id="main">
|
||||
<%@include file="confignav.jsi" %>
|
||||
|
||||
<jsp:useBean class="net.i2p.router.web.ConfigSummaryHandler" id="formhandler" scope="request" />
|
||||
<% formhandler.storeMethod(request.getMethod()); %>
|
||||
<jsp:setProperty name="formhandler" property="*" />
|
||||
<jsp:setProperty name="formhandler" property="contextId" value="<%=(String)session.getAttribute(\"i2p.contextId\")%>" />
|
||||
<jsp:setProperty name="formhandler" property="settings" value="<%=request.getParameterMap()%>" />
|
||||
<%
|
||||
formhandler.setMovingAction();
|
||||
%>
|
||||
<jsp:getProperty name="formhandler" property="allMessages" />
|
||||
<%
|
||||
String pageNonce = formhandler.getNewNonce();
|
||||
%>
|
||||
<jsp:useBean class="net.i2p.router.web.SummaryHelper" id="summaryhelper" scope="request" />
|
||||
<jsp:setProperty name="summaryhelper" property="contextId" value="<%=(String)session.getAttribute(\"i2p.contextId\")%>" />
|
||||
|
||||
<h3><%=intl._("Refresh Interval")%></h3>
|
||||
<form action="" method="POST">
|
||||
<input type="hidden" name="nonce" value="<%=pageNonce%>" >
|
||||
<input type="hidden" name="group" value="0">
|
||||
<input type="text" name="refreshInterval" value="<jsp:getProperty name="intl" property="refresh" />" >
|
||||
<%=intl._("seconds")%>
|
||||
<input type="submit" name="action" class="accept" value="<%=intl._("Save")%>" >
|
||||
</form>
|
||||
|
||||
<h3><%=intl._("Customize Summary Bar")%></h3>
|
||||
<form action="" method="POST">
|
||||
<input type="hidden" name="nonce" value="<%=pageNonce%>" >
|
||||
<input type="hidden" name="group" value="2">
|
||||
<jsp:getProperty name="summaryhelper" property="configTable" />
|
||||
<div class="formaction">
|
||||
<input type="submit" class="reload" name="action" value="<%=intl._("Restore full default")%>" >
|
||||
<input type="submit" class="reload" name="action" value="<%=intl._("Restore minimal default")%>" >
|
||||
</div>
|
||||
</form>
|
||||
</div></body></html>
|
@ -6,10 +6,13 @@
|
||||
<html><head>
|
||||
<%@include file="css.jsi" %>
|
||||
<%=intl.title("config stats")%>
|
||||
<script src="/js/ajax.js" type="text/javascript"></script>
|
||||
<%@include file="summaryajax.jsi" %>
|
||||
<script type="text/javascript">
|
||||
function init()
|
||||
{
|
||||
checkAll = false;
|
||||
initAjax();
|
||||
}
|
||||
function toggleAll(category)
|
||||
{
|
||||
|
@ -5,7 +5,9 @@
|
||||
<html><head>
|
||||
<%@include file="css.jsi" %>
|
||||
<%=intl.title("config tunnels")%>
|
||||
</head><body>
|
||||
<script src="/js/ajax.js" type="text/javascript"></script>
|
||||
<%@include file="summaryajax.jsi" %>
|
||||
</head><body onload="initAjax()">
|
||||
|
||||
<%@include file="summary.jsi" %>
|
||||
|
||||
|
@ -6,7 +6,9 @@
|
||||
<html><head>
|
||||
<%@include file="css.jsi" %>
|
||||
<%=intl.title("config UI")%>
|
||||
</head><body>
|
||||
<script src="/js/ajax.js" type="text/javascript"></script>
|
||||
<%@include file="summaryajax.jsi" %>
|
||||
</head><body onload="initAjax()">
|
||||
|
||||
<%@include file="summary.jsi" %>
|
||||
|
||||
|
@ -6,7 +6,9 @@
|
||||
<html><head>
|
||||
<%@include file="css.jsi" %>
|
||||
<%=intl.title("config update")%>
|
||||
</head><body>
|
||||
<script src="/js/ajax.js" type="text/javascript"></script>
|
||||
<%@include file="summaryajax.jsi" %>
|
||||
</head><body onload="initAjax()">
|
||||
|
||||
<%@include file="summary.jsi" %>
|
||||
<h1><%=intl._("I2P Update Configuration")%></h1>
|
||||
|
@ -6,7 +6,9 @@
|
||||
<html><head>
|
||||
<%@include file="css.jsi" %>
|
||||
<%=intl.title("home")%>
|
||||
</head><body>
|
||||
<script src="/js/ajax.js" type="text/javascript"></script>
|
||||
<%@include file="summaryajax.jsi" %>
|
||||
</head><body onload="initAjax()">
|
||||
<%
|
||||
String consoleNonce = System.getProperty("router.consoleNonce");
|
||||
if (consoleNonce == null) {
|
||||
@ -15,16 +17,13 @@
|
||||
}
|
||||
%>
|
||||
|
||||
<%@include file="summary.jsi" %><h1><%=intl._("I2P Router Console")%></h1>
|
||||
<%@include file="summary.jsi" %>
|
||||
|
||||
<h1><%=intl._("I2P Router Console")%></h1>
|
||||
<div class="news" id="news">
|
||||
<jsp:useBean class="net.i2p.router.web.NewsHelper" id="newshelper" scope="request" />
|
||||
<jsp:setProperty name="newshelper" property="contextId" value="<%=(String)session.getAttribute(\"i2p.contextId\")%>" />
|
||||
<%
|
||||
if (newshelper.shouldShowNews()) {
|
||||
java.io.File fpath = new java.io.File(net.i2p.I2PAppContext.getGlobalContext().getRouterDir(), "docs/news.xml");
|
||||
%>
|
||||
<jsp:setProperty name="newshelper" property="page" value="<%=fpath.getAbsolutePath()%>" />
|
||||
<jsp:setProperty name="newshelper" property="maxLines" value="300" />
|
||||
<jsp:getProperty name="newshelper" property="content" />
|
||||
<hr>
|
||||
<%
|
||||
@ -45,8 +44,9 @@
|
||||
<a href="/?lang=de&consoleNonce=<%=consoleNonce%>"><img height="11" width="16" style="padding: 0 2px;" src="/flags.jsp?c=de" title="Deutsch" alt="Deutsch"></a>
|
||||
<a href="/?lang=ee&consoleNonce=<%=consoleNonce%>"><img height="11" width="16" style="padding: 0 2px;" src="/flags.jsp?c=ee" title="Eesti" alt="Eesti"></a>
|
||||
<a href="/?lang=es&consoleNonce=<%=consoleNonce%>"><img height="11" width="16" style="padding: 0 2px;" src="/flags.jsp?c=es" title="Español" alt="Español"></a>
|
||||
<a href="/?lang=fi&consoleNonce=<%=consoleNonce%>"><img height="11" width="16" style="padding: 0 2px;" src="/flags.jsp?c=fi" title="Suomi" alt="Suomi"></a><br>
|
||||
<a href="/?lang=fr&consoleNonce=<%=consoleNonce%>"><img height="11" width="16" style="padding: 0 2px;" src="/flags.jsp?c=fr" title="Français" alt="Français"></a>
|
||||
<a href="/?lang=fi&consoleNonce=<%=consoleNonce%>"><img height="11" width="16" style="padding: 0 2px;" src="/flags.jsp?c=fi" title="Suomi" alt="Suomi"></a>
|
||||
<a href="/?lang=fr&consoleNonce=<%=consoleNonce%>"><img height="11" width="16" style="padding: 0 2px;" src="/flags.jsp?c=fr" title="Français" alt="Français"></a><br>
|
||||
<a href="/?lang=el&consoleNonce=<%=consoleNonce%>"><img height="11" width="16" style="padding: 0 2px;" src="/flags.jsp?c=gr" title="ελληνικά" alt="ελληνικά"></a>
|
||||
<a href="/?lang=hu&consoleNonce=<%=consoleNonce%>"><img height="11" width="16" style="padding: 0 2px;" src="/flags.jsp?c=hu" title="Magyar" alt="Magyar"></a>
|
||||
<a href="/?lang=it&consoleNonce=<%=consoleNonce%>"><img height="11" width="16" style="padding: 0 2px;" src="/flags.jsp?c=it" title="Italiano" alt="Italiano"></a>
|
||||
<a href="/?lang=nl&consoleNonce=<%=consoleNonce%>"><img height="11" width="16" style="padding: 0 2px;" src="/flags.jsp?c=nl" title="Nederlands" alt="Nederlands"></a>
|
||||
|
@ -25,9 +25,9 @@
|
||||
}
|
||||
%>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<link rel="shortcut icon" href="/themes/console/images/favicon.ico">
|
||||
<jsp:useBean class="net.i2p.router.web.CSSHelper" id="intl" scope="request" />
|
||||
<jsp:setProperty name="intl" property="contextId" value="<%=(String)session.getAttribute(\"i2p.contextId\")%>" />
|
||||
<link rel="icon" href="<%=intl.getTheme(request.getHeader("User-Agent"))%>images/favicon.ico">
|
||||
<%
|
||||
// clickjacking
|
||||
if (intl.shouldSendXFrame())
|
||||
|
@ -9,7 +9,9 @@
|
||||
%>
|
||||
<html><head><title>I2P Router Console - Debug</title>
|
||||
<%@include file="css.jsi" %>
|
||||
</head><body>
|
||||
<script src="/js/ajax.js" type="text/javascript"></script>
|
||||
<%@include file="summaryajax.jsi" %>
|
||||
</head><body onload="initAjax()">
|
||||
<%@include file="summary.jsi" %>
|
||||
<h1>Router SKM</h1>
|
||||
<div class="main" id="main">
|
||||
|
42
apps/routerconsole/jsp/dns.jsp
Normal file
42
apps/routerconsole/jsp/dns.jsp
Normal file
@ -0,0 +1,42 @@
|
||||
<%@page contentType="text/html"%>
|
||||
<%@page trimDirectiveWhitespaces="true"%>
|
||||
<%@page pageEncoding="UTF-8"%>
|
||||
<jsp:useBean class="net.i2p.router.web.CSSHelper" id="tester" scope="request" />
|
||||
<jsp:setProperty name="tester" property="contextId" value="<%=(String)session.getAttribute(\"i2p.contextId\")%>" />
|
||||
<%
|
||||
// CSSHelper is also pulled in by css.jsi below...
|
||||
boolean testIFrame = tester.allowIFrame(request.getHeader("User-Agent"));
|
||||
if (!testIFrame) {
|
||||
response.setStatus(302, "Moved");
|
||||
response.setHeader("Location", "/susidns/index");
|
||||
} else {
|
||||
%>
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||
|
||||
<html><head>
|
||||
<%@include file="css.jsi" %>
|
||||
<%=intl.title("addressbook")%>
|
||||
<script src="/js/ajax.js" type="text/javascript"></script>
|
||||
<script src="/js/iframed.js" type="text/javascript"></script>
|
||||
<%@include file="summaryajax.jsi" %>
|
||||
<script type="text/javascript">
|
||||
function setupFrame() {
|
||||
f = document.getElementById("susidnsframe");
|
||||
injectClass(f);
|
||||
resizeFrame(f);
|
||||
}
|
||||
</script>
|
||||
</head><body onload="initAjax()">
|
||||
|
||||
<%@include file="summary.jsi" %>
|
||||
|
||||
<h1><%=intl._("I2P Addressbook")%> <span class="newtab"><a href="/susidns/index" target="_blank" title="<%=intl._("Open in new tab")%>"><img src="<%=intl.getTheme(request.getHeader("User-Agent"))%>images/newtab.png" /></a></span></h1>
|
||||
<div class="main" id="main">
|
||||
<iframe src="/susidns/index" width="100%" height="100%" frameborder="0" border="0" name="susidnsframe" id="susidnsframe" onload="setupFrame()" allowtransparency="true">
|
||||
<%=intl._("Your browser does not support iFrames.")%>
|
||||
<a href="/susidns/index"><%=intl._("Click here to continue.")%></a>
|
||||
</iframe>
|
||||
</div></body></html>
|
||||
<%
|
||||
}
|
||||
%>
|
@ -16,10 +16,12 @@
|
||||
<html><head>
|
||||
<%@include file="css.jsi" %>
|
||||
<%=intl.title("Page Not Found")%>
|
||||
</head><body>
|
||||
<script src="/js/ajax.js" type="text/javascript"></script>
|
||||
<%@include file="summaryajax.jsi" %>
|
||||
</head><body onload="initAjax()">
|
||||
<%@include file="summary.jsi" %>
|
||||
<h1><%=ERROR_CODE%> <%=ERROR_MESSAGE%></h1>
|
||||
<h1><%=ERROR_CODE%> <%=ERROR_MESSAGE%></h1>
|
||||
<div class="sorry" id="warning">
|
||||
<%=intl._("Sorry! You appear to be requesting a non-existent Router Console page or resource.")%><hr>
|
||||
<%=intl._("Error 404")%>: <%=ERROR_URI%> <%=intl._("not found")%>.
|
||||
<%=intl._("Error 404")%>: <%=ERROR_URI%> <%=intl._("not found")%>.
|
||||
</div></body></html>
|
||||
|
@ -12,7 +12,9 @@
|
||||
<%
|
||||
graphHelper.storeWriter(out);
|
||||
%>
|
||||
</head><body>
|
||||
<script src="/js/ajax.js" type="text/javascript"></script>
|
||||
<%@include file="summaryajax.jsi" %>
|
||||
</head><body onload="initAjax()">
|
||||
<%@include file="summary.jsi" %>
|
||||
<h1><%=intl._("I2P Performance Graphs")%></h1>
|
||||
<div class="main" id="main">
|
||||
|
@ -19,7 +19,9 @@
|
||||
out.print(graphHelper.getRefreshMeta());
|
||||
}
|
||||
%>
|
||||
</head><body>
|
||||
<script src="/js/ajax.js" type="text/javascript"></script>
|
||||
<%@include file="summaryajax.jsi" %>
|
||||
</head><body onload="initAjax()">
|
||||
<%@include file="summary.jsi" %>
|
||||
<h1><%=intl._("I2P Performance Graphs")%></h1>
|
||||
<div class="main" id="main">
|
||||
|
@ -9,7 +9,9 @@
|
||||
%>
|
||||
<html><head><title>I2P Router Console - help</title>
|
||||
<%@include file="css.jsi" %>
|
||||
</head><body>
|
||||
<script src="/js/ajax.js" type="text/javascript"></script>
|
||||
<%@include file="summaryajax.jsi" %>
|
||||
</head><body onload="initAjax()">
|
||||
<%@include file="summary.jsi" %>
|
||||
<h1>I2P Router Help & Support</h1>
|
||||
<div class="main" id="main"><p>
|
||||
|
@ -9,7 +9,9 @@
|
||||
%>
|
||||
<html><head><title>I2P مساعدة لوحة التحكم</title>
|
||||
<%@include file="css.jsi" %>
|
||||
</head><body>
|
||||
<script src="/js/ajax.js" type="text/javascript"></script>
|
||||
<%@include file="summaryajax.jsi" %>
|
||||
</head><body onload="initAjax()">
|
||||
<%@include file="summary.jsi" %>
|
||||
<h1>I2P مساعدة لوحة التحكم</h1>
|
||||
<div class="main" id="main" dir="rtl" lang="ar"><p>
|
||||
|
@ -9,7 +9,9 @@
|
||||
%>
|
||||
<html><head><title>Console du routeur I2P - Aide</title>
|
||||
<%@include file="css.jsi" %>
|
||||
</head><body>
|
||||
<script src="/js/ajax.js" type="text/javascript"></script>
|
||||
<%@include file="summaryajax.jsi" %>
|
||||
</head><body onload="initAjax()">
|
||||
<%@include file="summary.jsi" %>
|
||||
Traduction de mars 2011 (magma@mail.i2p)
|
||||
<h1>Aide et assistance du routeur I2P</h1>
|
||||
|
@ -9,7 +9,9 @@
|
||||
%>
|
||||
<html><head><title>I2P Router Console - help</title>
|
||||
<%@include file="css.jsi" %>
|
||||
</head><body>
|
||||
<script src="/js/ajax.js" type="text/javascript"></script>
|
||||
<%@include file="summaryajax.jsi" %>
|
||||
</head><body onload="initAjax()">
|
||||
<%@include file="summary.jsi" %>
|
||||
<h1>I2P Router Help & Support</h1>
|
||||
<div class="main" id="main"><p>
|
||||
|
@ -9,7 +9,9 @@
|
||||
%>
|
||||
<html><head><title>Консоль маршрутизатора I2P - справка</title>
|
||||
<%@include file="css.jsi" %>
|
||||
</head><body>
|
||||
<script src="/js/ajax.js" type="text/javascript"></script>
|
||||
<%@include file="summaryajax.jsi" %>
|
||||
</head><body onload="initAjax()">
|
||||
<%@include file="summary.jsi" %>
|
||||
|
||||
<h1>Справка маршрутизатора I2P</h1>
|
||||
|
@ -5,11 +5,7 @@
|
||||
<%@include file="css.jsi" %>
|
||||
<%=intl.title("home")%>
|
||||
<script src="/js/ajax.js" type="text/javascript"></script>
|
||||
<script type="text/javascript">
|
||||
var failMessage = "<b><%=intl._("Router is down")%><\/b>";
|
||||
function requestAjax1() { ajax("/xhr1.jsp", "xhr", 15000); }
|
||||
function initAjax() { setTimeout(requestAjax1, 15000); }
|
||||
</script>
|
||||
<%@include file="summaryajax.jsi" %>
|
||||
</head><body onload="initAjax()">
|
||||
<%
|
||||
String consoleNonce = System.getProperty("router.consoleNonce");
|
||||
@ -20,6 +16,11 @@
|
||||
%>
|
||||
<jsp:useBean class="net.i2p.router.web.NewsHelper" id="newshelper" scope="request" />
|
||||
<jsp:setProperty name="newshelper" property="contextId" value="<%=(String)session.getAttribute(\"i2p.contextId\")%>" />
|
||||
<%
|
||||
java.io.File fpath = new java.io.File(net.i2p.I2PAppContext.getGlobalContext().getRouterDir(), "docs/news.xml");
|
||||
%>
|
||||
<jsp:setProperty name="newshelper" property="page" value="<%=fpath.getAbsolutePath()%>" />
|
||||
<jsp:setProperty name="newshelper" property="maxLines" value="300" />
|
||||
<jsp:useBean class="net.i2p.router.web.ConfigUpdateHelper" id="updatehelper" scope="request" />
|
||||
<jsp:setProperty name="updatehelper" property="contextId" value="<%=(String)session.getAttribute(\"i2p.contextId\")%>" />
|
||||
|
||||
@ -28,19 +29,10 @@
|
||||
<div style="height: 36px;">
|
||||
<a href="/console"><img src="<%=intl.getTheme(request.getHeader("User-Agent"))%>images/i2plogo.png" alt="<%=intl._("I2P Router Console")%>" title="<%=intl._("I2P Router Console")%>"></a>
|
||||
</div>
|
||||
<hr>
|
||||
<div id="xhr">
|
||||
<!-- for non-script -->
|
||||
<%@include file="xhr1.jsi" %>
|
||||
</div>
|
||||
<%
|
||||
if (!newshelper.shouldShowNews()) {
|
||||
%>
|
||||
<hr><h3><%=intl._("News")%></h3><hr class="b">
|
||||
<jsp:getProperty name="updatehelper" property="newsStatus" />
|
||||
<%
|
||||
} // !shouldShowNews()
|
||||
%>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -48,11 +40,8 @@
|
||||
|
||||
<%
|
||||
if (newshelper.shouldShowNews()) {
|
||||
java.io.File fpath = new java.io.File(net.i2p.I2PAppContext.getGlobalContext().getRouterDir(), "docs/news.xml");
|
||||
%>
|
||||
<div class="news" id="news">
|
||||
<jsp:setProperty name="newshelper" property="page" value="<%=fpath.getAbsolutePath()%>" />
|
||||
<jsp:setProperty name="newshelper" property="maxLines" value="300" />
|
||||
<jsp:getProperty name="newshelper" property="content" />
|
||||
<hr>
|
||||
<jsp:getProperty name="updatehelper" property="newsStatus" /><br>
|
||||
@ -75,8 +64,9 @@
|
||||
<a href="/home?lang=de&consoleNonce=<%=consoleNonce%>"><img height="11" width="16" style="padding: 0 2px;" src="/flags.jsp?c=de" title="Deutsch" alt="Deutsch"></a>
|
||||
<a href="/home?lang=ee&consoleNonce=<%=consoleNonce%>"><img height="11" width="16" style="padding: 0 2px;" src="/flags.jsp?c=ee" title="Eesti" alt="Eesti"></a>
|
||||
<a href="/home?lang=es&consoleNonce=<%=consoleNonce%>"><img height="11" width="16" style="padding: 0 2px;" src="/flags.jsp?c=es" title="Español" alt="Español"></a>
|
||||
<a href="/home?lang=fi&consoleNonce=<%=consoleNonce%>"><img height="11" width="16" style="padding: 0 2px;" src="/flags.jsp?c=fi" title="Suomi" alt="Suomi"></a><br>
|
||||
<a href="/home?lang=fr&consoleNonce=<%=consoleNonce%>"><img height="11" width="16" style="padding: 0 2px;" src="/flags.jsp?c=fr" title="Français" alt="Français"></a>
|
||||
<a href="/home?lang=fi&consoleNonce=<%=consoleNonce%>"><img height="11" width="16" style="padding: 0 2px;" src="/flags.jsp?c=fi" title="Suomi" alt="Suomi"></a>
|
||||
<a href="/home?lang=fr&consoleNonce=<%=consoleNonce%>"><img height="11" width="16" style="padding: 0 2px;" src="/flags.jsp?c=fr" title="Français" alt="Français"></a><br>
|
||||
<a href="/home?lang=el&consoleNonce=<%=consoleNonce%>"><img height="11" width="16" style="padding: 0 2px;" src="/flags.jsp?c=gr" title="ελληνικά" alt="ελληνικά"></a>
|
||||
<a href="/home?lang=hu&consoleNonce=<%=consoleNonce%>"><img height="11" width="16" style="padding: 0 2px;" src="/flags.jsp?c=hu" title="Magyar" alt="Magyar"></a>
|
||||
<a href="/home?lang=it&consoleNonce=<%=consoleNonce%>"><img height="11" width="16" style="padding: 0 2px;" src="/flags.jsp?c=it" title="Italiano" alt="Italiano"></a>
|
||||
<a href="/home?lang=nl&consoleNonce=<%=consoleNonce%>"><img height="11" width="16" style="padding: 0 2px;" src="/flags.jsp?c=nl" title="Nederlands" alt="Nederlands"></a>
|
||||
|
64
apps/routerconsole/jsp/i2ptunnelmgr.jsp
Normal file
64
apps/routerconsole/jsp/i2ptunnelmgr.jsp
Normal file
@ -0,0 +1,64 @@
|
||||
<%@page contentType="text/html"%>
|
||||
<%@page trimDirectiveWhitespaces="true"%>
|
||||
<%@page pageEncoding="UTF-8"%>
|
||||
<jsp:useBean class="net.i2p.router.web.CSSHelper" id="tester" scope="request" />
|
||||
<jsp:setProperty name="tester" property="contextId" value="<%=(String)session.getAttribute(\"i2p.contextId\")%>" />
|
||||
<%
|
||||
// CSSHelper is also pulled in by css.jsi below...
|
||||
boolean testIFrame = tester.allowIFrame(request.getHeader("User-Agent"));
|
||||
if (!testIFrame) {
|
||||
response.setStatus(302, "Moved");
|
||||
response.setHeader("Location", "/i2ptunnel/");
|
||||
} else {
|
||||
%>
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||
|
||||
<html><head>
|
||||
<%@include file="css.jsi" %>
|
||||
<%=intl.title("i2p tunnel manager")%>
|
||||
<script src="/js/ajax.js" type="text/javascript"></script>
|
||||
<script src="/js/iframed.js" type="text/javascript"></script>
|
||||
<%@include file="summaryajax.jsi" %>
|
||||
<script type="text/javascript">
|
||||
function injectClassSpecific(f) {
|
||||
var doc = 'contentDocument' in f? f.contentDocument : f.contentWindow.document;
|
||||
if (doc.getElementsByClassName == undefined) {
|
||||
doc.getElementsByClassName = function(className)
|
||||
{
|
||||
var hasClassName = new RegExp("(?:^|\\s)" + className + "(?:$|\\s)");
|
||||
var allElements = document.getElementsByTagName("*");
|
||||
var results = [];
|
||||
|
||||
var element;
|
||||
for (var i = 0; (element = allElements[i]) != null; i++) {
|
||||
var elementClass = element.className;
|
||||
if (elementClass && elementClass.indexOf(className) != -1 && hasClassName.test(elementClass))
|
||||
results.push(element);
|
||||
}
|
||||
|
||||
return results;
|
||||
}
|
||||
}
|
||||
doc.getElementsByClassName('panel')[0].className += ' iframed';
|
||||
}
|
||||
function setupFrame() {
|
||||
f = document.getElementById("i2ptunnelframe");
|
||||
injectClass(f);
|
||||
injectClassSpecific(f);
|
||||
resizeFrame(f);
|
||||
}
|
||||
</script>
|
||||
</head><body onload="initAjax()">
|
||||
|
||||
<%@include file="summary.jsi" %>
|
||||
|
||||
<h1><%=intl._("I2P Tunnel Manager")%> <span class="newtab"><a href="/i2ptunnel/" target="_blank" title="<%=intl._("Open in new tab")%>"><img src="<%=intl.getTheme(request.getHeader("User-Agent"))%>images/newtab.png" /></a></span></h1>
|
||||
<div class="main" id="main">
|
||||
<iframe src="/i2ptunnel/" width="100%" height="100%" frameborder="0" border="0" name="i2ptunnelframe" id="i2ptunnelframe" onload="setupFrame()" allowtransparency="true">
|
||||
<%=intl._("Your browser does not support iFrames.")%>
|
||||
<a href="/i2ptunnel/"><%=intl._("Click here to continue.")%></a>
|
||||
</iframe>
|
||||
</div></body></html>
|
||||
<%
|
||||
}
|
||||
%>
|
@ -5,7 +5,9 @@
|
||||
<html><head>
|
||||
<%@include file="css.jsi" %>
|
||||
<%=intl.title("Jar File Dump")%>
|
||||
</head><body>
|
||||
<script src="/js/ajax.js" type="text/javascript"></script>
|
||||
<%@include file="summaryajax.jsi" %>
|
||||
</head><body onload="initAjax()">
|
||||
<%@include file="summary.jsi" %><h1>Jar File Dump</h1>
|
||||
<div class="main" id="main">
|
||||
<jsp:useBean class="net.i2p.router.web.FileDumpHelper" id="dumpHelper" scope="request" />
|
||||
|
@ -6,7 +6,9 @@
|
||||
<html><head>
|
||||
<%@include file="css.jsi" %>
|
||||
<%=intl.title("job queue")%>
|
||||
</head><body>
|
||||
<script src="/js/ajax.js" type="text/javascript"></script>
|
||||
<%@include file="summaryajax.jsi" %>
|
||||
</head><body onload="initAjax()">
|
||||
<%@include file="summary.jsi" %><h1><%=intl._("I2P Router Job Queue")%></h1>
|
||||
<div class="main" id="main">
|
||||
<jsp:useBean class="net.i2p.router.web.JobQueueHelper" id="jobQueueHelper" scope="request" />
|
||||
|
38
apps/routerconsole/jsp/js/iframed.js
Normal file
38
apps/routerconsole/jsp/js/iframed.js
Normal file
@ -0,0 +1,38 @@
|
||||
function injectClass(f) {
|
||||
f.className += ' iframed';
|
||||
var doc = 'contentDocument' in f? f.contentDocument : f.contentWindow.document;
|
||||
doc.body.className += ' iframed';
|
||||
}
|
||||
function resizeFrame(f) {
|
||||
// offsetHeight returns the height of the visible area for an object, in pixels.
|
||||
// The value contains the height with the padding, scrollBar, and the border,
|
||||
// but does not include the margin. Therefore, any content within the iframe
|
||||
// should have no margins at the very top or very bottom to avoid a scrollbar.
|
||||
var doc = 'contentDocument' in f? f.contentDocument : f.contentWindow.document;
|
||||
var totalHeight = doc.body.offsetHeight;
|
||||
|
||||
// Detect if horizontal scrollbar is present, and add its width to height if so.
|
||||
// This prevents a vertical scrollbar appearing when the min-width is passed.
|
||||
// FIXME: How to detect horizontal scrollbar in iframe? Always apply for now.
|
||||
if (true) {
|
||||
// Create the measurement node
|
||||
var scrollDiv = document.createElement("div");
|
||||
scrollDiv.className = "scrollbar-measure";
|
||||
scrollDiv.style.width = "100px";
|
||||
scrollDiv.style.height = "100px";
|
||||
scrollDiv.style.overflow = "scroll";
|
||||
scrollDiv.style.position = "absolute";
|
||||
scrollDiv.style.top = "-9999px";
|
||||
document.body.appendChild(scrollDiv);
|
||||
|
||||
// Get the scrollbar width
|
||||
var scrollbarWidth = scrollDiv.offsetWidth - scrollDiv.clientWidth;
|
||||
totalHeight += scrollbarWidth;
|
||||
|
||||
// Delete the div
|
||||
document.body.removeChild(scrollDiv);
|
||||
}
|
||||
|
||||
f.style.height = totalHeight + "px";
|
||||
}
|
||||
|
@ -5,7 +5,9 @@
|
||||
<html><head>
|
||||
<%@include file="css.jsi" %>
|
||||
<%=intl.title("logs")%>
|
||||
</head><body>
|
||||
<script src="/js/ajax.js" type="text/javascript"></script>
|
||||
<%@include file="summaryajax.jsi" %>
|
||||
</head><body onload="initAjax()">
|
||||
<%@include file="summary.jsi" %>
|
||||
<h1><%=intl._("I2P Router Logs")%></h1>
|
||||
<div class="main" id="main">
|
||||
@ -33,8 +35,10 @@
|
||||
<p><%=intl._("Note that system information, log timestamps, and log messages may provide clues to your location; please review everything you include in a bug report.")%></p>
|
||||
<h3><%=intl._("Critical Logs")%></h3><a name="criticallogs"> </a>
|
||||
<jsp:getProperty name="logsHelper" property="criticalLogs" />
|
||||
<hr>
|
||||
<h3><%=intl._("Router Logs")%> (<a href="configlogging"><%=intl._("configure")%></a>)</h3>
|
||||
<jsp:getProperty name="logsHelper" property="logs" />
|
||||
<hr>
|
||||
<h3><%=intl._("Service (Wrapper) Logs")%></h3><a name="servicelogs"> </a>
|
||||
<jsp:getProperty name="logsHelper" property="serviceLogs" />
|
||||
</div><hr></div></body></html>
|
||||
|
@ -6,7 +6,9 @@
|
||||
<html><head>
|
||||
<%@include file="css.jsi" %>
|
||||
<%=intl.title("network database")%>
|
||||
</head><body>
|
||||
<script src="/js/ajax.js" type="text/javascript"></script>
|
||||
<%@include file="summaryajax.jsi" %>
|
||||
</head><body onload="initAjax()">
|
||||
<%@include file="summary.jsi" %>
|
||||
<h1><%=intl._("I2P Network Database")%></h1>
|
||||
<div class="main" id="main">
|
||||
|
@ -7,7 +7,9 @@
|
||||
<html><head>
|
||||
<%@include file="css.jsi" %>
|
||||
<%=intl.title("WebApp Not Found")%>
|
||||
</head><body>
|
||||
<script src="/js/ajax.js" type="text/javascript"></script>
|
||||
<%@include file="summaryajax.jsi" %>
|
||||
</head><body onload="initAjax()">
|
||||
<%@include file="summary.jsi" %>
|
||||
<h1><%=intl._("Web Application Not Running")%></h1>
|
||||
<div class="sorry" id="warning">
|
||||
|
@ -9,7 +9,9 @@
|
||||
%>
|
||||
<html><head><title>I2P Router Console - internals</title>
|
||||
<%@include file="css.jsi" %>
|
||||
</head><body>
|
||||
<script src="/js/ajax.js" type="text/javascript"></script>
|
||||
<%@include file="summaryajax.jsi" %>
|
||||
</head><body onload="initAjax()">
|
||||
<%@include file="summary.jsi" %>
|
||||
<jsp:useBean class="net.i2p.router.web.OldConsoleHelper" id="conhelper" scope="request" />
|
||||
<jsp:setProperty name="conhelper" property="contextId" value="<%=(String)session.getAttribute(\"i2p.contextId\")%>" />
|
||||
|
@ -6,7 +6,9 @@
|
||||
<html><head>
|
||||
<%@include file="css.jsi" %>
|
||||
<%=intl.title("peer connections")%>
|
||||
</head><body>
|
||||
<script src="/js/ajax.js" type="text/javascript"></script>
|
||||
<%@include file="summaryajax.jsi" %>
|
||||
</head><body onload="initAjax()">
|
||||
<%@include file="summary.jsi" %>
|
||||
<h1><%=intl._("I2P Network Peers")%></h1>
|
||||
<div class="main" id="main"><div class="wideload">
|
||||
|
@ -6,7 +6,10 @@
|
||||
<html><head>
|
||||
<%@include file="css.jsi" %>
|
||||
<%=intl.title("peer profiles")%>
|
||||
</head><body><%@include file="summary.jsi" %>
|
||||
<script src="/js/ajax.js" type="text/javascript"></script>
|
||||
<%@include file="summaryajax.jsi" %>
|
||||
</head><body onload="initAjax()">
|
||||
<%@include file="summary.jsi" %>
|
||||
<h1><%=intl._("I2P Network Peer Profiles")%></h1>
|
||||
<div class="main" id="main"><div class="wideload">
|
||||
<jsp:useBean class="net.i2p.router.web.ProfilesHelper" id="profilesHelper" scope="request" />
|
||||
|
@ -6,7 +6,9 @@
|
||||
<html><head>
|
||||
<%@include file="css.jsi" %>
|
||||
<%=intl.title("statistics")%>
|
||||
</head><body>
|
||||
<script src="/js/ajax.js" type="text/javascript"></script>
|
||||
<%@include file="summaryajax.jsi" %>
|
||||
</head><body onload="initAjax()">
|
||||
<%@include file="summary.jsi" %>
|
||||
<jsp:useBean class="net.i2p.router.web.OldConsoleHelper" id="oldhelper" scope="request" />
|
||||
<jsp:setProperty name="oldhelper" property="contextId" value="<%=(String)session.getAttribute(\"i2p.contextId\")%>" />
|
||||
|
@ -1,3 +1,10 @@
|
||||
<jsp:useBean class="net.i2p.router.web.NewsHelper" id="newshelper" scope="request" />
|
||||
<jsp:setProperty name="newshelper" property="contextId" value="<%=(String)session.getAttribute(\"i2p.contextId\")%>" />
|
||||
<%
|
||||
java.io.File newspath = new java.io.File(net.i2p.I2PAppContext.getGlobalContext().getRouterDir(), "docs/news.xml");
|
||||
%>
|
||||
<jsp:setProperty name="newshelper" property="page" value="<%=newspath.getAbsolutePath()%>" />
|
||||
<jsp:setProperty name="newshelper" property="maxLines" value="300" />
|
||||
<div class="routersummaryouter">
|
||||
<%
|
||||
// The refresh delay, 0 to disable
|
||||
@ -13,9 +20,11 @@
|
||||
d = net.i2p.data.DataHelper.stripHTML(d); // XSS
|
||||
// pass the new delay parameter to the iframe
|
||||
newDelay = "?refresh=" + d;
|
||||
// update disable boolean
|
||||
intl.setDisableRefresh(d);
|
||||
}
|
||||
if (!"0".equals(d))
|
||||
out.print("<iframe src=\"/summaryframe.jsp" + newDelay + "\" height=\"1500\" width=\"200\" scrolling=\"auto\" frameborder=\"0\" title=\"sidepanel\">\n");
|
||||
if (false && !intl.getDisableRefresh())
|
||||
out.print("<noscript><iframe src=\"/summaryframe.jsp" + newDelay + "\" height=\"1500\" width=\"200\" scrolling=\"auto\" frameborder=\"0\" title=\"sidepanel\"></noscript>\n");
|
||||
}
|
||||
%>
|
||||
<div class="routersummary">
|
||||
@ -33,12 +42,12 @@
|
||||
}
|
||||
|
||||
// d and allowIFrame defined above
|
||||
if (!"0".equals(d)) {
|
||||
out.print("</div></iframe>\n");
|
||||
} else if (allowIFrame) {
|
||||
if (false && !intl.getDisableRefresh()) {
|
||||
out.print("</div><noscript></iframe></noscript>\n");
|
||||
} else if (false && allowIFrame) {
|
||||
// since we don't have an iframe this will reload the base page, and
|
||||
// the new delay will be passed to the iframe above
|
||||
out.print("<div class=\"refresh\"><form action=\"" + request.getRequestURI() + "\" method=\"POST\">\n" +
|
||||
out.print("<noscript><div class=\"refresh\"><form action=\"" + request.getRequestURI() + "\" method=\"POST\">\n" +
|
||||
"<b>");
|
||||
// We have intl defined when this is included, but not when compiled standalone.
|
||||
out.print(intl._("Refresh (s)"));
|
||||
@ -47,7 +56,7 @@
|
||||
// ditto
|
||||
out.print(intl._("Enable"));
|
||||
out.print("</button>\n" +
|
||||
"</form></div></div>\n");
|
||||
"</form></div></noscript></div>\n");
|
||||
} else {
|
||||
out.print("</div>\n");
|
||||
}
|
||||
|
5
apps/routerconsole/jsp/summaryajax.jsi
Normal file
5
apps/routerconsole/jsp/summaryajax.jsi
Normal file
@ -0,0 +1,5 @@
|
||||
<script type="text/javascript">
|
||||
var failMessage = "<hr><b><%=intl._("Router is down")%><\/b>";
|
||||
function requestAjax1() { ajax("/xhr1.jsp?requestURI=<%=request.getRequestURI()%>", "xhr", <%=intl.getRefresh()%>000); }
|
||||
function initAjax() { setTimeout(requestAjax1, <%=intl.getRefresh()%>000); }
|
||||
</script>
|
@ -26,10 +26,11 @@
|
||||
} else {
|
||||
d = net.i2p.data.DataHelper.stripHTML(d); // XSS
|
||||
intl.setRefresh(d);
|
||||
intl.setDisableRefresh(d);
|
||||
}
|
||||
// we probably don't get here if d == "0" since caught in summary.jsi, but just
|
||||
// to be sure...
|
||||
if (!"0".equals(d)) {
|
||||
if (!intl.getDisableRefresh()) {
|
||||
// doesn't work for restart or shutdown with no expl. tunnels,
|
||||
// since the call to ConfigRestartBean.renderStatus() hasn't happened yet...
|
||||
// So we delay slightly
|
||||
@ -52,12 +53,19 @@
|
||||
}
|
||||
%>
|
||||
</head><body style="margin: 0;"><div class="routersummary">
|
||||
<jsp:useBean class="net.i2p.router.web.NewsHelper" id="newshelper" scope="request" />
|
||||
<jsp:setProperty name="newshelper" property="contextId" value="<%=(String)session.getAttribute(\"i2p.contextId\")%>" />
|
||||
<%
|
||||
java.io.File newspath = new java.io.File(net.i2p.I2PAppContext.getGlobalContext().getRouterDir(), "docs/news.xml");
|
||||
%>
|
||||
<jsp:setProperty name="newshelper" property="page" value="<%=newspath.getAbsolutePath()%>" />
|
||||
<jsp:setProperty name="newshelper" property="maxLines" value="300" />
|
||||
<%@include file="summarynoframe.jsi" %>
|
||||
<%
|
||||
// d and shutdownSoon defined above
|
||||
if (!shutdownSoon) {
|
||||
out.print("<div class=\"refresh\"><form action=\"summaryframe.jsp\" method=\"POST\">\n");
|
||||
if ("0".equals(d)) {
|
||||
out.print("<hr>\n<div class=\"refresh\"><form action=\"summaryframe.jsp\" method=\"POST\">\n");
|
||||
if (intl.getDisableRefresh()) {
|
||||
out.print("<b>");
|
||||
out.print(intl._("Refresh (s)"));
|
||||
out.print(":</b> <input size=\"3\" type=\"text\" name=\"refresh\" value=\"60\" >\n");
|
||||
|
@ -1,35 +1,17 @@
|
||||
<%@page import="net.i2p.router.web.SummaryHelper" %>
|
||||
<%
|
||||
/*
|
||||
* Note:
|
||||
* This is included almost 30 times, so keep whitespace etc. to a minimum.
|
||||
* TODO - the bar would render more cleanly if we specified the img height and width here,
|
||||
* but unfortunately the images in the different themes are different sizes.
|
||||
* They range in height from 37 to 43 px. But there's a -2 bottom margin...
|
||||
* So put it in a div.
|
||||
*/
|
||||
%>
|
||||
<jsp:useBean class="net.i2p.router.web.SummaryHelper" id="helper" scope="request" />
|
||||
<jsp:setProperty name="helper" property="contextId" value="<%=(String)session.getAttribute(\"i2p.contextId\")%>" />
|
||||
<jsp:setProperty name="helper" property="action" value="<%=request.getParameter(\"action\")%>" />
|
||||
<jsp:setProperty name="helper" property="updateNonce" value="<%=request.getParameter(\"updateNonce\")%>" />
|
||||
<jsp:setProperty name="helper" property="consoleNonce" value="<%=request.getParameter(\"consoleNonce\")%>" />
|
||||
<jsp:setProperty name="helper" property="requestURI" value="<%=request.getRequestURI()%>" />
|
||||
<% helper.storeWriter(out); %>
|
||||
<%
|
||||
/*
|
||||
* The following is required for the reseed button to work, although we probably
|
||||
* only need the reseedNonce property.
|
||||
*/
|
||||
%>
|
||||
<jsp:useBean class="net.i2p.router.web.ReseedHandler" id="reseed" scope="request" />
|
||||
<jsp:setProperty name="reseed" property="*" />
|
||||
<%
|
||||
/*
|
||||
* The following is required for the update buttons to work, although we probably
|
||||
* only need the updateNonce property.
|
||||
*/
|
||||
%>
|
||||
<jsp:useBean class="net.i2p.router.web.UpdateHandler" id="update" scope="request" />
|
||||
<jsp:setProperty name="update" property="*" />
|
||||
<jsp:setProperty name="update" property="contextId" value="<%=(String)session.getAttribute(\"i2p.contextId\")%>" />
|
||||
<%
|
||||
// moved to java for ease of translation and to avoid 30 copies
|
||||
helper.renderSummaryBar();
|
||||
%>
|
||||
<div style="height: 36px;">
|
||||
<a href="/" target="_top">
|
||||
<img src="<%=intl.getTheme(request.getHeader("User-Agent"))%>images/i2plogo.png" alt="<%=intl._("I2P Router Console")%>" title="<%=intl._("I2P Router Console")%>">
|
||||
</a>
|
||||
</div>
|
||||
<div id="xhr">
|
||||
<!-- for non-script -->
|
||||
<%@include file="xhr1.jsi" %>
|
||||
</div>
|
||||
|
42
apps/routerconsole/jsp/torrents.jsp
Normal file
42
apps/routerconsole/jsp/torrents.jsp
Normal file
@ -0,0 +1,42 @@
|
||||
<%@page contentType="text/html"%>
|
||||
<%@page trimDirectiveWhitespaces="true"%>
|
||||
<%@page pageEncoding="UTF-8"%>
|
||||
<jsp:useBean class="net.i2p.router.web.CSSHelper" id="tester" scope="request" />
|
||||
<jsp:setProperty name="tester" property="contextId" value="<%=(String)session.getAttribute(\"i2p.contextId\")%>" />
|
||||
<%
|
||||
// CSSHelper is also pulled in by css.jsi below...
|
||||
boolean testIFrame = tester.allowIFrame(request.getHeader("User-Agent"));
|
||||
if (!testIFrame) {
|
||||
response.setStatus(302, "Moved");
|
||||
response.setHeader("Location", "/i2psnark/");
|
||||
} else {
|
||||
%>
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||
|
||||
<html><head>
|
||||
<%@include file="css.jsi" %>
|
||||
<%=intl.title("torrents")%>
|
||||
<script src="/js/ajax.js" type="text/javascript"></script>
|
||||
<script src="/js/iframed.js" type="text/javascript"></script>
|
||||
<%@include file="summaryajax.jsi" %>
|
||||
<script type="text/javascript">
|
||||
function setupFrame() {
|
||||
f = document.getElementById("i2psnarkframe");
|
||||
injectClass(f);
|
||||
resizeFrame(f);
|
||||
}
|
||||
</script>
|
||||
</head><body onload="initAjax()">
|
||||
|
||||
<%@include file="summary.jsi" %>
|
||||
|
||||
<h1><%=intl._("I2P Torrent Downloader")%> <span class="newtab"><a href="/i2psnark/" target="_blank" title="<%=intl._("Open in new tab")%>"><img src="<%=intl.getTheme(request.getHeader("User-Agent"))%>images/newtab.png" /></a></span></h1>
|
||||
<div class="main" id="main">
|
||||
<iframe src="/i2psnark/" width="100%" height="100%" frameborder="0" border="0" name="i2psnarkframe" id="i2psnarkframe" onload="setupFrame()" allowtransparency="true">
|
||||
<%=intl._("Your browser does not support iFrames.")%>
|
||||
<a href="/i2psnark/"><%=intl._("Click here to continue.")%></a>
|
||||
</iframe>
|
||||
</div></body></html>
|
||||
<%
|
||||
}
|
||||
%>
|
@ -6,7 +6,9 @@
|
||||
<html><head>
|
||||
<%@include file="css.jsi" %>
|
||||
<%=intl.title("tunnel summary")%>
|
||||
</head><body>
|
||||
<script src="/js/ajax.js" type="text/javascript"></script>
|
||||
<%@include file="summaryajax.jsi" %>
|
||||
</head><body onload="initAjax()">
|
||||
<%@include file="summary.jsi" %><h1><%=intl._("I2P Tunnel Summary")%></h1>
|
||||
<div class="main" id="main">
|
||||
<jsp:useBean class="net.i2p.router.web.TunnelHelper" id="tunnelHelper" scope="request" />
|
||||
|
@ -6,7 +6,9 @@
|
||||
<html><head>
|
||||
<%@include file="css.jsi" %>
|
||||
<%=intl.title("Peer Profile")%>
|
||||
</head><body>
|
||||
<script src="/js/ajax.js" type="text/javascript"></script>
|
||||
<%@include file="summaryajax.jsi" %>
|
||||
</head><body onload="initAjax()">
|
||||
<%@include file="summary.jsi" %>
|
||||
<h1><%=intl._("Peer Profile")%></h1>
|
||||
<div class="main" id="main"><div class="wideload">
|
||||
|
42
apps/routerconsole/jsp/webmail.jsp
Normal file
42
apps/routerconsole/jsp/webmail.jsp
Normal file
@ -0,0 +1,42 @@
|
||||
<%@page contentType="text/html"%>
|
||||
<%@page trimDirectiveWhitespaces="true"%>
|
||||
<%@page pageEncoding="UTF-8"%>
|
||||
<jsp:useBean class="net.i2p.router.web.CSSHelper" id="tester" scope="request" />
|
||||
<jsp:setProperty name="tester" property="contextId" value="<%=(String)session.getAttribute(\"i2p.contextId\")%>" />
|
||||
<%
|
||||
// CSSHelper is also pulled in by css.jsi below...
|
||||
boolean testIFrame = tester.allowIFrame(request.getHeader("User-Agent"));
|
||||
if (!testIFrame) {
|
||||
response.setStatus(302, "Moved");
|
||||
response.setHeader("Location", "/susimail/susimail");
|
||||
} else {
|
||||
%>
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||
|
||||
<html><head>
|
||||
<%@include file="css.jsi" %>
|
||||
<%=intl.title("webmail")%>
|
||||
<script src="/js/ajax.js" type="text/javascript"></script>
|
||||
<script src="/js/iframed.js" type="text/javascript"></script>
|
||||
<%@include file="summaryajax.jsi" %>
|
||||
<script type="text/javascript">
|
||||
function setupFrame() {
|
||||
f = document.getElementById("susimailframe");
|
||||
injectClass(f);
|
||||
resizeFrame(f);
|
||||
}
|
||||
</script>
|
||||
</head><body onload="initAjax()">
|
||||
|
||||
<%@include file="summary.jsi" %>
|
||||
|
||||
<h1><%=intl._("I2P Webmail")%> <span class="newtab"><a href="/susimail/susimail" target="_blank" title="<%=intl._("Open in new tab")%>"><img src="<%=intl.getTheme(request.getHeader("User-Agent"))%>images/newtab.png" /></a></span></h1>
|
||||
<div class="main" id="main">
|
||||
<iframe src="/susimail/susimail" width="100%" height="100%" frameborder="0" border="0" name="susimailframe" id="susimailframe" onload="setupFrame()" allowtransparency="true">
|
||||
<%=intl._("Your browser does not support iFrames.")%>
|
||||
<a href="/susimail/susimail"><%=intl._("Click here to continue.")%></a>
|
||||
</iframe>
|
||||
</div></body></html>
|
||||
<%
|
||||
}
|
||||
%>
|
@ -1,24 +1,41 @@
|
||||
<%@page import="net.i2p.router.web.SummaryHelper" %>
|
||||
<%
|
||||
/*
|
||||
* Note:
|
||||
* This is included on every refresh, so keep whitespace etc. to a minimum.
|
||||
*/
|
||||
%>
|
||||
<jsp:useBean class="net.i2p.router.web.SummaryHelper" id="helper" scope="request" />
|
||||
<jsp:setProperty name="helper" property="contextId" value="<%=(String)session.getAttribute(\"i2p.contextId\")%>" />
|
||||
<jsp:setProperty name="helper" property="action" value="<%=request.getParameter(\"action\")%>" />
|
||||
<table><tr><td align="left"><b><%=intl._("Version")%>:</b></td><td align="right">
|
||||
<jsp:getProperty name="helper" property="version" />
|
||||
</td></tr><tr><td align="left"><b><%=intl._("Uptime")%>:</b></td><td align="right">
|
||||
<jsp:getProperty name="helper" property="uptime" />
|
||||
</td></tr></table><hr>
|
||||
<jsp:setProperty name="helper" property="updateNonce" value="<%=request.getParameter(\"updateNonce\")%>" />
|
||||
<jsp:setProperty name="helper" property="consoleNonce" value="<%=request.getParameter(\"consoleNonce\")%>" />
|
||||
<%
|
||||
String reqURI = request.getRequestURI();
|
||||
if (reqURI != null)
|
||||
reqURI = reqURI.replace("/xhr1.jsp", "/home");
|
||||
if (reqURI.contains("/xhr1"))
|
||||
reqURI = request.getParameter("requestURI");
|
||||
helper.setRequestURI(reqURI);
|
||||
%>
|
||||
<h4><a href="/confignet#help" title="<%=intl._("Help with configuring your firewall and router for optimal I2P performance")%>"><%=intl._("Network")%>:
|
||||
<jsp:getProperty name="helper" property="reachability" /></a></h4>
|
||||
<hr>
|
||||
<jsp:getProperty name="helper" property="updateStatus" />
|
||||
<jsp:getProperty name="helper" property="restartStatus" />
|
||||
<hr>
|
||||
<jsp:getProperty name="helper" property="firewallAndReseedStatus" />
|
||||
<jsp:getProperty name="helper" property="destinations" />
|
||||
<% helper.storeWriter(out); %>
|
||||
<% helper.storeNewsHelper(newshelper); %>
|
||||
<%
|
||||
/*
|
||||
* The following is required for the reseed button to work, although we probably
|
||||
* only need the reseedNonce property.
|
||||
*/
|
||||
%>
|
||||
<jsp:useBean class="net.i2p.router.web.ReseedHandler" id="reseed" scope="request" />
|
||||
<jsp:setProperty name="reseed" property="*" />
|
||||
<%
|
||||
/*
|
||||
* The following is required for the update buttons to work, although we probably
|
||||
* only need the updateNonce property.
|
||||
*/
|
||||
%>
|
||||
<jsp:useBean class="net.i2p.router.web.UpdateHandler" id="update" scope="request" />
|
||||
<jsp:setProperty name="update" property="*" />
|
||||
<jsp:setProperty name="update" property="contextId" value="<%=(String)session.getAttribute(\"i2p.contextId\")%>" />
|
||||
<%
|
||||
// moved to java for ease of translation
|
||||
helper.renderSummaryBar();
|
||||
%>
|
||||
|
@ -11,4 +11,11 @@
|
||||
%>
|
||||
<jsp:useBean class="net.i2p.router.web.CSSHelper" id="intl" scope="request" />
|
||||
<jsp:setProperty name="intl" property="contextId" value="<%=(String)session.getAttribute(\"i2p.contextId\")%>" />
|
||||
<jsp:useBean class="net.i2p.router.web.NewsHelper" id="newshelper" scope="request" />
|
||||
<jsp:setProperty name="newshelper" property="contextId" value="<%=(String)session.getAttribute(\"i2p.contextId\")%>" />
|
||||
<%
|
||||
java.io.File fpath = new java.io.File(net.i2p.I2PAppContext.getGlobalContext().getRouterDir(), "docs/news.xml");
|
||||
%>
|
||||
<jsp:setProperty name="newshelper" property="page" value="<%=fpath.getAbsolutePath()%>" />
|
||||
<jsp:setProperty name="newshelper" property="maxLines" value="300" />
|
||||
<%@include file="xhr1.jsi" %>
|
||||
|
File diff suppressed because it is too large
Load Diff
6500
apps/routerconsole/locale/messages_el.po
Normal file
6500
apps/routerconsole/locale/messages_el.po
Normal file
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user