- JARs, WARs & individual plugins separated with headers
- Filenames stripped of path info (path indicated on headers and tooltips)
- Add container divs and styling markup
This commit is contained in:
str4d
2017-07-27 00:42:46 +00:00
parent fe2387e4f0
commit 2bfe27d217
2 changed files with 34 additions and 12 deletions

View File

@ -19,6 +19,7 @@ import java.util.jar.Manifest;
import net.i2p.crypto.SHA256Generator; import net.i2p.crypto.SHA256Generator;
import net.i2p.data.DataHelper; import net.i2p.data.DataHelper;
import net.i2p.util.FileUtil; import net.i2p.util.FileUtil;
import net.i2p.util.SystemVersion;
/** /**
* Dump info on jars and wars * Dump info on jars and wars
@ -26,11 +27,12 @@ import net.i2p.util.FileUtil;
* @since 0.8.13 * @since 0.8.13
*/ */
public class FileDumpHelper extends HelperBase { public class FileDumpHelper extends HelperBase {
private static final boolean isWindows = SystemVersion.isWindows();
public String getFileSummary() { public String getFileSummary() {
StringBuilder buf = new StringBuilder(16*1024); StringBuilder buf = new StringBuilder(16*1024);
buf.append("<table id=\"jardump\"><tr><th>File</th><th>Size</th><th>Date</th><th>SHA 256</th><th>Revision</th>" + buf.append("<table id=\"jardump\">\n<tr><th>File</th><th>Size</th><th>Date</th><th>SHA 256</th><th>Revision</th>" +
"<th>JDK</th><th>Built</th><th>By</th><th>Mods</th></tr>"); "<th>JDK</th><th>Built</th><th>By</th><th>Mods</th></tr>\n");
// jars added in wrapper.config // jars added in wrapper.config
ClassLoader loader = ClassLoader.getSystemClassLoader(); ClassLoader loader = ClassLoader.getSystemClassLoader();
@ -57,19 +59,31 @@ public class FileDumpHelper extends HelperBase {
// our jars // our jars
File dir = new File(_context.getBaseDir(), "lib"); File dir = new File(_context.getBaseDir(), "lib");
buf.append("<tr><th class=\"subheading routerfiles\" colspan=\"9\"><b>Router Jar Files:</b> <code>");
buf.append(dir.getAbsolutePath());
buf.append("</code></th></tr>\n");
dumpDir(buf, dir, ".jar"); dumpDir(buf, dir, ".jar");
// our wars // our wars
dir = new File(_context.getBaseDir(), "webapps"); dir = new File(_context.getBaseDir(), "webapps");
buf.append("<tr><th class=\"subheading routerfiles\" colspan=\"9\"><b>Router War Files:</b> <code>");
buf.append(dir.getAbsolutePath());
buf.append("</code></th></tr>\n");
dumpDir(buf, dir, ".war"); dumpDir(buf, dir, ".war");
// plugins // plugins
File pluginDir = new File(_context.getConfigDir(), PluginStarter.PLUGIN_DIR); File pluginDir = new File(_context.getConfigDir(), PluginStarter.PLUGIN_DIR);
buf.append("<tr><th class=\"subheading pluginfiles\" colspan=\"9\"><b>I2P Plugins:</b> <code>");
buf.append(pluginDir.getAbsolutePath());
buf.append("</code></th></tr>");
File[] files = pluginDir.listFiles(); File[] files = pluginDir.listFiles();
if (files != null) { if (files != null) {
Arrays.sort(files); Arrays.sort(files);
for (int i = 0; i < files.length; i++) { for (int i = 0; i < files.length; i++) {
dir = new File(files[i], "lib"); dir = new File(files[i], "lib");
buf.append("<tr><th class=\"subheading pluginfiles\" colspan=\"9\"><b>Plugin File Location:</b> <code>");
buf.append(dir.getAbsolutePath());
buf.append("</code></th></tr>");
dumpDir(buf, dir, ".jar"); dumpDir(buf, dir, ".jar");
dir = new File(files[i], "console/webapps"); dir = new File(files[i], "console/webapps");
dumpDir(buf, dir, ".war"); dumpDir(buf, dir, ".war");
@ -92,7 +106,7 @@ public class FileDumpHelper extends HelperBase {
} }
private static void dumpFile(StringBuilder buf, File f) { private static void dumpFile(StringBuilder buf, File f) {
buf.append("<tr><td><b>").append(f.getAbsolutePath()).append("</b></td>" + buf.append("<tr><td><b title=\"").append(f.getAbsolutePath()).append("\">").append(f.getName()).append("</b></td>" +
"<td align=\"right\">").append(f.length()).append("</td>" + "<td align=\"right\">").append(f.length()).append("</td>" +
"<td>"); "<td>");
long mod = f.lastModified(); long mod = f.lastModified();
@ -107,14 +121,14 @@ public class FileDumpHelper extends HelperBase {
if (hash != null) { if (hash != null) {
byte[] hh = new byte[16]; byte[] hh = new byte[16];
System.arraycopy(hash, 0, hh, 0, 16); System.arraycopy(hash, 0, hh, 0, 16);
buf.append("<tt>"); buf.append("<span class=\"sha256\"><tt>");
String p1 = DataHelper.toHexString(hh); String p1 = DataHelper.toHexString(hh);
for (int i = p1.length(); i < 32; i++) { for (int i = p1.length(); i < 32; i++) {
buf.append('0'); buf.append('0');
} }
buf.append(p1).append("</tt><br>"); buf.append(p1).append("</tt><br>");
System.arraycopy(hash, 16, hh, 0, 16); System.arraycopy(hash, 16, hh, 0, 16);
buf.append("<tt>").append(DataHelper.toHexString(hh)).append("</tt>"); buf.append("<tt>").append(DataHelper.toHexString(hh)).append("</tt></span>");
} }
Attributes att = attributes(f); Attributes att = attributes(f);
if (att == null) if (att == null)
@ -130,9 +144,9 @@ public class FileDumpHelper extends HelperBase {
// fix and uncomment if a reliable viewmtn host appears // fix and uncomment if a reliable viewmtn host appears
//buf.append("<a href=\"http://killyourtv.i2p/viewmtn/revision/info/").append(s) //buf.append("<a href=\"http://killyourtv.i2p/viewmtn/revision/info/").append(s)
// .append("\">"); // .append("\">");
buf.append("<tt>").append(s.substring(0, 20)).append("</tt>" + buf.append("<span class=\"revision\"><tt>").append(s.substring(0, 20)).append("</tt>" +
"<br>" + "<br>" +
"<tt>").append(s.substring(20)).append("</tt>"); "<tt>").append(s.substring(20)).append("</tt></span>");
//buf.append("</tt>"); //buf.append("</tt>");
} }
buf.append("</td><td>"); buf.append("</td><td>");
@ -147,11 +161,15 @@ public class FileDumpHelper extends HelperBase {
s = getAtt(att, "Built-By"); s = getAtt(att, "Built-By");
if (s != null) if (s != null)
buf.append(s); buf.append(s);
buf.append("</td><td><font color=\"red\">"); buf.append("</td><td>");
s = getAtt(att, "Workspace-Changes"); s = getAtt(att, "Workspace-Changes");
if (s != null) if (s != null) {
buf.append(s.replace(",", "<br>")); // Encase each mod in a span so we can single click select individual mods
buf.append("</font></td></tr>\n"); buf.append("<font color=\"red\"><span class=\"unsignedmod\">")
.append(s.replace(",", "</span></font><hr><font color=\"red\"><span class=\"unsignedmod\">"))
.append("</span></font>");
}
buf.append("</td></tr>\n");
} }
private static byte[] sha256(File f) { private static byte[] sha256(File f) {

View File

@ -3,6 +3,10 @@
- /debug: - /debug:
- Add container divs and styling markup - Add container divs and styling markup
- Add top navigation menu - Add top navigation menu
- /jars:
- JARs, WARs & individual plugins separated with headers
- Filenames stripped of path info (path indicated on headers and tooltips)
- Add container divs and styling markup
* I2PSnark: * I2PSnark:
- Mitigate truncation of ratings dropdown in comments section (translations) - Mitigate truncation of ratings dropdown in comments section (translations)
- light: Reduce contrast of display text - light: Reduce contrast of display text