From 817b55b84ab65e0404b15195bed97a46d977f3b9 Mon Sep 17 00:00:00 2001 From: Kyomotoi Date: Fri, 13 May 2022 23:59:19 +0800 Subject: =?UTF-8?q?=F0=9F=9A=9A=20=E7=8B=AC=E7=AB=8B=E6=8E=A7=E5=88=B6?= =?UTF-8?q?=E5=8F=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ATRI/plugins/status/driver/__init__.py | 41 ---------------------------------- 1 file changed, 41 deletions(-) delete mode 100644 ATRI/plugins/status/driver/__init__.py (limited to 'ATRI/plugins/status/driver/__init__.py') diff --git a/ATRI/plugins/status/driver/__init__.py b/ATRI/plugins/status/driver/__init__.py deleted file mode 100644 index 199fb1e..0000000 --- a/ATRI/plugins/status/driver/__init__.py +++ /dev/null @@ -1,41 +0,0 @@ -from nonebot import get_driver -from nonebot.drivers.fastapi import Driver - -from fastapi.middleware.cors import CORSMiddleware - -from .view import ( - handle_auther, - handle_base_uri, - handle_runtime_info, - handle_message_deal_info, -) - - -CONSOLE_API_URI = "/capi" # base point -CONSOLE_API_AUTH_URI = "/capi/auth" # 验证后台许可 -CONSOLE_API_RUNTIME_URI = "/capi/runtime" # 获取运行占用信息 -CONSOLE_API_MESSAGE_URI = "/capi/message" -# CONSOLE_API_AUTH_COOKIES_URI = "/capi/auth/cookies" # 验证cookies - - -def register_routes(driver: Driver): - app = driver.server_app - - origins = ["*"] - app.add_middleware( - CORSMiddleware, - allow_origins=origins, - allow_credentials=True, - allow_methods=["*"], - allow_headers=["*"], - ) - - app.get(CONSOLE_API_URI)(handle_base_uri) - app.get(CONSOLE_API_RUNTIME_URI)(handle_runtime_info) - app.get(CONSOLE_API_MESSAGE_URI)(handle_message_deal_info) - app.get(CONSOLE_API_AUTH_URI)(handle_auther) - - -def init(): - driver = get_driver() - register_routes(driver) # type: ignore -- cgit v1.2.3