Changeset 941db3a


Ignore:
Timestamp:
Apr 14, 2018 1:12:40 PM (2 years ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
d12b531
Parents:
98aafee
Message:

Console: Add built-by to /logs (ticket #2204)

Location:
apps/routerconsole
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • apps/routerconsole/java/src/net/i2p/router/web/helpers/FileDumpHelper.java

    r98aafee r941db3a  
    194194    }
    195195
    196     private static Attributes attributes(File f) {
     196    /**
     197     * @return null if not found
     198     * @since pkg private since 0.9.35 for LogsHelper
     199     */
     200    static Attributes attributes(File f) {
    197201        InputStream in = null;
    198202        try {
     
    208212    }
    209213
    210     private static String getAtt(Attributes atts, String s) {
     214    /**
     215     * @param atts non-null
     216     * @return HTML stripped, or null if not found
     217     * @since pkg private since 0.9.35 for LogsHelper
     218     */
     219    static String getAtt(Attributes atts, String s) {
    211220        String rv = atts.getValue(s);
    212221        if (rv != null)
  • apps/routerconsole/java/src/net/i2p/router/web/helpers/LogsHelper.java

    r98aafee r941db3a  
    99import java.util.ArrayList;
    1010import java.util.List;
     11import java.util.jar.Attributes;
    1112
    1213import net.i2p.I2PAppContext;
     
    9697            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>";
    9798        }
     99    }
     100   
     101    /**
     102     * @since 0.9.35
     103     */
     104    public String getBuiltBy() {
     105        File baseDir = _context.getBaseDir();
     106        File f = new File(new File(baseDir, "lib"), "i2p.jar");
     107        Attributes att = FileDumpHelper.attributes(f);
     108        if (att != null) {
     109            String s = FileDumpHelper.getAtt(att, "Built-By");
     110            if (s != null) {
     111                return s;
     112            }
     113        }
     114        return "Undefined";
    98115    }
    99116   
  • apps/routerconsole/jsp/logs.jsp

    r98aafee r941db3a  
    5353<tr><td><b>GMP version:</b></td><td><%=net.i2p.util.NativeBigInteger.getLibGMPVersion()%></td></tr>
    5454<tr><td><b>Encoding:</b></td><td><%=System.getProperty("file.encoding")%></td></tr>
    55 <tr><td><b>Charset:</b></td><td><%=java.nio.charset.Charset.defaultCharset().name()%></td></tr></tbody></table>
     55<tr><td><b>Charset:</b></td><td><%=java.nio.charset.Charset.defaultCharset().name()%></td></tr>
     56<tr><td><b>Built By:</b></td><td><jsp:getProperty name="logsHelper" property="builtBy" /></tbody></table>
    5657
    5758<h3 class="tabletitle"><%=intl._t("Critical Logs")%></h3>
Note: See TracChangeset for help on using the changeset viewer.