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>
|
||||
<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>
|
||||
|
||||
|
|
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)
|
||||
@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)
|
||||
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
VERSION = '0.1.13'
|
||||
VERSION = '0.1.15'
|
||||
|
||||
LOG_LEVEL = "DEBUG"
|
||||
LOG_KEY = 'NTCHAT_LOG'
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue
Block a user