修复bug
This commit is contained in:
parent
2a3cb0ee73
commit
83c1c131c9
@ -22,4 +22,4 @@ except:
|
|||||||
VERSION_LIST = {}
|
VERSION_LIST = {}
|
||||||
VERSION_LIST_PATH = None
|
VERSION_LIST_PATH = None
|
||||||
|
|
||||||
__version__ = "2.4.6"
|
__version__ = "2.4.7"
|
||||||
|
@ -11,13 +11,13 @@ import os
|
|||||||
from flask import Flask, request, render_template, g, Blueprint, send_file
|
from flask import Flask, request, render_template, g, Blueprint, send_file
|
||||||
from pywxdump import analyzer, read_img_dat, read_audio
|
from pywxdump import analyzer, read_img_dat, read_audio
|
||||||
from pywxdump.api.rjson import ReJson, RqJson
|
from pywxdump.api.rjson import ReJson, RqJson
|
||||||
|
|
||||||
# app = Flask(__name__, static_folder='../ui/web/dist', static_url_path='/')
|
# app = Flask(__name__, static_folder='../ui/web/dist', static_url_path='/')
|
||||||
|
|
||||||
api = Blueprint('api', __name__, template_folder='templates')
|
api = Blueprint('api', __name__, template_folder='../ui/web')
|
||||||
api.debug = False
|
api.debug = False
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@api.route('/api/init', methods=["GET", 'POST'])
|
@api.route('/api/init', methods=["GET", 'POST'])
|
||||||
def init():
|
def init():
|
||||||
"""
|
"""
|
||||||
@ -182,7 +182,7 @@ def get_audio():
|
|||||||
video_data = f"data:audio/wav;base64,{video_base64}"
|
video_data = f"data:audio/wav;base64,{video_base64}"
|
||||||
return ReJson(0, video_data)
|
return ReJson(0, video_data)
|
||||||
|
|
||||||
|
|
||||||
@api.route('/')
|
@api.route('/')
|
||||||
def index():
|
def index():
|
||||||
return render_template('index.html')
|
return render_template('index.html')
|
||||||
|
|
||||||
|
@ -203,12 +203,29 @@ class MainShowChatRecords():
|
|||||||
print("[-] 输入数据库路径不存在")
|
print("[-] 输入数据库路径不存在")
|
||||||
return
|
return
|
||||||
|
|
||||||
app = Flask(__name__, template_folder='./ui/web', static_folder='./ui/web/assets/', static_url_path='/assets/')
|
|
||||||
app.logger.setLevel(logging.ERROR)
|
|
||||||
|
|
||||||
from flask_cors import CORS
|
from flask_cors import CORS
|
||||||
from pywxdump.api import api
|
from pywxdump.api import api
|
||||||
|
|
||||||
|
# if getattr(sys, 'frozen', False):
|
||||||
|
# # The application is run as a bundled executable (PyInstaller)
|
||||||
|
# base_dir = sys._MEIPASS
|
||||||
|
# else:
|
||||||
|
# # The application is run as a script
|
||||||
|
# base_dir = os.path.abspath(os.path.dirname(__file__))
|
||||||
|
|
||||||
|
# template_folder = os.path.join(base_dir, 'ui/web')
|
||||||
|
# static_folder = os.path.join(base_dir, 'ui/web/assets/')
|
||||||
|
|
||||||
|
app = Flask(__name__, template_folder='./ui/web', static_folder='./ui/web/assets/', static_url_path='/assets/')
|
||||||
|
|
||||||
|
# app.template_folder = template_folder
|
||||||
|
# app.static_folder = static_folder
|
||||||
|
# app.static_url_path = '/assets/'
|
||||||
|
|
||||||
|
app.logger.setLevel(logging.ERROR)
|
||||||
|
|
||||||
CORS(app, resources={r"/*": {"origins": "*"}}, supports_credentials=True) # 允许所有域名跨域
|
CORS(app, resources={r"/*": {"origins": "*"}}, supports_credentials=True) # 允许所有域名跨域
|
||||||
|
|
||||||
@app.before_request
|
@app.before_request
|
||||||
def before_request():
|
def before_request():
|
||||||
g.msg_path = args.msg_path
|
g.msg_path = args.msg_path
|
||||||
@ -235,9 +252,25 @@ class MainShowChatRecords():
|
|||||||
print("Unsupported platform, can't open browser automatically.")
|
print("Unsupported platform, can't open browser automatically.")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
pass
|
pass
|
||||||
|
import socket
|
||||||
|
def is_port_in_use(host, port):
|
||||||
|
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
|
||||||
|
try:
|
||||||
|
s.bind((host, port))
|
||||||
|
except socket.error:
|
||||||
|
return True
|
||||||
|
return False
|
||||||
|
|
||||||
print("[+] 请使用浏览器访问 http://127.0.0.1:5000/ 查看聊天记录")
|
# 检查端口是否被占用
|
||||||
app.run(host='0.0.0.0', port=5000, debug=False)
|
host = '0.0.0.0'
|
||||||
|
port = 5000
|
||||||
|
if is_port_in_use(host, port):
|
||||||
|
print(f"Port {port} is already in use. Choose a different port.")
|
||||||
|
input("Press Enter to exit...")
|
||||||
|
else:
|
||||||
|
time.sleep(1)
|
||||||
|
print("[+] 请使用浏览器访问 http://127.0.0.1:5000/ 查看聊天记录")
|
||||||
|
app.run(host=host, port=port, debug=False)
|
||||||
|
|
||||||
|
|
||||||
class MainExportChatRecords():
|
class MainExportChatRecords():
|
||||||
@ -368,9 +401,10 @@ class MainAll():
|
|||||||
print(
|
print(
|
||||||
f'[+] success "{os.path.relpath(ret1[0], os.path.commonprefix(wxdbpaths))}" -> "{os.path.relpath(ret1[1], os.getcwd())}"')
|
f'[+] success "{os.path.relpath(ret1[0], os.path.commonprefix(wxdbpaths))}" -> "{os.path.relpath(ret1[1], os.getcwd())}"')
|
||||||
out_dbs.append(ret1[1])
|
out_dbs.append(ret1[1])
|
||||||
print("-" * 32)
|
if len(errors) > 0:
|
||||||
print(
|
print("-" * 32)
|
||||||
"[-] " + f"警告:共 {len(errors)} 个文件未解密(可能原因:非当前登录用户数据库;非加密数据库),详见{out_path}下‘未解密.txt’;")
|
print(
|
||||||
|
"[-] " + f"警告:共 {len(errors)} 个文件未解密(可能原因:非当前登录用户数据库;非加密数据库),详见{out_path}下‘未解密.txt’;")
|
||||||
# print("; ".join([f'"{wxdbpaths[i]}"' for i in errors]))
|
# print("; ".join([f'"{wxdbpaths[i]}"' for i in errors]))
|
||||||
with open(os.path.join(out_path, "未解密.txt"), "w", encoding="utf-8") as f:
|
with open(os.path.join(out_path, "未解密.txt"), "w", encoding="utf-8") as f:
|
||||||
f.write("\n".join([f'{i}' for i in errors]))
|
f.write("\n".join([f'{i}' for i in errors]))
|
||||||
|
Loading…
Reference in New Issue
Block a user