From b5fee91e28676729008178ac68029707fa4cb655 Mon Sep 17 00:00:00 2001 From: xaoyaoo Date: Sat, 17 Aug 2024 12:07:29 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AF=A5flask=E4=B8=BAfastapi=EF=BC=8C?= =?UTF-8?q?=E9=80=9F=E5=BA=A6=E6=9B=B4=E5=BF=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pywxdump/api/__init__.py | 9 ++++----- pywxdump/api/local_server.py | 6 +++--- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/pywxdump/api/__init__.py b/pywxdump/api/__init__.py index 43cd5b4..6730b2c 100644 --- a/pywxdump/api/__init__.py +++ b/pywxdump/api/__init__.py @@ -5,8 +5,6 @@ # Author: xaoyaoo # Date: 2023/12/14 # ------------------------------------------------------------------------------- - -import logging import os import subprocess import sys @@ -28,7 +26,7 @@ from pywxdump import __version__ app = FastAPI(title="pywxdump", description="微信工具", version=__version__, terms_of_service="https://github.com/xaoyaoo/pywxdump", - contact={"name": "xaoyaoo", "url": "https://github.com/xaoyaoo/pywxdump", "email": ""}, + contact={"name": "xaoyaoo", "url": "https://github.com/xaoyaoo/pywxdump"}, license_info={"name": "MIT License", "url": "https://github.com/xaoyaoo/pywxdump/blob/main/LICENSE"}) # 跨域 @@ -65,9 +63,10 @@ async def index(): app.include_router(rs_api, prefix='/api/rs', tags=['远程api']) app.include_router(ls_api, prefix='/api/ls', tags=['本地api']) -web_path = os.path.join(os.path.dirname(os.path.dirname(__file__)), "ui", "web") # 静态文件挂载 -app.mount("/s", StaticFiles(directory=web_path), name="static") +web_path = os.path.join(os.path.dirname(os.path.dirname(__file__)), "ui", "web") +if os.path.exists(os.path.join(web_path, "index.html")): + app.mount("/s", StaticFiles(directory=web_path), name="static") def start_server(port=5000, online=False, debug=False, isopenBrowser=True): diff --git a/pywxdump/api/local_server.py b/pywxdump/api/local_server.py index 2fdc909..107d1ed 100644 --- a/pywxdump/api/local_server.py +++ b/pywxdump/api/local_server.py @@ -254,7 +254,7 @@ class BiasAddrRequest(BaseModel): @ls_api.post('/biasaddr') @error9999 -def biasaddr(request: BiasAddrRequest): +def get_biasaddr(request: BiasAddrRequest): """ BiasAddr :return: @@ -273,7 +273,7 @@ def biasaddr(request: BiasAddrRequest): @ls_api.api_route('/decrypt', methods=["GET", 'POST']) @error9999 -def decrypt(key: str, wxdbPath: str, outPath: str = ""): +def get_decrypt(key: str, wxdbPath: str, outPath: str = ""): """ 解密 :return: @@ -291,7 +291,7 @@ class MergeRequest(BaseModel): @ls_api.post('/merge') @error9999 -def merge(request: MergeRequest): +def get_merge(request: MergeRequest): """ 合并 :return: