Browse Source

Separate message author into own column

master
JustAnotherArchivist 3 years ago
parent
commit
f9aa3a9344
1 changed files with 11 additions and 1 deletions
  1. +11
    -1
      irclog.py

+ 11
- 1
irclog.py View File

@@ -934,7 +934,17 @@ class WebServer:
d = datetime.datetime.utcfromtimestamp(ts).replace(tzinfo = datetime.timezone.utc)
date = f'{d:%Y-%m-%d }' if withDate else ''
lineId = hashlib.md5(f'{ts} {command} {content}'.encode('utf-8')).hexdigest()[:8]
ret.append(f'<tr id="l{lineId}" class="command_{html.escape(command)}"><td><a href="/{html.escape(path)}/{d:%Y-%m-%d}#l{lineId}">{date}{d:%H:%M:%S}</a></td><td>{html.escape(content)}</td></tr>')
if command in ('NOTICE', 'PRIVMSG'):
author, content = content.split(' ', 1)
else:
author = ''
ret.append(''.join([
f'<tr id="l{lineId}" class="command_{html.escape(command)}">',
f'<td><a href="/{html.escape(path)}/{d:%Y-%m-%d}#l{lineId}">{date}{d:%H:%M:%S}</a></td>',
f'<td>{html.escape(author)}</td>',
f'<td>{html.escape(content)}</td>',
'</tr>'
]))
return '<table>\n' + '\n'.join(ret) + '\n</table>' if ret else ''

async def get_log(self, request):


Loading…
Cancel
Save