♻️ 重构对通知变量 bool 值的处理
Some checks failed
Docker Publish / build-and-push (push) Has been cancelled

This commit is contained in:
Cp0204 2024-11-29 17:17:29 +08:00
parent 7229388cdd
commit 16866a00b9
3 changed files with 8 additions and 18 deletions

View File

@ -414,20 +414,6 @@
} }
}, },
watch: { watch: {
'formData.push_config': {
handler: function (newVal, oldVal) {
for (key in newVal) {
if (typeof newVal[key] === 'string') {
if (newVal[key].toLowerCase() === 'false') {
this.$set(this.formData.push_config, key, false);
} else if (newVal[key].toLowerCase() === 'true') {
this.$set(this.formData.push_config, key, true);
}
}
}
},
deep: true
}
}, },
mounted() { mounted() {
this.fetchData(); this.fetchData();

View File

@ -181,7 +181,8 @@ def console(title: str, content: str) -> None:
""" """
使用 控制台 推送消息 使用 控制台 推送消息
""" """
print(f"{title}\n\n{content}") if str(push_config.get("CONSOLE")).lower() != "false":
print(f"{title}\n\n{content}")
def dingding_bot(title: str, content: str) -> None: def dingding_bot(title: str, content: str) -> None:

View File

@ -59,8 +59,8 @@ def send_ql_notify(title, body):
# 如未配置 push_config 则使用青龙环境通知设置 # 如未配置 push_config 则使用青龙环境通知设置
if CONFIG_DATA.get("push_config"): if CONFIG_DATA.get("push_config"):
CONFIG_DATA["push_config"]["CONSOLE"] = True notify.push_config = CONFIG_DATA["push_config"].copy()
notify.push_config = CONFIG_DATA["push_config"] notify.push_config["CONSOLE"] = notify.push_config.get("CONSOLE", True)
notify.send(title, body) notify.send(title, body)
except Exception as e: except Exception as e:
if e: if e:
@ -796,7 +796,10 @@ def do_sign(account):
sign_message = f"📅 执行签到: 今日签到+{int(sign_return/1024/1024)}MB连签进度({growth_info['cap_sign']['sign_progress']+1}/{growth_info['cap_sign']['sign_target']})✅" sign_message = f"📅 执行签到: 今日签到+{int(sign_return/1024/1024)}MB连签进度({growth_info['cap_sign']['sign_progress']+1}/{growth_info['cap_sign']['sign_target']})✅"
message = f"{sign_message}\n{growth_message}" message = f"{sign_message}\n{growth_message}"
if ( if (
CONFIG_DATA.get("push_config", {}).get("QUARK_SIGN_NOTIFY") == False str(
CONFIG_DATA.get("push_config", {}).get("QUARK_SIGN_NOTIFY")
).lower()
== "false"
or os.environ.get("QUARK_SIGN_NOTIFY") == "false" or os.environ.get("QUARK_SIGN_NOTIFY") == "false"
): ):
print(message) print(message)