chore(python): bump to v39.4.1.0

This commit is contained in:
Changhua 2025-03-08 11:57:08 +08:00
parent d24e613789
commit 225f2e44ea
2 changed files with 12 additions and 18 deletions

View File

@ -44,8 +44,8 @@ python -m grpc_tools.protoc --python_out=. --proto_path=../../../WeChatFerry/rpc
## 版本更新 ## 版本更新
### v39.3.3.1 ### v39.4.1.0
* 修复 `send_xml` * 修复乱码问题
<details><summary>点击查看更多</summary> <details><summary>点击查看更多</summary>
@ -70,7 +70,6 @@ python -m grpc_tools.protoc --python_out=. --proto_path=../../../WeChatFerry/rpc
* 发送图片消息 * 发送图片消息
* 发送文件消息 * 发送文件消息
* 发送卡片消息 * 发送卡片消息
* 发送 XML 消息
* 发送 GIF 消息 * 发送 GIF 消息
* 拍一拍群友 * 拍一拍群友
* 转发消息 * 转发消息

View File

@ -1,7 +1,7 @@
#! /usr/bin/env python3 #! /usr/bin/env python3
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
__version__ = "39.4.0.0" __version__ = "39.4.1.0"
import atexit import atexit
import base64 import base64
@ -10,14 +10,12 @@ import logging
import mimetypes import mimetypes
import os import os
import re import re
import subprocess
import sys import sys
from queue import Queue from queue import Queue
from threading import Thread from threading import Thread
import shutil
from time import sleep from time import sleep
from typing import Callable, Dict, List, Optional from typing import Callable, Dict, List, Optional
from pathlib import Path
import importlib.resources as pkg_resources # Python 3.9+
import pynng import pynng
import requests import requests
@ -73,6 +71,7 @@ class Wcf():
self._dl_path = f"{self._wcf_root}/.dl" self._dl_path = f"{self._wcf_root}/.dl"
os.makedirs(self._dl_path, exist_ok=True) os.makedirs(self._dl_path, exist_ok=True)
self.LOG = logging.getLogger("WCF") self.LOG = logging.getLogger("WCF")
self._set_console_utf8()
self.LOG.info(f"wcferry version: {__version__}") self.LOG.info(f"wcferry version: {__version__}")
self.port = port self.port = port
self.host = host self.host = host
@ -80,7 +79,6 @@ class Wcf():
if host is None: if host is None:
self._local_mode = True self._local_mode = True
self.host = "127.0.0.1" self.host = "127.0.0.1"
self._copy_disclaimer_to_cwd()
self.sdk = ctypes.cdll.LoadLibrary(f"{self._wcf_root}/sdk.dll") self.sdk = ctypes.cdll.LoadLibrary(f"{self._wcf_root}/sdk.dll")
if self.sdk.WxInitSDK(debug, port) != 0: if self.sdk.WxInitSDK(debug, port) != 0:
self.LOG.error("初始化失败!") self.LOG.error("初始化失败!")
@ -119,16 +117,12 @@ class Wcf():
def __del__(self) -> None: def __del__(self) -> None:
self.cleanup() self.cleanup()
def _copy_disclaimer_to_cwd(self): def _set_console_utf8(self):
"""复制免责声明到工作目录"""
try: try:
target_path = Path.cwd() / "DISCLAIMER.md" subprocess.run("chcp 65001", shell=True, check=True,
with pkg_resources.path("wcferry", "DISCLAIMER.md") as disclaimer_path: stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
if not target_path.exists(): except subprocess.CalledProcessError as e:
shutil.copy(disclaimer_path, target_path) self.LOG.error(f"修改控制台代码页失败: {e}")
except Exception as e:
self.LOG.error(f"复制免责声明失败:{e}")
os._exit(-3)
def cleanup(self) -> None: def cleanup(self) -> None:
"""关闭连接,回收资源""" """关闭连接,回收资源"""
@ -167,7 +161,6 @@ class Wcf():
def get_qrcode(self) -> str: def get_qrcode(self) -> str:
"""获取登录二维码,已经登录则返回空字符串""" """获取登录二维码,已经登录则返回空字符串"""
raise Exception("Not implemented, yet")
req = wcf_pb2.Request() req = wcf_pb2.Request()
req.func = wcf_pb2.FUNC_REFRESH_QRCODE # FUNC_REFRESH_QRCODE req.func = wcf_pb2.FUNC_REFRESH_QRCODE # FUNC_REFRESH_QRCODE
rsp = self._send_request(req) rsp = self._send_request(req)
@ -415,6 +408,7 @@ class Wcf():
Returns: Returns:
int: 0 为成功其他失败 int: 0 为成功其他失败
""" """
raise Exception("Not implemented, yet")
req = wcf_pb2.Request() req = wcf_pb2.Request()
req.func = wcf_pb2.FUNC_SEND_XML # FUNC_SEND_XML req.func = wcf_pb2.FUNC_SEND_XML # FUNC_SEND_XML
req.xml.receiver = receiver req.xml.receiver = receiver
@ -780,6 +774,7 @@ class Wcf():
Returns: Returns:
int: 1 为成功其他失败 int: 1 为成功其他失败
""" """
raise Exception("Not implemented, yet")
req = wcf_pb2.Request() req = wcf_pb2.Request()
req.func = wcf_pb2.FUNC_REVOKE_MSG # FUNC_REVOKE_MSG req.func = wcf_pb2.FUNC_REVOKE_MSG # FUNC_REVOKE_MSG
req.ui64 = id req.ui64 = id