From d82ab5d60de9511a40c643c13ac815c5a1ab8501 Mon Sep 17 00:00:00 2001 From: jxxghp Date: Sun, 7 Jan 2024 12:10:51 +0800 Subject: [PATCH] =?UTF-8?q?feat=EF=BC=9A=E7=94=A8=E6=88=B7=E8=AE=A4?= =?UTF-8?q?=E8=AF=81=E5=A4=B1=E8=B4=A5=E6=97=B6=E5=8F=91=E9=80=81=E6=B6=88?= =?UTF-8?q?=E6=81=AF=E6=8F=90=E9=86=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/main.py | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/app/main.py b/app/main.py index f33c5257..171f5574 100644 --- a/app/main.py +++ b/app/main.py @@ -24,8 +24,10 @@ from app.helper.thread import ThreadHelper from app.helper.display import DisplayHelper from app.helper.resource import ResourceHelper from app.helper.sites import SitesHelper +from app.helper.message import MessageHelper from app.scheduler import Scheduler -from app.command import Command +from app.command import Command, CommandChian +from app.schemas import Notification # App @@ -139,6 +141,21 @@ def start_tray(): threading.Thread(target=TrayIcon.run, daemon=True).start() +def check_auth(): + """ + 检查认证状态 + """ + if SitesHelper().auth_level < 2: + err_msg = "用户认证失败,站点相关功能将无法使用!" + MessageHelper().put(f"注意:{err_msg}") + CommandChian().post_message( + Notification( + title="MoviePilot用户认证", + text=err_msg + ) + ) + + @App.on_event("shutdown") def shutdown_server(): """ @@ -183,6 +200,8 @@ def start_module(): init_routers() # 启动前端服务 start_frontend() + # 检查认证状态 + check_auth() if __name__ == '__main__':