forked from I2P_Developers/i2p.i2p
Console: Add built-by to /logs (ticket #2204)
This commit is contained in:
@ -193,7 +193,11 @@ public class FileDumpHelper extends HelperBase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Attributes attributes(File f) {
|
/**
|
||||||
|
* @return null if not found
|
||||||
|
* @since pkg private since 0.9.35 for LogsHelper
|
||||||
|
*/
|
||||||
|
static Attributes attributes(File f) {
|
||||||
InputStream in = null;
|
InputStream in = null;
|
||||||
try {
|
try {
|
||||||
in = (new URL("jar:file:" + f.getAbsolutePath() + "!/META-INF/MANIFEST.MF")).openStream();
|
in = (new URL("jar:file:" + f.getAbsolutePath() + "!/META-INF/MANIFEST.MF")).openStream();
|
||||||
@ -207,7 +211,12 @@ public class FileDumpHelper extends HelperBase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static String getAtt(Attributes atts, String s) {
|
/**
|
||||||
|
* @param atts non-null
|
||||||
|
* @return HTML stripped, or null if not found
|
||||||
|
* @since pkg private since 0.9.35 for LogsHelper
|
||||||
|
*/
|
||||||
|
static String getAtt(Attributes atts, String s) {
|
||||||
String rv = atts.getValue(s);
|
String rv = atts.getValue(s);
|
||||||
if (rv != null)
|
if (rv != null)
|
||||||
rv = DataHelper.stripHTML(rv);
|
rv = DataHelper.stripHTML(rv);
|
||||||
|
@ -8,6 +8,7 @@ import java.io.IOException;
|
|||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.jar.Attributes;
|
||||||
|
|
||||||
import net.i2p.I2PAppContext;
|
import net.i2p.I2PAppContext;
|
||||||
import net.i2p.crypto.SigType;
|
import net.i2p.crypto.SigType;
|
||||||
@ -96,6 +97,22 @@ public class LogsHelper extends HelperBase {
|
|||||||
return "<p>" + _t("File location") + ": <a href=\"/wrapper.log\" target=\"_blank\">" + f.getAbsolutePath() + "</a></p></td></tr>\n<tr><td><pre id=\"servicelogs\">" + str + "</pre>";
|
return "<p>" + _t("File location") + ": <a href=\"/wrapper.log\" target=\"_blank\">" + f.getAbsolutePath() + "</a></p></td></tr>\n<tr><td><pre id=\"servicelogs\">" + str + "</pre>";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @since 0.9.35
|
||||||
|
*/
|
||||||
|
public String getBuiltBy() {
|
||||||
|
File baseDir = _context.getBaseDir();
|
||||||
|
File f = new File(new File(baseDir, "lib"), "i2p.jar");
|
||||||
|
Attributes att = FileDumpHelper.attributes(f);
|
||||||
|
if (att != null) {
|
||||||
|
String s = FileDumpHelper.getAtt(att, "Built-By");
|
||||||
|
if (s != null) {
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return "Undefined";
|
||||||
|
}
|
||||||
|
|
||||||
/***** unused
|
/***** unused
|
||||||
public String getConnectionLogs() {
|
public String getConnectionLogs() {
|
||||||
|
@ -52,7 +52,8 @@
|
|||||||
<tr><td><b>Jbigi version:</b></td><td><%=net.i2p.util.NativeBigInteger.getJbigiVersion()%></td></tr>
|
<tr><td><b>Jbigi version:</b></td><td><%=net.i2p.util.NativeBigInteger.getJbigiVersion()%></td></tr>
|
||||||
<tr><td><b>GMP version:</b></td><td><%=net.i2p.util.NativeBigInteger.getLibGMPVersion()%></td></tr>
|
<tr><td><b>GMP version:</b></td><td><%=net.i2p.util.NativeBigInteger.getLibGMPVersion()%></td></tr>
|
||||||
<tr><td><b>Encoding:</b></td><td><%=System.getProperty("file.encoding")%></td></tr>
|
<tr><td><b>Encoding:</b></td><td><%=System.getProperty("file.encoding")%></td></tr>
|
||||||
<tr><td><b>Charset:</b></td><td><%=java.nio.charset.Charset.defaultCharset().name()%></td></tr></tbody></table>
|
<tr><td><b>Charset:</b></td><td><%=java.nio.charset.Charset.defaultCharset().name()%></td></tr>
|
||||||
|
<tr><td><b>Built By:</b></td><td><jsp:getProperty name="logsHelper" property="builtBy" /></tbody></table>
|
||||||
|
|
||||||
<h3 class="tabletitle"><%=intl._t("Critical Logs")%></h3>
|
<h3 class="tabletitle"><%=intl._t("Critical Logs")%></h3>
|
||||||
<table id="criticallogs" class="logtable"><tbody>
|
<table id="criticallogs" class="logtable"><tbody>
|
||||||
|
Reference in New Issue
Block a user