mirror of
https://github.com/smallevilbeast/ntchat.git
synced 2025-07-07 12:36:07 +08:00
增强安全性
This commit is contained in:
parent
734eab020e
commit
ae450372b1
|
@ -1,6 +1,6 @@
|
||||||
<h1 align="center">NtChat</h1>
|
<h1 align="center">NtChat</h1>
|
||||||
<p align="center">
|
<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>
|
<a href="https://opensource.org/licenses/MIT"><img src="https://img.shields.io/badge/License-MIT-brightgreen.svg?" alt="License"></a>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
|
18
examples/show_login_qrcode.py
Normal file
18
examples/show_login_qrcode.py
Normal 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)
|
|
@ -56,7 +56,7 @@ async def client_create():
|
||||||
response_model=models.ResponseModel)
|
response_model=models.ResponseModel)
|
||||||
@catch_exception()
|
@catch_exception()
|
||||||
async def client_open(model: models.ClientOpenReqModel):
|
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)
|
return response_json(1 if ret else 0)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
VERSION = '0.1.13'
|
VERSION = '0.1.15'
|
||||||
|
|
||||||
LOG_LEVEL = "DEBUG"
|
LOG_LEVEL = "DEBUG"
|
||||||
LOG_KEY = 'NTCHAT_LOG'
|
LOG_KEY = 'NTCHAT_LOG'
|
||||||
|
|
|
@ -120,7 +120,10 @@ class WeChat:
|
||||||
log.info("wait login...")
|
log.info("wait login...")
|
||||||
self.__wait_login_event.wait(timeout)
|
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)
|
self.pid = wcprobe.open(smart)
|
||||||
log.info("open wechat pid: %d", self.pid)
|
log.info("open wechat pid: %d", self.pid)
|
||||||
return self.pid != 0
|
return self.pid != 0
|
||||||
|
|
2
setup.py
2
setup.py
|
@ -194,7 +194,7 @@ extension.extra_compile_cpp_args = extra_compile_cpp_args[target_os]
|
||||||
|
|
||||||
setup(
|
setup(
|
||||||
name='ntchat',
|
name='ntchat',
|
||||||
version='0.1.13',
|
version='0.1.15',
|
||||||
description='About Conversational RPA SDK for Chatbot Makers',
|
description='About Conversational RPA SDK for Chatbot Makers',
|
||||||
long_description="",
|
long_description="",
|
||||||
long_description_content_type='text/markdown',
|
long_description_content_type='text/markdown',
|
||||||
|
|
Loading…
Reference in New Issue
Block a user