代码拉取完成,页面将自动刷新
同步操作将从 5fa0/mac-wechat 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
import os
import shutil
from app.config import wechat_root, source_dbs_path, decrypt_dbs_path, key, message_temp_path
from app.db.encrypt_db import EncryptDb
from app.utils import check_path
def copy_db_files():
# 复制源文件,避免对源文件操作
dirs = ['Message', 'Group', 'Contact', 'Group', 'Session']
if not os.path.exists(source_dbs_path):
print("正在拷贝数据库文件(避免对源文件操作),请稍等...")
check_path(source_dbs_path)
for d in dirs:
for f in os.listdir(os.path.join(wechat_root, d)):
if 'backup' in f or not 'db' in f: continue
shutil.copyfile(os.path.join(wechat_root, d, f), os.path.join(source_dbs_path, f))
def decrypt_db_file():
# 解密db 文件
if not os.path.exists(decrypt_dbs_path):
print("正在解密数据库文件,请稍等...")
check_path(decrypt_dbs_path)
for file in os.listdir(source_dbs_path):
if ".db" == file[-3:]:
encrypt_db = EncryptDb(source_dbs_path, file, decrypt_dbs_path, key)
encrypt_db.decrypt_db()
def main():
shutil.rmtree("static/wxdata")
# 拷贝数据库文件
copy_db_files()
# 解密
decrypt_db_file()
if not os.path.exists(message_temp_path):
print("正在拷贝静态文件,该过程需等待数分钟,请稍等...")
shutil.copytree(wechat_root + "Message/MessageTemp", message_temp_path)
main()
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。