From 7c1a076b4de8f94fc4fd2159e7ca155393644c7a Mon Sep 17 00:00:00 2001 From: xaoyaoo Date: Thu, 4 Jan 2024 15:34:55 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E9=BB=98=E8=AE=A4=E6=89=A7?= =?UTF-8?q?=E8=A1=8Call=E5=91=BD=E4=BB=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pywxdump/cli.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/pywxdump/cli.py b/pywxdump/cli.py index 4223710..82e359d 100644 --- a/pywxdump/cli.py +++ b/pywxdump/cli.py @@ -7,6 +7,7 @@ # ------------------------------------------------------------------------------- import argparse import os +import subprocess import sys import time @@ -220,6 +221,18 @@ class MainShowChatRecords(): app.register_blueprint(api) + # 自动打开浏览器 + url = "http://127.0.0.1:5000/" + # 根据操作系统使用不同的命令打开默认浏览器 + if sys.platform.startswith('darwin'): # macOS + subprocess.call(['open', url]) + elif sys.platform.startswith('win'): # Windows + subprocess.call(['start', url], shell=True) + elif sys.platform.startswith('linux'): # Linux + subprocess.call(['xdg-open', url]) + else: + print("Unsupported platform, can't open browser automatically.") + print("[+] 请使用浏览器访问 http://127.0.0.1:5000/ 查看聊天记录") app.run(host='0.0.0.0', port=5000, debug=False) @@ -450,7 +463,7 @@ def console_run(): # 检查是否需要显示帮助信息 if len(sys.argv) == 1: - sys.argv.append('-h') + sys.argv.append('-all') elif len(sys.argv) == 2 and sys.argv[1] in modes.keys() and sys.argv[1] not in [main_all.mode, main_wx_info.mode, main_wx_db_path.mode]: sys.argv.append('-h')