|
|
@@ -927,7 +927,7 @@ class WebServer: |
|
|
|
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>') |
|
|
|
return '<table>\n' + '\n'.join(ret) + '\n</table>' |
|
|
|
return '<table>\n' + '\n'.join(ret) + '\n</table>' if ret else '' |
|
|
|
|
|
|
|
async def get_log(self, request): |
|
|
|
self.logger.info(f'Received request {id(request)} from {request.remote!r} for {request.path!r}') |
|
|
@@ -1047,7 +1047,7 @@ class WebServer: |
|
|
|
return aiohttp.web.HTTPInternalServerError() |
|
|
|
stdout, incomplete = stdoutTask.result() |
|
|
|
self.logger.info(f'Request {id(request)} grep exited with {proc.returncode} and produced {len(stdout)} bytes (incomplete: {incomplete})') |
|
|
|
if proc.returncode != 0: |
|
|
|
if proc.returncode not in (0, 1): |
|
|
|
incomplete = True |
|
|
|
lines = self._raw_to_lines(self._stdout_with_path(stdout)) |
|
|
|
return aiohttp.web.Response( |
|
|
@@ -1060,7 +1060,7 @@ class WebServer: |
|
|
|
'</head>', |
|
|
|
'<body>', |
|
|
|
'<p id="incomplete">Warning: output incomplete due to exceeding time or size limits</p>' if incomplete else '', |
|
|
|
self._render_log(lines, withDate = True), |
|
|
|
self._render_log(lines, withDate = True) or 'No results.', |
|
|
|
'</body>', |
|
|
|
'</html>' |
|
|
|
]), |
|
|
|