From be93d78d714f6aa5fe0bcd7d1a019f8a502a9538 Mon Sep 17 00:00:00 2001 From: xaoyaoo Date: Thu, 4 Jan 2024 15:42:14 +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 | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/pywxdump/cli.py b/pywxdump/cli.py index 82e359d..ec07b64 100644 --- a/pywxdump/cli.py +++ b/pywxdump/cli.py @@ -221,17 +221,20 @@ 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.") + try: + # 自动打开浏览器 + 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.") + except Exception as e: + pass print("[+] 请使用浏览器访问 http://127.0.0.1:5000/ 查看聊天记录") app.run(host='0.0.0.0', port=5000, debug=False)