forked from I2P_Developers/i2p.i2p
/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
This commit is contained in:
@ -19,6 +19,7 @@ import java.util.jar.Manifest;
|
||||
import net.i2p.crypto.SHA256Generator;
|
||||
import net.i2p.data.DataHelper;
|
||||
import net.i2p.util.FileUtil;
|
||||
import net.i2p.util.SystemVersion;
|
||||
|
||||
/**
|
||||
* Dump info on jars and wars
|
||||
@ -26,11 +27,12 @@ import net.i2p.util.FileUtil;
|
||||
* @since 0.8.13
|
||||
*/
|
||||
public class FileDumpHelper extends HelperBase {
|
||||
|
||||
|
||||
private static final boolean isWindows = SystemVersion.isWindows();
|
||||
public String getFileSummary() {
|
||||
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>" +
|
||||
"<th>JDK</th><th>Built</th><th>By</th><th>Mods</th></tr>");
|
||||
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>\n");
|
||||
|
||||
// jars added in wrapper.config
|
||||
ClassLoader loader = ClassLoader.getSystemClassLoader();
|
||||
@ -57,19 +59,31 @@ public class FileDumpHelper extends HelperBase {
|
||||
|
||||
// our jars
|
||||
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");
|
||||
|
||||
// our wars
|
||||
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");
|
||||
|
||||
// plugins
|
||||
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();
|
||||
if (files != null) {
|
||||
Arrays.sort(files);
|
||||
for (int i = 0; i < files.length; i++) {
|
||||
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");
|
||||
dir = new File(files[i], "console/webapps");
|
||||
dumpDir(buf, dir, ".war");
|
||||
@ -92,7 +106,7 @@ public class FileDumpHelper extends HelperBase {
|
||||
}
|
||||
|
||||
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>");
|
||||
long mod = f.lastModified();
|
||||
@ -107,14 +121,14 @@ public class FileDumpHelper extends HelperBase {
|
||||
if (hash != null) {
|
||||
byte[] hh = new byte[16];
|
||||
System.arraycopy(hash, 0, hh, 0, 16);
|
||||
buf.append("<tt>");
|
||||
buf.append("<span class=\"sha256\"><tt>");
|
||||
String p1 = DataHelper.toHexString(hh);
|
||||
for (int i = p1.length(); i < 32; i++) {
|
||||
buf.append('0');
|
||||
}
|
||||
buf.append(p1).append("</tt><br>");
|
||||
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);
|
||||
if (att == null)
|
||||
@ -130,9 +144,9 @@ public class FileDumpHelper extends HelperBase {
|
||||
// fix and uncomment if a reliable viewmtn host appears
|
||||
//buf.append("<a href=\"http://killyourtv.i2p/viewmtn/revision/info/").append(s)
|
||||
// .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>" +
|
||||
"<tt>").append(s.substring(20)).append("</tt>");
|
||||
"<tt>").append(s.substring(20)).append("</tt></span>");
|
||||
//buf.append("</tt>");
|
||||
}
|
||||
buf.append("</td><td>");
|
||||
@ -147,11 +161,15 @@ public class FileDumpHelper extends HelperBase {
|
||||
s = getAtt(att, "Built-By");
|
||||
if (s != null)
|
||||
buf.append(s);
|
||||
buf.append("</td><td><font color=\"red\">");
|
||||
buf.append("</td><td>");
|
||||
s = getAtt(att, "Workspace-Changes");
|
||||
if (s != null)
|
||||
buf.append(s.replace(",", "<br>"));
|
||||
buf.append("</font></td></tr>\n");
|
||||
if (s != null) {
|
||||
// Encase each mod in a span so we can single click select individual mods
|
||||
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) {
|
||||
|
Reference in New Issue
Block a user