diff -uNr a/logotron/MANIFEST.TXT b/logotron/MANIFEST.TXT --- a/logotron/MANIFEST.TXT 77c1fe5ce35c77d6b10d9b534c6e2aced87e55bb4c402e7113af40b2901539b282ca8a4bd5704022fba1d10d8305c956030239b2b66ae2732616c3e1fd9a3e5f +++ b/logotron/MANIFEST.TXT 11153bcdf5cbd2587a98aeefd8cd6326988ad046d897cdbf25a23c2fd96bfe23888ee768236f5b5e11022c716dde7f79ba3f8fb267975ccb20a5fa1f542c2275 @@ -3,3 +3,4 @@ 589662 raw_line_export asciilifeform "Export lines in Phf format; fix for debug knob." 589674 rle_errata asciilifeform "Date arrow enable fix." 589783 irssi2tmsr diana_coman "Converter of irssi logs to the tmsr format used by the logotron. Added authors in MANIFEST.TXT." +590448 uniturds_etc asciilifeform "Phf's algo for uniturd digestion; cosmetic improvements to WWW displayer." diff -uNr a/logotron/README.txt b/logotron/README.txt --- a/logotron/README.txt 45fa8f8a0d6e12ede0c94ba6b85a7b43b8409ba841127decb2409df358dbb5c3ee6c5f2b5c17f3f5fa8829abc7ac38c979bf628ce447bd419ace2078cf3d5d8d +++ b/logotron/README.txt 90a1c2e178dec4991603e7295a180ddec5dc9b07c14fb924b8b78645a00797edda0b01fc872fa2b5ba346dfac2e769d526c002808cb8091bfe98aaf328f8c918 @@ -80,3 +80,15 @@ (2) User may request export of raw log lines in Phf-classical format. E.g. : http://logs.nosuchlabs.com/log-raw/trilema?istart=1925000&iend=1925500 + + +############### +Aug. 16 Update: +############### + +(1) Bot: added Phf's algo for uniturd processing ('fallback to latin-1'). +(2) Bot: May leave IRC password blank in config for use with unregged bots +(3) WWW: 'Checkerboard' colouring; footer links. +(4) WWW: Links in log lines now open in new browser tab (a la Phf's log) +(5) WWW: Can now be loaded 'in reverse gear', http://...../log?rev=1 +(6) WWW: 'Random' knob, takes reader to an arbitrary moment in past log. diff -uNr a/logotron/bot.py b/logotron/bot.py --- a/logotron/bot.py a168b17f05e71bec4ed700eda6ae588d080f41d1b93842044709fc8349d1a44116692fcccdc10861dc1e4e317f02f7456e70dcf66945fd9451d83b83f09a85e4 +++ b/logotron/bot.py f8aaac719d30714fb9d79e3a0e59daf3fc306d75d1aef8837919696ff81787c082eaffb5c42cc4cdfa85c78267c2cf362c5bd2c623d11cafc4ae32ac471d1d19 @@ -229,7 +229,10 @@ # Auth to server send("NICK %s\r\n" % Nick) send("USER %s %s %s :%s\r\n" % (Nick, Nick, Nick, Nick)) - send("NICKSERV IDENTIFY %s %s\r\n" % (Nick, Pass)) + + # If this is a production bot, rather than test, there will be a PW: + if Pass != "": + send("NICKSERV IDENTIFY %s %s\r\n" % (Nick, Pass)) time.sleep(Join_Delay) # wait to join until fleanode eats auth @@ -258,7 +261,10 @@ connected = False continue try: - data = data.strip(b'\r\n').decode("utf-8") + try: + data = data.strip(b'\r\n').decode("utf-8") + except UnicodeDecodeError: + data = data.strip(b'\r\n').decode('latin-1') for l in data.splitlines(): received_line(l) continue diff -uNr a/logotron/reader.py b/logotron/reader.py --- a/logotron/reader.py fc6b0036d74f0369666fcbe199cda20733e2b5f384c4653ce6eebc294c61ab14ad70de596f34979ec91896e1a4d298153628f13ba430d8190d6360f0102fde39 +++ b/logotron/reader.py 96d91f8b483d435147d82a364ab5d03f1154316aa1da1a05a0b4333b3e88081fe92a0747fb0923813ffbdb4d9fb4239e4247f792bede52dcacdd83f42e439179 @@ -243,7 +243,9 @@ # Regexps used in format_logline: -boxlinks_re = re.compile('\[\s*[^ <]+\s*\]\[([^\[\]]+)\]') +boxlinks_re = re.compile( + '\[\s*]*>[^ <]+\s*\]\[([^\[\]]+)\]') + stdlinks_re = re.compile('(http[^ \[\]]+)') @@ -252,10 +254,12 @@ payload = html_escape(l['payload']) # Format ordinary links: - payload = re.sub(stdlinks_re, r'\1', payload) + payload = re.sub(stdlinks_re, + r'\1', payload) # Now also format [link][text] links : - payload = re.sub(boxlinks_re, r'\2', payload) + payload = re.sub(boxlinks_re, + r'\2', payload) # If this is a search result, illuminate the matched strings: if highlights != []: @@ -309,12 +313,29 @@ chan, next_day_txt) + # s += """Reverse""".format( + # get_base(), chan) + return s # Make above callable from inside htm templater: app.jinja_env.globals.update(generate_navbar=generate_navbar) +@app.route('/rnd/') +def rnd(chan): + # Handle rubbish chan: + if chan not in Channels: + return redirect(url_for('log')) + + rnd_line = query_db( + '''select * from loglines where chan=%s + order by random() limit 1 ;''', + [chan], one=True) + + return redirect(line_url(rnd_line)) + + @app.route('/log//') @app.route('/log/', defaults={'date': None}) @app.route('/log/', defaults={'chan': Default_Chan, 'date': None}) @@ -327,6 +348,9 @@ # Get possible selection start and end sel_start = request.args.get('ss', default = 0, type = int) sel_end = request.args.get('se', default = 0, type = int) + + # Get possible 'reverse gear' + rev = request.args.get('rev', default = 0, type = int) # Get current time now = datetime.now() @@ -358,13 +382,18 @@ and t between %s and %s order by idx asc;''', [chan, day_start, day_end], one=False) + # Optional 'reverse gear' knob: + if rev == 1: + lines.reverse() + # Return the HTMLized text return render_template('log.html', chan = chan, loglines = lines, sel = (sel_start, sel_end), date = date, - tail = tail) + tail = tail, + rev = not rev) @app.route('/log-raw/') diff -uNr a/logotron/templates/layout.html b/logotron/templates/layout.html --- a/logotron/templates/layout.html 587ccf877ba1bff6dfa4547ebfed8fae1b071cf243fa4bd77f56f91c0a1b6a692137ff9dc5b458c34783ac632bcb83abac664073ab82d79649709810f4cf9c0a +++ b/logotron/templates/layout.html 0ff5a7efd8e622b812ee6c649d7157d362bd89bb116eede8102c08118b064fdb555a64084c2fe6f93537e044e02198846b707687ecf4dab03ed696673bb9034f @@ -35,7 +35,6 @@ } div { - white-space: pre-wrap; } .bot, @@ -44,14 +43,26 @@ color: #777; font-weight: normal; } + + .loglines { + float:left; + clear:none; + } + + .loglines div:nth-child(2n) { + } + + .loglines div:nth-child(2n+1) { + background: #f5f5f5; + } .mention { - background: lightyellow; + background: lightyellow !important;; } :target, .active { - background: lightyellow; + background: lightyellow !important;; } img.inline { @@ -72,12 +83,12 @@ #navbar { margin-bottom: 1em; } - + .highlight { - background: yellow; + background: yellow !important;; padding: 1px; } - + @@ -88,7 +99,7 @@ - No Such lAbs @@ -100,7 +111,7 @@ - Pizarro @@ -122,6 +133,11 @@ {% block body %}{% endblock %} +
+ + diff -uNr a/logotron/templates/log.html b/logotron/templates/log.html --- a/logotron/templates/log.html f687b56110c1f5a947f95b3767df3f224f9580a1751cee8f27dc45a099dd1416c3afe6bb205468b7d529d5a1e73e8224fe52aa18158f5ca2e7f8874e74e698a3 +++ b/logotron/templates/log.html 52d528c55a54d0077907ddae6d862d9b3e9c4afb9d787874a8844de4c3231b8c8d714dc2bef369004efbef7cbdba4b81ec1081f71a1ea48f5598b5780facef6a @@ -8,9 +8,11 @@ -{% for l in loglines %} -{{ format_logline(l, [], sel) | safe }} -{% endfor %} +
+ {% for l in loglines %} + {{ format_logline(l, [], sel) | safe }} + {% endfor %} +