|
|
@@ -28,6 +28,12 @@ logger = logging.getLogger('irclog') |
|
|
|
SSL_CONTEXTS = {'yes': True, 'no': False, 'insecure': ssl.SSLContext()} |
|
|
|
messageConnectionClosed = object() # Signals that the connection was closed by either the bot or the server |
|
|
|
messageEOF = object() # Special object to signal the end of messages to Storage |
|
|
|
LOG_COMMANDS = [ |
|
|
|
# IRC protocol(-ish) |
|
|
|
'JOIN', 'QUIT', 'PART', 'KICK', 'NICK', 'ACCOUNT', 'MODE', 'TOPIC', 'TOPICWHO', 'NAMES', 'WHOX', 'NOTICE', 'PRIVMSG', |
|
|
|
# Connection lost |
|
|
|
'CONNCLOSED', |
|
|
|
] |
|
|
|
|
|
|
|
|
|
|
|
def get_month_str(ts = None): |
|
|
@@ -832,6 +838,7 @@ class WebServer: |
|
|
|
'tr.command_QUIT, tr.command_PART, tr.command_KICK, tr.command_CONNCLOSED { color: red; }', |
|
|
|
'tr.command_NICK, tr.command_ACCOUNT, tr.command_MODE, tr.command_TOPIC, tr.command_TOPICWHO, tr.command_WHOX { color: grey; }', |
|
|
|
'tr.command_NOTICE td:nth-child(3) { font-style: italic; }', |
|
|
|
'tr.command_UNKNOWN { color: grey; }', |
|
|
|
]) + '</style>' |
|
|
|
generalStyleTag = '<style>' + ' '.join([ |
|
|
|
'.linkbar a { padding: 4px; border-right: black solid 1px; }', |
|
|
@@ -984,6 +991,8 @@ class WebServer: |
|
|
|
if command == 'NAMES': |
|
|
|
# Hidden as WHOX provides more information |
|
|
|
continue |
|
|
|
if command not in LOG_COMMANDS: |
|
|
|
command = 'UNKNOWN' |
|
|
|
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] |
|
|
|