mirror of
https://github.com/rachelos/we-mp-rss.git
synced 2026-09-01 15:33:05 +08:00
1.4.8-修复过期消息二维码不显示
This commit is contained in:
@@ -198,3 +198,4 @@ The following are the environment variable configurations supported in `config.y
|
||||
| `LOG_LEVEL` | `INFO` | Log level |
|
||||
| `EXPORT_PDF` | `False` | Whether to enable PDF export functionality |
|
||||
|
||||
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
|
||||
import os
|
||||
from core.config import cfg
|
||||
print(bool(cfg.get("server.auth_web", False)) )
|
||||
print(f"认证方式:Web认证={bool(cfg.get('server.auth_web', False))}")
|
||||
if bool(cfg.get("server.auth_web", False)) == True:
|
||||
from driver.wx import WX_API
|
||||
from driver.wx import Wx as WX_InterFace
|
||||
|
||||
+11
-1
@@ -27,7 +27,16 @@ def setLoginInfo(info):
|
||||
global WX_LOGIN_INFO
|
||||
with login_lock:
|
||||
WX_LOGIN_INFO=info
|
||||
|
||||
def Success_Msg(data:dict,ext_data:dict={}):
|
||||
from jobs.notice import sys_notice
|
||||
from core.config import cfg
|
||||
text="# 授权成功\n"
|
||||
text+=f"- 服务名:{cfg.get('server.name','')}\n"
|
||||
text+=f"- 名称:{ext_data['wx_app_name']}\n"
|
||||
text+=f"- Token: {data['token']}\n"
|
||||
text+=f"- 有效时间: {data['expiry']['expiry_time']}\n"
|
||||
|
||||
sys_notice(text, str(cfg.get("server.code_title","WeRss授权完成")))
|
||||
def Success(data:dict,ext_data:dict={}):
|
||||
if data != None:
|
||||
# print("\n登录结果:")
|
||||
@@ -35,6 +44,7 @@ def Success(data:dict,ext_data:dict={}):
|
||||
if ext_data is not {}:
|
||||
print_success(f"名称:{ext_data['wx_app_name']}")
|
||||
if data['expiry'] !=None:
|
||||
Success_Msg(data,ext_data)
|
||||
print_success(f"有效时间: {data['expiry']['expiry_time']} (剩余秒数: {data['expiry']['remaining_seconds']}) Token: {data['token']}")
|
||||
set_token(data,ext_data)
|
||||
setStatus(True)
|
||||
|
||||
+7
-1
@@ -1,14 +1,19 @@
|
||||
from core.print import print_warning
|
||||
from driver.base import WX_API
|
||||
from core.config import cfg
|
||||
from jobs.notice import sys_notice
|
||||
from driver.success import Success
|
||||
from tools.base64_tools import image_to_base64
|
||||
import time
|
||||
|
||||
def send_wx_code(title:str="",url:str=""):
|
||||
if cfg.get("server.send_code",False):
|
||||
WX_API.GetCode(Notice=CallBackNotice,CallBack=Success)
|
||||
pass
|
||||
def CallBackNotice(data=None,ext_data=None):
|
||||
if data is not None:
|
||||
print_warning(data)
|
||||
return
|
||||
img_path=WX_API.QRcode()['code']
|
||||
rss_domain=str(cfg.get("rss.base_url",""))
|
||||
url=rss_domain+str(img_path)
|
||||
@@ -16,6 +21,7 @@ def CallBackNotice(data=None,ext_data=None):
|
||||
text=f"- 服务名:{cfg.get('server.name','')}\n"
|
||||
text+=f"- 发送时间: {time.strftime('%Y-%m-%d %H:%M:%S',time.localtime(time.time()))}"
|
||||
if WX_API.GetHasCode():
|
||||
text+=f"<img src='{url}' width='100' height='100'/>"
|
||||
text+=f""
|
||||
# text+=f"<img src='{url}' width='100' height='100'/>"
|
||||
text+=f"\n- 请使用微信扫描二维码进行授权"
|
||||
sys_notice(text, str(cfg.get("server.code_title","WeRss授权过期,扫码授权")))
|
||||
+3
-6
@@ -164,12 +164,9 @@ if __name__=="__main__":
|
||||
# testMd2Doc()
|
||||
# testLogin()
|
||||
|
||||
testJob()
|
||||
# test_send_wx_code()
|
||||
# testJob()
|
||||
test_send_wx_code()
|
||||
# testCheckAuth()
|
||||
# testToken() # 注释掉避免线程冲突
|
||||
# testMarkDown()
|
||||
while True:
|
||||
cmd=input("输入exit退出")
|
||||
if cmd.strip().lower()=="exit":
|
||||
break
|
||||
cmd=input("输入exit退出")
|
||||
|
||||
Reference in New Issue
Block a user