diff --git a/LICENSE.txt b/LICENSE.txt index 53e248f9b..a4bd67dcf 100644 --- a/LICENSE.txt +++ b/LICENSE.txt @@ -236,3 +236,7 @@ distributions. See the source package for the additional license information. SAM Python Library: Public domain. + + I2PSnark: + "Man with hat over face" graphic licensed under a Creative Commons 2.0 license. + Original photo by Florian Kuhlmann. http://www.flickr.com/photos/floriankuhlmann/3117758155 diff --git a/Slackware/i2p-base/rc.i2p_def b/Slackware/i2p-base/rc.i2p_def index 8e059c23d..075e9e847 100644 --- a/Slackware/i2p-base/rc.i2p_def +++ b/Slackware/i2p-base/rc.i2p_def @@ -2,15 +2,32 @@ # Start/stop i2p service. i2p_start() { - /bin/su - -c "( export PATH=\"$PATH:/usr/lib/java/bin:/usr/lib/java/jre/bin\"; directory start )" + # Check if router is up first! + /bin/su - -c "( export PATH=\"$PATH:/usr/lib/java/bin:/usr/lib/java/jre/bin\"; directory status )" > /dev/null + if [ ! $? -eq 0 ] ; then { + # I2p is already running, so tell the user. + echo "I2P is already running..." + i2p_status + } + else + { + # Just in-case there are leftover junk in /tmp... + rm -Rf `grep /tmp/hsperfdata_root/* -le i2p` /tmp/i2p-*.tmp /tmp/router.ping + # Now that all junk is cleaned up, start. + /bin/su - -c "( export PATH=\"$PATH:/usr/lib/java/bin:/usr/lib/java/jre/bin\"; directory start )" + } + fi } i2p_stop() { /bin/su - -c "( export PATH=\"$PATH:/usr/lib/java/bin:/usr/lib/java/jre/bin\"; directory stop )" + rm -Rf `grep /tmp/hsperfdata_root/* -le i2p` /tmp/i2p-*.tmp /tmp/router.ping } i2p_restart() { - /bin/su - -c "( export PATH=\"$PATH:/usr/lib/java/bin:/usr/lib/java/jre/bin\"; directory restart)" + # We want a FULL cycle here, not the wrappers idea of this! + i2p_stop + i2p_start } i2p_status() { diff --git a/Slackware/i2p/i2p.SlackBuild b/Slackware/i2p/i2p.SlackBuild index fc95ce379..3ae2075c8 100755 --- a/Slackware/i2p/i2p.SlackBuild +++ b/Slackware/i2p/i2p.SlackBuild @@ -85,23 +85,26 @@ cp -a ../i2p $PKG/$INSTALL_DIR/ mkdir -p $PKG/install ############################################################################# -# Preconfigureation to make package smaller +# Preconfigureation to make package smaller, and... +# we keep as much as reasonable in the installation directory. +# This makes the install map fairly well to the standard installation. +# It also makes it easier to find the log and pid files! ############################################################################# cd $PKG/$INSTALL_DIR/i2p # wrapper.config $INSTALL_PATH and $SYSTEM_java_io_tmpdir -sed "s|\$INSTALL_PATH|$INSTALL_DIR/i2p|g" wrapper.config > a -sed "s|\$SYSTEM_java_io_tmpdir|/var/tmp|g" a > wrapper.config +sed "s|\$INSTALL_PATH|/$INSTALL_DIR/i2p|g" wrapper.config > a +sed "s|\$SYSTEM_java_io_tmpdir|/$INSTALL_DIR/i2p|g" a > wrapper.config # eepget %INSTALL_PATH -sed "s|\$INSTALL_PATH|$INSTALL_DIR/i2p|g" eepget > a +sed "s|\$INSTALL_PATH|/$INSTALL_DIR/i2p|g" eepget > a rm eepget mv a eepget # runplain.sh %INSTALL_PATH and %SYSTEM_java_io_tmpdir -sed "s|%INSTALL_PATH|$INSTALL_DIR/i2p|g" runplain.sh > a -sed "s|%SYSTEM_java_io_tmpdir|/var/tmp|g" a > runplain.sh +sed "s|%INSTALL_PATH|/$INSTALL_DIR/i2p|g" runplain.sh > a +sed "s|%SYSTEM_java_io_tmpdir|/$INSTALL_DIR/i2p|g" a > runplain.sh # i2prouter %INSTALL_PATH and %SYSTEM_java_io_tmpdir -sed "s|%INSTALL_PATH|$INSTALL_DIR/i2p|g" i2prouter > a -sed "s|%SYSTEM_java_io_tmpdir|/var/tmp|g" a > i2prouter +sed "s|%INSTALL_PATH|/$INSTALL_DIR/i2p|g" i2prouter > a +sed "s|%SYSTEM_java_io_tmpdir|/$INSTALL_DIR/i2p|g" a > i2prouter chmod 744 ./i2prouter chmod 744 ./osid diff --git a/apps/i2psnark/java/src/org/klomp/snark/web/I2PSnarkServlet.java b/apps/i2psnark/java/src/org/klomp/snark/web/I2PSnarkServlet.java index e284cc172..d3a04df1f 100644 --- a/apps/i2psnark/java/src/org/klomp/snark/web/I2PSnarkServlet.java +++ b/apps/i2psnark/java/src/org/klomp/snark/web/I2PSnarkServlet.java @@ -133,7 +133,6 @@ public class I2PSnarkServlet extends Default { // bypass the horrid Resource.getListHTML() String pathInfo = req.getPathInfo(); String pathInContext = URI.addPaths(path, pathInfo); - req.setCharacterEncoding("UTF-8"); resp.setCharacterEncoding("UTF-8"); resp.setContentType("text/html; charset=UTF-8"); Resource resource = getResource(pathInContext); @@ -141,7 +140,7 @@ public class I2PSnarkServlet extends Default { resp.sendError(HttpResponse.__404_Not_Found); } else { String base = URI.addPaths(req.getRequestURI(), "/"); - String listing = getListHTML(resource, base, true, method.equals("POST") ? req.getParameterMap() : null); + String listing = getListHTML(resource, base, true); if (listing != null) resp.getWriter().write(listing); else // shouldn't happen @@ -503,7 +502,7 @@ public class I2PSnarkServlet extends Default { File torrentFile = new File(baseFile.getParent(), baseFile.getName() + ".torrent"); if (torrentFile.exists()) throw new IOException("Cannot overwrite an existing .torrent file: " + torrentFile.getPath()); - _manager.saveTorrentStatus(info, s.getBitField(), null); // so addTorrent won't recheck + _manager.saveTorrentStatus(info, s.getBitField()); // so addTorrent won't recheck // DirMonitor could grab this first, maybe hold _snarks lock? FileOutputStream out = new FileOutputStream(torrentFile); out.write(info.getTorrentData()); @@ -530,8 +529,6 @@ public class I2PSnarkServlet extends Default { _manager.stopTorrent(snark.torrent, false); } if (_manager.util().connected()) { - // Give the stopped announces time to get out - try { Thread.sleep(2000); } catch (InterruptedException ie) {} _manager.util().disconnect(); _manager.addMessage(_("I2P tunnel closed.")); } @@ -1216,9 +1213,7 @@ public class I2PSnarkServlet extends Default { /** @since 0.7.14 */ private static String urlify(String s) { StringBuilder buf = new StringBuilder(256); - // browsers seem to work without doing this but let's be strict - String link = s.replace("&", "&"); - buf.append("").append(link).append(""); + buf.append("").append(s).append(""); return buf.toString(); } @@ -1257,11 +1252,10 @@ public class I2PSnarkServlet extends Default { * @param r The Resource * @param base The base URL * @param parent True if the parent directory should be included - * @param postParams map of POST parameters or null if not a POST * @return String of HTML * @since 0.7.14 */ - private String getListHTML(Resource r, String base, boolean parent, Map postParams) + private String getListHTML(Resource r, String base, boolean parent) throws IOException { if (!r.isDirectory()) @@ -1286,10 +1280,6 @@ public class I2PSnarkServlet extends Default { else torrentName = title; Snark snark = _manager.getTorrentByBaseName(torrentName); - - if (snark != null && postParams != null) - savePriorities(snark, postParams); - if (title.endsWith("/")) title = title.substring(0, title.length() - 1); title = _("Torrent") + ": " + title; @@ -1307,19 +1297,12 @@ public class I2PSnarkServlet extends Default { .append(_("Up to higher level directory")).append("\n"); } - buf.append("