mirror of
https://github.com/whyour/qinglong.git
synced 2025-05-23 14:56:07 +08:00
改进自定义通知方法
This commit is contained in:
parent
74f36b3978
commit
75ebbab854
|
@ -113,14 +113,11 @@ push_config = {
|
|||
'WEBHOOK_METHOD': '', # 自定义通知 请求方法
|
||||
'WEBHOOK_CONTENT_TYPE': '' # 自定义通知 content-type
|
||||
}
|
||||
|
||||
push_config_keys = tuple(push_config.keys()) # 保存push_config的键
|
||||
|
||||
notify_function = []
|
||||
# fmt: on
|
||||
|
||||
# 首先读取 面板变量 或者 github action 运行变量
|
||||
for k in push_config_keys:
|
||||
for k in push_config:
|
||||
if os.getenv(k):
|
||||
v = os.getenv(k)
|
||||
push_config[k] = v
|
||||
|
@ -903,14 +900,12 @@ def add_notify_function():
|
|||
|
||||
|
||||
def send(title: str, content: str, ignore_default_config: bool = False, **kwargs):
|
||||
if ignore_default_config and kwargs:
|
||||
global push_config
|
||||
push_config = {} # 清空从环境变量获取的配置
|
||||
|
||||
if kwargs:
|
||||
for k in kwargs:
|
||||
if k in push_config_keys:
|
||||
push_config[k] = kwargs.get(k)
|
||||
global push_config
|
||||
if ignore_default_config:
|
||||
push_config = kwargs # 清空从环境变量获取的配置
|
||||
else:
|
||||
push_config.update(kwargs)
|
||||
|
||||
if not content:
|
||||
print(f"{title} 推送内容为空!")
|
||||
|
|
Loading…
Reference in New Issue
Block a user