diff --git a/irclog.py b/irclog.py index 5dded26..1c8c95f 100644 --- a/irclog.py +++ b/irclog.py @@ -682,6 +682,13 @@ class Storage: class WebServer: logger = logging.getLogger('irclog.WebServer') + logStyleTag = '' def __init__(self, config): self.config = config @@ -778,7 +785,7 @@ class WebServer: fn = date.strftime('%Y-%m.log') with open(os.path.join(self.config['storage']['path'], request.match_info["path"], fn), 'r') as fp: lines = list(self._raw_to_lines(fp, filter = lambda ts, command, content: dateStart <= ts <= dateEnd)) - return aiohttp.web.Response(text = f'Previous day Next day

' + self._render_log(lines, request.match_info['path']) + '', content_type = 'text/html') + return aiohttp.web.Response(text = f'{self.logStyleTag}Previous day Next day

' + self._render_log(lines, request.match_info['path']) + '', content_type = 'text/html') async def search(self, request): self.logger.info(f'Received request {id(request)} from {request.remote!r} for {request.path!r}') @@ -789,7 +796,7 @@ class WebServer: proc = await asyncio.create_subprocess_exec('grep', '--fixed-strings', '--recursive', '--no-filename', request.query['q'], os.path.join(self.config['storage']['path'], request.match_info['path'], ''), stdout = asyncio.subprocess.PIPE) #TODO Limit size and runtime stdout, _ = await proc.communicate() - return aiohttp.web.Response(text = '' + self._render_log(self._raw_to_lines(stdout), request.match_info['path'], withDate = True) + '', content_type = 'text/html') + return aiohttp.web.Response(text = '{self.logStyleTag}' + self._render_log(self._raw_to_lines(stdout), request.match_info['path'], withDate = True) + '', content_type = 'text/html') def configure_logging(config):