Skip to content

Commit

Permalink
fix dbshow #124
Browse files Browse the repository at this point in the history
  • Loading branch information
xaoyaoo committed Aug 18, 2024
1 parent 461e922 commit c4ec638
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
2 changes: 1 addition & 1 deletion pywxdump/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# Author: xaoyaoo
# Date: 2023/10/14
# -------------------------------------------------------------------------------
__version__ = "3.1.25"
__version__ = "3.1.26"

import os, json

Expand Down
15 changes: 13 additions & 2 deletions pywxdump/api/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ def gen_fastapi_app():
app = FastAPI(title="pywxdump", description="微信工具", version=__version__,
terms_of_service="https://github.com/xaoyaoo/pywxdump",
contact={"name": "xaoyaoo", "url": "https://github.com/xaoyaoo/pywxdump"},
license_info={"name": "MIT License", "url": "https://github.com/xaoyaoo/PyWxDump/blob/master/LICENSE"})
license_info={"name": "MIT License",
"url": "https://github.com/xaoyaoo/PyWxDump/blob/master/LICENSE"})

# 跨域
origins = [
Expand Down Expand Up @@ -70,7 +71,8 @@ async def index():
return app


def start_server(port=5000, online=False, debug=False, isopenBrowser=True):
def start_server(port=5000, online=False, debug=False, isopenBrowser=True,
merge_path="", wx_path="", my_wxid="", ):
"""
启动flask
:param port: 端口号
Expand Down Expand Up @@ -98,6 +100,15 @@ def start_server(port=5000, online=False, debug=False, isopenBrowser=True):
f.write(f"PYWXDUMP_CONF_FILE = '{conf_file}'\n")
f.write(f"PYWXDUMP_AUTO_SETTING = '{auto_setting}'\n")

if merge_path and os.path.exists(merge_path):
my_wxid = my_wxid if my_wxid else "wxid_dbshow"
gc.set_conf(my_wxid, "wxid", my_wxid) # 初始化wxid
gc.set_conf(my_wxid, "merge_path", merge_path) # 初始化merge_path
gc.set_conf(my_wxid, "wx_path", wx_path) # 初始化wx_path
db_config = {"key": my_wxid, "type": "sqlite", "path": merge_path}
gc.set_conf(my_wxid, "db_config", db_config) # 初始化db_config
gc.set_conf(auto_setting, "last", my_wxid) # 初始化last

# 检查端口是否被占用
if online:
host = '0.0.0.0'
Expand Down
2 changes: 1 addition & 1 deletion pywxdump/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ def run(self, args):
print("[-] 输入数据库路径不存在")
return

start_server(merge_path=merge_path, wx_path=args.wx_path, key="", my_wxid=args.my_wxid, online=online)
start_server(merge_path=merge_path, wx_path=args.wx_path, my_wxid=args.my_wxid, online=online)


class MainExportChatRecords(BaseSubMainClass):
Expand Down

0 comments on commit c4ec638

Please sign in to comment.