i2psnark: Remove hard-coded topnav image
@ -62,7 +62,7 @@ public class I2PSnarkServlet extends BasicServlet {
|
|||||||
private String _themePath;
|
private String _themePath;
|
||||||
private String _imgPath;
|
private String _imgPath;
|
||||||
private String _lastAnnounceURL;
|
private String _lastAnnounceURL;
|
||||||
|
|
||||||
private static final String DEFAULT_NAME = "i2psnark";
|
private static final String DEFAULT_NAME = "i2psnark";
|
||||||
public static final String PROP_CONFIG_FILE = "i2psnark.configFile";
|
public static final String PROP_CONFIG_FILE = "i2psnark.configFile";
|
||||||
private static final String WARBASE = "/.resources/";
|
private static final String WARBASE = "/.resources/";
|
||||||
@ -314,8 +314,6 @@ public class I2PSnarkServlet extends BasicServlet {
|
|||||||
out.write("<div class=\"snarknavbar\"><a href=\"" + _contextPath + "/\" title=\"");
|
out.write("<div class=\"snarknavbar\"><a href=\"" + _contextPath + "/\" title=\"");
|
||||||
out.write(_t("Torrents"));
|
out.write(_t("Torrents"));
|
||||||
out.write("\" class=\"snarkRefresh\">");
|
out.write("\" class=\"snarkRefresh\">");
|
||||||
out.write(toThemeImg("arrow_refresh"));
|
|
||||||
out.write(" ");
|
|
||||||
if (_contextName.equals(DEFAULT_NAME))
|
if (_contextName.equals(DEFAULT_NAME))
|
||||||
out.write(_t("I2PSnark"));
|
out.write(_t("I2PSnark"));
|
||||||
else
|
else
|
||||||
@ -325,8 +323,6 @@ public class I2PSnarkServlet extends BasicServlet {
|
|||||||
out.write("<div class=\"snarknavbar\"><a href=\"" + _contextPath + '/' + peerString + "\" title=\"");
|
out.write("<div class=\"snarknavbar\"><a href=\"" + _contextPath + '/' + peerString + "\" title=\"");
|
||||||
out.write(_t("Refresh page"));
|
out.write(_t("Refresh page"));
|
||||||
out.write("\" class=\"snarkRefresh\">");
|
out.write("\" class=\"snarkRefresh\">");
|
||||||
out.write(toThemeImg("arrow_refresh"));
|
|
||||||
out.write(" ");
|
|
||||||
if (_contextName.equals(DEFAULT_NAME))
|
if (_contextName.equals(DEFAULT_NAME))
|
||||||
out.write(_t("I2PSnark"));
|
out.write(_t("I2PSnark"));
|
||||||
else
|
else
|
||||||
@ -748,7 +744,7 @@ public class I2PSnarkServlet extends BasicServlet {
|
|||||||
writeHiddenInputs(buf, req, action);
|
writeHiddenInputs(buf, req, action);
|
||||||
out.write(buf.toString());
|
out.write(buf.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* hidden inputs for nonce and paramters p, st, and sort
|
* hidden inputs for nonce and paramters p, st, and sort
|
||||||
*
|
*
|
||||||
@ -779,7 +775,7 @@ public class I2PSnarkServlet extends BasicServlet {
|
|||||||
.append(action).append("\" >\n");
|
.append(action).append("\" >\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Build HTML-escaped and stripped query string
|
* Build HTML-escaped and stripped query string
|
||||||
*
|
*
|
||||||
@ -824,7 +820,7 @@ public class I2PSnarkServlet extends BasicServlet {
|
|||||||
}
|
}
|
||||||
return buf.toString();
|
return buf.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @since 0.9.6
|
* @since 0.9.6
|
||||||
*/
|
*/
|
||||||
@ -898,7 +894,7 @@ public class I2PSnarkServlet extends BasicServlet {
|
|||||||
_imgPath + "last.png\">");
|
_imgPath + "last.png\">");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Do what they ask, adding messages to _manager.addMessage as necessary
|
* Do what they ask, adding messages to _manager.addMessage as necessary
|
||||||
*/
|
*/
|
||||||
@ -941,7 +937,7 @@ public class I2PSnarkServlet extends BasicServlet {
|
|||||||
String canonical = null;
|
String canonical = null;
|
||||||
try {
|
try {
|
||||||
canonical = local.getCanonicalPath();
|
canonical = local.getCanonicalPath();
|
||||||
|
|
||||||
if (local.exists()) {
|
if (local.exists()) {
|
||||||
if (_manager.getTorrent(canonical) != null)
|
if (_manager.getTorrent(canonical) != null)
|
||||||
_manager.addMessage(_t("Torrent already running: {0}", newFile));
|
_manager.addMessage(_t("Torrent already running: {0}", newFile));
|
||||||
@ -1394,7 +1390,7 @@ public class I2PSnarkServlet extends BasicServlet {
|
|||||||
_manager.addMessage("Unknown POST action: \"" + action + '\"');
|
_manager.addMessage("Unknown POST action: \"" + action + '\"');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final String iopts[] = {"inbound.length", "inbound.quantity",
|
private static final String iopts[] = {"inbound.length", "inbound.quantity",
|
||||||
"outbound.length", "outbound.quantity" };
|
"outbound.length", "outbound.quantity" };
|
||||||
|
|
||||||
@ -1489,17 +1485,17 @@ public class I2PSnarkServlet extends BasicServlet {
|
|||||||
remainingSeconds = needed / downBps;
|
remainingSeconds = needed / downBps;
|
||||||
else
|
else
|
||||||
remainingSeconds = -1;
|
remainingSeconds = -1;
|
||||||
|
|
||||||
MetaInfo meta = snark.getMetaInfo();
|
MetaInfo meta = snark.getMetaInfo();
|
||||||
String b64 = Base64.encode(snark.getInfoHash());
|
String b64 = Base64.encode(snark.getInfoHash());
|
||||||
String b64Short = b64.substring(0, 6);
|
String b64Short = b64.substring(0, 6);
|
||||||
// isValid means isNotMagnet
|
// isValid means isNotMagnet
|
||||||
boolean isValid = meta != null;
|
boolean isValid = meta != null;
|
||||||
boolean isMultiFile = isValid && meta.getFiles() != null;
|
boolean isMultiFile = isValid && meta.getFiles() != null;
|
||||||
|
|
||||||
String err = snark.getTrackerProblems();
|
String err = snark.getTrackerProblems();
|
||||||
int knownPeers = Math.max(curPeers, snark.getTrackerSeenPeers());
|
int knownPeers = Math.max(curPeers, snark.getTrackerSeenPeers());
|
||||||
|
|
||||||
String rowClass = (row % 2 == 0 ? "snarkTorrentEven" : "snarkTorrentOdd");
|
String rowClass = (row % 2 == 0 ? "snarkTorrentEven" : "snarkTorrentOdd");
|
||||||
String statusString;
|
String statusString;
|
||||||
if (snark.isChecking()) {
|
if (snark.isChecking()) {
|
||||||
@ -1601,7 +1597,7 @@ public class I2PSnarkServlet extends BasicServlet {
|
|||||||
"<td class=\"snarkTorrentStatus\"><b class=\"alwaysShow\">" + _t("Stopped") + "</b>";
|
"<td class=\"snarkTorrentStatus\"><b class=\"alwaysShow\">" + _t("Stopped") + "</b>";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
out.write("<tr class=\"" + rowClass + "\" id=\"" + b64Short + "\">");
|
out.write("<tr class=\"" + rowClass + "\" id=\"" + b64Short + "\">");
|
||||||
out.write("<td class=\"center\">");
|
out.write("<td class=\"center\">");
|
||||||
out.write(statusString + "</td>\n\t");
|
out.write(statusString + "</td>\n\t");
|
||||||
@ -1946,7 +1942,7 @@ public class I2PSnarkServlet extends BasicServlet {
|
|||||||
}
|
}
|
||||||
return buf.toString();
|
return buf.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @since 0.8.2 */
|
/** @since 0.8.2 */
|
||||||
private static String thinsp(boolean disable) {
|
private static String thinsp(boolean disable) {
|
||||||
if (disable)
|
if (disable)
|
||||||
@ -2073,7 +2069,7 @@ public class I2PSnarkServlet extends BasicServlet {
|
|||||||
newURL = DataHelper.stripHTML(newURL); // XSS
|
newURL = DataHelper.stripHTML(newURL); // XSS
|
||||||
//String newFile = req.getParameter("newFile");
|
//String newFile = req.getParameter("newFile");
|
||||||
//if ( (newFile == null) || (newFile.trim().length() <= 0) ) newFile = "";
|
//if ( (newFile == null) || (newFile.trim().length() <= 0) ) newFile = "";
|
||||||
|
|
||||||
out.write("<div class=\"snarkNewTorrent\">\n");
|
out.write("<div class=\"snarkNewTorrent\">\n");
|
||||||
// *not* enctype="multipart/form-data", so that the input type=file sends the filename, not the file
|
// *not* enctype="multipart/form-data", so that the input type=file sends the filename, not the file
|
||||||
out.write("<form action=\"_post\" method=\"POST\">\n");
|
out.write("<form action=\"_post\" method=\"POST\">\n");
|
||||||
@ -2764,8 +2760,6 @@ public class I2PSnarkServlet extends BasicServlet {
|
|||||||
buf.append(" onload=\"setupbuttons()\"");
|
buf.append(" onload=\"setupbuttons()\"");
|
||||||
buf.append(">\n<center><div class=\"snarknavbar\"><a href=\"").append(_contextPath).append("/\" title=\"Torrents\"");
|
buf.append(">\n<center><div class=\"snarknavbar\"><a href=\"").append(_contextPath).append("/\" title=\"Torrents\"");
|
||||||
buf.append(" class=\"snarkRefresh\">");
|
buf.append(" class=\"snarkRefresh\">");
|
||||||
toThemeImg(buf, "arrow_refresh");
|
|
||||||
buf.append(" ");
|
|
||||||
if (_contextName.equals(DEFAULT_NAME))
|
if (_contextName.equals(DEFAULT_NAME))
|
||||||
buf.append(_t("I2PSnark"));
|
buf.append(_t("I2PSnark"));
|
||||||
else
|
else
|
||||||
@ -3406,7 +3400,7 @@ public class I2PSnarkServlet extends BasicServlet {
|
|||||||
icon = "page_white";
|
icon = "page_white";
|
||||||
return icon;
|
return icon;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Icon file in the .war. Always 16x16.
|
* Icon file in the .war. Always 16x16.
|
||||||
*
|
*
|
||||||
@ -3426,7 +3420,7 @@ public class I2PSnarkServlet extends BasicServlet {
|
|||||||
private String toImg(String icon, String altText) {
|
private String toImg(String icon, String altText) {
|
||||||
return "<img alt=\"" + altText + "\" height=\"16\" width=\"16\" src=\"" + _contextPath + WARBASE + "icons/" + icon + ".png\">";
|
return "<img alt=\"" + altText + "\" height=\"16\" width=\"16\" src=\"" + _contextPath + WARBASE + "icons/" + icon + ".png\">";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Image file in the theme.
|
* Image file in the theme.
|
||||||
*
|
*
|
||||||
@ -3436,7 +3430,7 @@ public class I2PSnarkServlet extends BasicServlet {
|
|||||||
private String toThemeImg(String image) {
|
private String toThemeImg(String image) {
|
||||||
return toThemeImg(image, "", "");
|
return toThemeImg(image, "", "");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Image file in the theme.
|
* Image file in the theme.
|
||||||
*
|
*
|
||||||
|
Before Width: | Height: | Size: 777 B |
Before Width: | Height: | Size: 777 B |
Before Width: | Height: | Size: 406 B |
Before Width: | Height: | Size: 776 B |
Before Width: | Height: | Size: 776 B |
Before Width: | Height: | Size: 777 B |
Before Width: | Height: | Size: 864 B |