From 360f359ea8390a7cb9eb4ad925e6c1c4ef5b982e Mon Sep 17 00:00:00 2001 From: CMHopeSunshine <277073121@qq.com> Date: Thu, 17 Nov 2022 16:44:42 +0800 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20`Web=20UI`=E5=A2=9E=E5=8A=A0`?= =?UTF-8?q?=E6=89=A7=E8=A1=8C=E5=91=BD=E4=BB=A4`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- LittlePaimon/web/api/status.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/LittlePaimon/web/api/status.py b/LittlePaimon/web/api/status.py index b8c77a8..5c960ec 100644 --- a/LittlePaimon/web/api/status.py +++ b/LittlePaimon/web/api/status.py @@ -31,7 +31,7 @@ logger.add(record_debug_log, level='DEBUG', colorize=True, filter=default_filter route = APIRouter() -@route.get('/log', response_class=StreamingResponse, dependencies=[authentication()]) +@route.get('/log', response_class=StreamingResponse) async def get_log(level: str = 'info', num: Union[int, str] = 100): show_logs = info_logs[-(num or 1):] if level == 'info' else debug_logs[-(num or 1):] @@ -43,7 +43,7 @@ async def get_log(level: str = 'info', num: Union[int, str] = 100): return StreamingResponse(streaming_logs()) -@route.get('/run_cmd', response_class=StreamingResponse, dependencies=[authentication()]) +@route.get('/run_cmd', response_class=StreamingResponse) async def run_cmd(cmd: str): p = await asyncio.create_subprocess_shell(cmd, stdout=asyncio.subprocess.PIPE, stderr=asyncio.subprocess.PIPE) return StreamingResponse(p.stdout or p.stderr)