From 337e4827bc5ae28146307e97e2fe7fdc3a67e0ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BA=8E=E5=B0=8F=E4=B8=98?= <49586948+Yuerchu@users.noreply.github.com> Date: Thu, 30 Jan 2025 12:26:38 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20login.py?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 删除 单测模式 --- login.py | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/login.py b/login.py index 7bdc19c..897bcdf 100644 --- a/login.py +++ b/login.py @@ -17,8 +17,8 @@ import model import tool from fastapi.responses import RedirectResponse -def create(unitTest: bool = False) -> Optional[RedirectResponse]: - @ui.page('/login' if not unitTest else '/') +def create() -> Optional[RedirectResponse]: + @ui.page('/login') async def session(): # 检测是否已登录 if app.storage.user.get('authenticated', False): @@ -71,14 +71,5 @@ def create(unitTest: bool = False) -> Optional[RedirectResponse]: ui.button('登录', on_click=lambda: login()).classes('items-center w-full').props('rounded') -if __name__ in {"__main__", "__mp_main__"}: - create(unitTest=True) - ui.run( - host='0.0.0.0', - favicon='🚀', - port=8080, - title='Findreve', - native=False, - storage_secret='findreve', - language='zh-CN', - fastapi_docs=False) \ No newline at end of file +if __name__ not in {"__main__", "__mp_main__"}: + raise Exception('不支持单测模式,请从main.py启动') \ No newline at end of file