增强安全性

This commit is contained in:
evilbeast 2022-09-28 10:56:35 +08:00
parent 734eab020e
commit ae450372b1
6 changed files with 26 additions and 5 deletions

View File

@ -1,6 +1,6 @@
<h1 align="center">NtChat</h1>
<p align="center">
<a href="https://github.com/smallevilbeast/ntchat/releases"><img src="https://img.shields.io/badge/release-0.1.13-blue.svg?" alt="release"></a>
<a href="https://github.com/smallevilbeast/ntchat/releases"><img src="https://img.shields.io/badge/release-0.1.15-blue.svg?" alt="release"></a>
<a href="https://opensource.org/licenses/MIT"><img src="https://img.shields.io/badge/License-MIT-brightgreen.svg?" alt="License"></a>
</p>

View File

@ -0,0 +1,18 @@
# -*- coding: utf-8 -*-
import sys
import time
import ntchat
def version_tuple(v):
return tuple(map(int, (v.split("."))))
if version_tuple(ntchat.__version__) < version_tuple('0.1.15'):
print("error: ntchat version required 0.1.15, use `pip install -U ntchat` to upgrade")
sys.exit()
wechat = ntchat.WeChat()
# 打开一个新的微信,并显示二维码界面
wechat.open(smart=False, show_login_qrcode=True)

View File

@ -56,7 +56,7 @@ async def client_create():
response_model=models.ResponseModel)
@catch_exception()
async def client_open(model: models.ClientOpenReqModel):
ret = client_mgr.get_client(model.guid).open(model.smart)
ret = client_mgr.get_client(model.guid).open(model.smart, model.show_login_qrcode)
return response_json(1 if ret else 0)

View File

@ -1,4 +1,4 @@
VERSION = '0.1.13'
VERSION = '0.1.15'
LOG_LEVEL = "DEBUG"
LOG_KEY = 'NTCHAT_LOG'

View File

@ -120,7 +120,10 @@ class WeChat:
log.info("wait login...")
self.__wait_login_event.wait(timeout)
def open(self, smart=False):
def open(self, smart=False, show_login_qrcode=False):
if show_login_qrcode:
wcprobe.show_login_qrcode()
self.pid = wcprobe.open(smart)
log.info("open wechat pid: %d", self.pid)
return self.pid != 0

View File

@ -194,7 +194,7 @@ extension.extra_compile_cpp_args = extra_compile_cpp_args[target_os]
setup(
name='ntchat',
version='0.1.13',
version='0.1.15',
description='About Conversational RPA SDK for Chatbot Makers',
long_description="",
long_description_content_type='text/markdown',