From 96fa6adfad4b80e1bbca3f319dc1768372967f1a Mon Sep 17 00:00:00 2001 From: zzz Date: Tue, 19 Nov 2019 12:11:13 +0000 Subject: [PATCH] Patch from dr|z3d - Include alternative tracker-purple.css - Add favicon.png to docroot - Add custom icon for homepage - Add auto page reload for tracker stats (ajax with meta refresh fallback) - Add footer to /tracker with ZzzOT version and github link - Add config options to hide version footer on /tracker or change footer text images by dr|z3d, same license as the code --- CHANGES.txt | 13 +++- README.txt | 1 + build.xml | 6 +- plugin/clients.config | 2 +- plugin/templates/help.html | 54 +++++++++++--- plugin/templates/index.html | 5 ++ scripts/favicon.png | Bin 0 -> 1705 bytes scripts/plugin.config | 8 +- scripts/tracker-purple.css | 40 ++++++++-- scripts/tracker.css | 77 ++++++++++++++++++-- src/java/net/i2p/zzzot/ZzzOTController.java | 26 ++++++- src/jsp/index.jsp | 14 +++- 12 files changed, 208 insertions(+), 38 deletions(-) create mode 100644 scripts/favicon.png diff --git a/CHANGES.txt b/CHANGES.txt index 73ff52d..04e300a 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -2,15 +2,22 @@ - Add more configuration, customization, and registration info to help page - Change default sig type to EdDSA - Add variables for $VERSION and $SITENAME - - Add custom CSS to docroot/tracker.css to allow customization + - Add custom CSS to docroot/tracker.css to allow customization and include + alternative tracker-purple.css + - Add favicon.png to docroot + - Add custom icon for homepage + - Add auto page reload for tracker stats (ajax with meta refresh fallback) + - Add footer to /tracker with ZzzOT version and github link + - Add config options to hide version footer on /tracker or change footer text - Tidy CHANGES.txt and add to plugin/ - Changes for new installs only: - Enhance presentation of help page - - Modify docroot/index.html post-install to contain b32 + - Modify docroot/index.html post-install to contain b32 footer - Only display warning about moving help.html if necessary - Add rewrite rules for /tracker, /tracker/, /tracker/index.html, /help and /help/ to jetty.xml - - Replace jetty.servlet.DeaultServlet with I2PDefaultServlet in BaseContext.xml + - Replace jetty.servlet.DefaultServlet with I2PDefaultServlet in BaseContext.xml + (requires I2P 0.9.31 or newer) 2017-05-21 [0.16.0] - Fix scrape response (requires I2P 0.9.30-8) (ticket #1994) diff --git a/README.txt b/README.txt index b80bcc1..11a896d 100644 --- a/README.txt +++ b/README.txt @@ -2,6 +2,7 @@ ZzzOT I2P Open Tracker Plugin ----------------------------- This is a very simple in-memory open tracker, wrapped into an I2P plugin. +A compiled version of the plugin is available at http://stats.i2p/i2p/plugins/ The plugin starts a new http server tunnel, eepsite, and Jetty server running at port 7662. The tracker status is available at http://127.0.0.1:7662/tracker/ diff --git a/build.xml b/build.xml index ce1efa7..f897984 100644 --- a/build.xml +++ b/build.xml @@ -16,7 +16,7 @@ - + @@ -24,6 +24,8 @@ + + @@ -83,6 +85,8 @@ + + diff --git a/plugin/clients.config b/plugin/clients.config index 99f61b4..e4eb47a 100644 --- a/plugin/clients.config +++ b/plugin/clients.config @@ -2,7 +2,7 @@ clientApp.0.main=net.i2p.zzzot.ZzzOTController clientApp.0.name=ZzzOT clientApp.0.args=-d $PLUGIN start clientApp.0.stopargs=-d $PLUGIN stop -clientApp.0.delay=40 +clientApp.0.delay=0 clientApp.0.startOnLoad=true # we also use i2p.jar and i2ptunnel.jar, they are in the standard router classpath clientApp.0.classpath=$PLUGIN/lib/zzzot.jar,$I2P/lib/i2psnark.jar diff --git a/plugin/templates/help.html b/plugin/templates/help.html index 72474fa..fe4f7f7 100644 --- a/plugin/templates/help.html +++ b/plugin/templates/help.html @@ -4,10 +4,11 @@ ZZZOT OPENTRACKER | HELP + diff --git a/scripts/favicon.png b/scripts/favicon.png new file mode 100644 index 0000000000000000000000000000000000000000..ae712dc4ae7c1bce21c6d48e194ac83ad8a20d32 GIT binary patch literal 1705 zcmchY`#01H0L5p#hIyHp=KEz-Mxxln5P1~F?upH8Ve?8S?S?cS5t)o-d{=E^ZTnB`J?Gxfxj)|@ZjLv@1%uQ(2Pk_ri{1ZXH>5b#)Aq%KZ*4^|1M0XGI! z*787^5crb~JPybIRU?dHkI)Y_>f* z++5?kgK8g=fh7*`J_?x1AkIb-$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e;=qItNwF;Z6`rOBT^ol5QX+Vjl zXq1AB%WNL+a;@OvX&&v4rTKxESN7{xqLBJUt{G0ZhWW0Wt%8jRR+Lw#%fqF#(P8f0 rze2vLZZZOT " + VERSION; + private static final String PROP_FOOTERTEXT = "footertext"; private static final String CONFIG_FILE = "zzzot.config"; private static final String BACKUP_SUFFIX = ".jetty8"; private static final String[] xmlFiles = { @@ -102,6 +108,8 @@ public class ZzzOTController implements ClientApp { } _zzzot = new ZzzOT(ctx, props); _sitename = props.getProperty(PROP_SITENAME, DEFAULT_SITENAME); + _showfooter = props.getProperty(PROP_SHOWFOOTER, DEFAULT_SHOWFOOTER); + _footertext = props.getProperty(PROP_FOOTERTEXT, DEFAULT_FOOTERTEXT); _state = INITIALIZED; } @@ -194,7 +202,7 @@ public class ZzzOTController implements ClientApp { if (dest != null) { List msgs = tun.clearMessages(); for (Object s : msgs) { - _log.error("NOTICE: ZzzOT Tunnel message: " + s); + _log.logAlways(Log.INFO, "NOTICE: ZzzOT Tunnel message: " + s); } } _tunnel = tun; @@ -357,7 +365,7 @@ public class ZzzOTController implements ClientApp { String b64 = dest.toBase64(); try { // help.html - String html = FileUtil.readTextFile(fileTmpl.getAbsolutePath(), 400, true); + String html = FileUtil.readTextFile(fileTmpl.getAbsolutePath(), 500, true); if (html == null) throw new IOException(fileTmpl.getAbsolutePath() + " open failed"); // replace $HOME in path @@ -382,7 +390,7 @@ public class ZzzOTController implements ClientApp { os.write(html.getBytes("UTF-8")); os.close(); // index.html - String html2 = FileUtil.readTextFile(index_in.getAbsolutePath(), 19, true); + String html2 = FileUtil.readTextFile(index_in.getAbsolutePath(), 50, true); if (html2 == null) throw new IOException(fileTmpl.getAbsolutePath() + " open failed"); html2 = html2.replace("$B32", b32); @@ -477,6 +485,16 @@ public class ZzzOTController implements ClientApp { return VERSION; } + /** @since 0.17.0 */ + public static String shouldShowFooter() { + return _showfooter; + } + + /** @since 0.17.0 */ + public static String footerText() { + return _footertext; + } + /** @since 0.12.0 */ private synchronized void changeState(ClientAppState state) { _state = state; diff --git a/src/jsp/index.jsp b/src/jsp/index.jsp index 93bf475..d7aa6a6 100644 --- a/src/jsp/index.jsp +++ b/src/jsp/index.jsp @@ -7,6 +7,7 @@ <%=ZzzOTController.getSiteName()%> OPENTRACKER | STATS +
@@ -16,7 +17,7 @@ Torrents torrents = ZzzOTController.getTorrents(); if (torrents != null) { %> -

+

Torrents: <%=torrents.size()%>
Peers: <%=torrents.countPeers()%>

@@ -27,13 +28,20 @@ <% } %> -Running ZZZOT <%=ZzzOTController.getVersion()%> +<% + String showfooter = ZzzOTController.shouldShowFooter(); + if (showfooter == "true") { +%> +<%=ZzzOTController.footerText()%> +<% + } +%>