IRCaBot 2.1.0
GPLv3 © acetone, 2021-2022
#saltr
/2023/11/28
~dr|z3d
@RN
@T3s|4
@T3s|4_
@eyedeekay
@orignal
@zzz
+Hikari
+Minogami
+acetone
+profetikla
+snex
+uop23ip
+weko
An0nm0n
Arch
DeltaOreo
FreefallHeavens
Gid
Irc2PGuest13871
Irc2PGuest2974
Liorar_
Nausicaa
Onn4l7h
StormyCloudInc
Xeha
admin
anon
anontor
anu
cheddah
itsjustme_
j6
limak
not_bob_afk
poriori_
qend-irc2p_
u5657
zzz dr|z3d, how may I help you?
dr|z3d zzz: it's all good, thanks. well, mostly. just figured I'd do the work on getting a hash / seeds / leeches table into zzzot. should be mostly done, though I probably didn't want to add your udp stuff which has maybe borked things.
dr|z3d easier than I thought, tbh.
dr|z3d public String displayInfoHashes() {
dr|z3d Map<InfoHash, Peers> sortedTable = new TreeMap<>(this);
dr|z3d StringBuilder buf = new StringBuilder(64*1024);
dr|z3d buf.append("<table>");
dr|z3d buf.append("<tr><th>Hash</th><th>Seeds</th><th>Leeches</th></tr>");
dr|z3d for (Map.Entry<InfoHash, Peers> entry : sortedTable.entrySet()) {
dr|z3d InfoHash hash = entry.getKey();
dr|z3d Peers peers = entry.getValue();
dr|z3d int seeds = peers.countSeeds();
dr|z3d int leeches = peers.countLeeches();
dr|z3d buf.append("<tr>");
dr|z3d buf.append("<td>").append(hash).append("</td>");
dr|z3d buf.append("<td>").append(seeds).append("</td>");
dr|z3d buf.append("<td>").append(leeches).append("</td>");
dr|z3d buf.append("</tr>");
dr|z3d buf.append("</table>");
dr|z3d return buf.toString();
zzz you didn't put anything in sortedtable
zzz oh yeah you did in constructor
zzz try this to make it prettier:
zzz buf.append("<td>").append(DataHelper.toHexString(hash.getData())).append("</td>");
zzz let me guess - it doesn't compile because InfoHash is not Comparable
dr|z3d oh, it compiles fine.
dr|z3d I just haven't been able to test it because snark doesn't want to play nice with it.
zzz hmph
dr|z3d I added your udp stuff, possible issue?
zzz last tested years ago, and needs new proposal and redesign
dr|z3d ok, I'll rewind the udp stuff, see if I can get snark talking to it.
dr|z3d install was messy, also possible issue. iirc it was complaining about the lack of eepsite/logs dir.
dr|z3d Client ZzzOT START_FAILED Start failed
dr|z3d java.lang.IllegalArgumentException: Jetty start failed java.io.IOException: Cannot write log directory /home/i2p/.i2p/plugins/zzzot/eepsite/logs
dr|z3d that's after a fresh install.
dr|z3d as a result of that, we don't get an index or help page.
dr|z3d I'll throw a <mkdir dir="plugin/eepsite/logs/" /> into the build.xml and see what happens.
zzz maybe
zzz havent tried a new install in years
dr|z3d you and me both.
dr|z3d ok, bingo. now have a correct help file.
dr|z3d there's still pack200 in the build.xml, which is fine on +, maybe not on canon?
zzz I know why it broke
zzz mtn tracks empty dirs but git doesn't
dr|z3d yeah, you made a note to that effect in the build.xml but forgot about the logs dir.
dr|z3d *which is essential for correct installation* :)
dr|z3d something's still not right, though, it's not tracking any hashes.
zzz check logs, looks like the Comparable problem will explode at runtime, not compile time
dr|z3d ok, will do, thanks.
dr|z3d I was looking at snark's logs, now enabled debugging logs for zzzot. nothing yet.
dr|z3d somehow I doubt that issue will be an issue until we've got some announces.
dr|z3d yup, ok, now we have some announces and comparable.
zzz did you still want to know how to do the reg CLI or are you going to just get it from i2ptunnel UI?
dr|z3d can't get it from the UI which is why I asked.
dr|z3d remember, plugins don't register with i2ptunnel...
dr|z3d unless I'm missing a trick?
zzz oh yeah
zzz java -jar i2p.jar privatekeyfile
zzz and you'll need the options:
zzz -a, -b, -y, and -z
zzz and both eeppriv.dat files
zzz which you should probably copy first in case you get something wrong and pkf wants to overwrite them
dr|z3d ok, thanks.
dr|z3d ok, so we don't explode anymore, just have to figure out how to display the table:
dr|z3d public String displayInfoHashes() {
dr|z3d Map<InfoHash, Peers> hashTable = new LinkedHashMap<>();
dr|z3d StringBuilder buf = new StringBuilder(64*1024);
dr|z3d buf.append("<table><thead><tr>")
dr|z3d .append("<th class=infohash>InfoHash</th><th class=seeds>Seeds</th><th class=leeches>Leeches</th>")
dr|z3d .append("</tr></thead>");
dr|z3d for (Map.Entry<InfoHash, Peers> entry : hashTable.entrySet()) {
dr|z3d InfoHash hash = entry.getKey();
dr|z3d Peers peers = entry.getValue();
dr|z3d int seeds = peers.countSeeds();
dr|z3d int leeches = peers.countLeeches();
dr|z3d buf.append("<tbody><tr>")
dr|z3d .append("<td class=infohash>").append(DataHelper.toHexString(hash.getData())).append("</td>")
dr|z3d .append("<td class=seeds>").append(seeds).append("</td>")
dr|z3d .append("<td class=leeches>").append(leeches).append("</td>")
dr|z3d .append("</tr></tbody>");
dr|z3d buf.append("<tfoot>")
dr|z3d .append("<th colspan=3><b>Torrents:</b> <%=torrents.size()%> &nbsp;&bullet;&nbsp; ")
dr|z3d .append("<b>Peer Connections:</b> <%=torrents.countPeers()%>")
dr|z3d .append("</tfoot></table>");
dr|z3d return buf.toString();
dr|z3d I thought putting the following into a jsp file should work, but it's not playing ball:
dr|z3d <% Torrents torrents = ZzzOTController.getTorrents();
dr|z3d torrents.displayInfoHashes(); %>
dr|z3d don't actually care about sorting, because this table is intended to be p/w protected, we can do the sorting with js.
dr|z3d ok, fix forthcoming...
zzz displayInfoHashes() returns a string
zzz so do <% torrents = ... %> <%=torrents.displayInfoHashes()%>
dr|z3d yeah, I've not got as far as:
dr|z3d <% Torrents torrents = ZzzOTController.getTorrents(); String hashList = torrents.displayInfoHashes(); %>
dr|z3d <!DOCTYPE HTML>
dr|z3d <html>
dr|z3d <head>
dr|z3d <title>Current InfoHashes | <%=ZzzOTController.getSiteName()%></title>
dr|z3d <link href="/tracker.css" rel="stylesheet" type="text/css">
dr|z3d <link rel="icon" type="image/png" href="/favicon.png">
dr|z3d <meta http-equiv="refresh" content="60;url=.">
dr|z3d </head>
dr|z3d <body id="infohashes">
dr|z3d <div id="container">
dr|z3d <div id="panel">
dr|z3d <a href="/" title="Return to home page" alt="Return to home page"><span id="sitename"><%=ZzzOTController.getSiteName()%></span></a><hr>
dr|z3d <%= hashList %>
dr|z3d which displays the table, but not the content I'm looking for, so progress.
dr|z3d *I've got as far as
zzz that should work
dr|z3d how is that different from:
dr|z3d <dr|z3d> <% Torrents torrents = ZzzOTController.getTorrents();
dr|z3d <dr|z3d> torrents.displayInfoHashes(); %>
zzz you're throwing away the return value of displayInfoHashes()
zzz <%=x%> writes out x
dr|z3d ok, so we need them in separated <% %> then?
zzz alternatively, if inside <% %> already, do <% ... out.print(torrent.displayInfoHashes());
zzz if you want to sort something non-Comparable see e.g. the top of BanlistRenderer in the console
dr|z3d ok, thanks. yeah, not bothered with sort, the intention was always to implement column sorting via js, so I can set the default sort there.
dr|z3d ok, working \o/
zzz nice. zzzot is so simple to hack on