fix webpush
This commit is contained in:
parent
0a9a391eb3
commit
bc689074e0
@ -46,9 +46,9 @@ class WebPushModule(_ModuleBase):
|
|||||||
else:
|
else:
|
||||||
caption = message.text
|
caption = message.text
|
||||||
content = ""
|
content = ""
|
||||||
try:
|
for sub in global_vars.get_subscriptions():
|
||||||
for sub in global_vars.get_subscriptions():
|
logger.debug(f"给 {sub} 发送WebPush:{caption} {content}")
|
||||||
logger.debug(f"给 {sub} 发送WebPush:{caption} {content}")
|
try:
|
||||||
webpush(
|
webpush(
|
||||||
subscription_info=sub,
|
subscription_info=sub,
|
||||||
data=json.dumps({
|
data=json.dumps({
|
||||||
@ -60,8 +60,8 @@ class WebPushModule(_ModuleBase):
|
|||||||
"sub": settings.VAPID.get("subject")
|
"sub": settings.VAPID.get("subject")
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
except WebPushException as err:
|
except WebPushException as err:
|
||||||
print("WebPush Error:", str(err))
|
print("WebPush Error:", str(err))
|
||||||
|
|
||||||
except Exception as msg_e:
|
except Exception as msg_e:
|
||||||
logger.error(f"发送消息失败:{msg_e}")
|
logger.error(f"发送消息失败:{msg_e}")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user