From 16866a00b951c0310066eae61473c7c314fc98e5 Mon Sep 17 00:00:00 2001 From: Cp0204 Date: Fri, 29 Nov 2024 17:17:29 +0800 Subject: [PATCH] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20=E9=87=8D=E6=9E=84?= =?UTF-8?q?=E5=AF=B9=E9=80=9A=E7=9F=A5=E5=8F=98=E9=87=8F=20bool=20?= =?UTF-8?q?=E5=80=BC=E7=9A=84=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/templates/index.html | 14 -------------- notify.py | 3 ++- quark_auto_save.py | 9 ++++++--- 3 files changed, 8 insertions(+), 18 deletions(-) diff --git a/app/templates/index.html b/app/templates/index.html index 8676eaa..beb4318 100644 --- a/app/templates/index.html +++ b/app/templates/index.html @@ -414,20 +414,6 @@ } }, 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() { this.fetchData(); diff --git a/notify.py b/notify.py index 921b5a3..be1f824 100644 --- a/notify.py +++ b/notify.py @@ -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: diff --git a/quark_auto_save.py b/quark_auto_save.py index 9358d38..74bc151 100644 --- a/quark_auto_save.py +++ b/quark_auto_save.py @@ -59,8 +59,8 @@ def send_ql_notify(title, body): # 如未配置 push_config 则使用青龙环境通知设置 if CONFIG_DATA.get("push_config"): - CONFIG_DATA["push_config"]["CONSOLE"] = True - notify.push_config = CONFIG_DATA["push_config"] + notify.push_config = CONFIG_DATA["push_config"].copy() + notify.push_config["CONSOLE"] = notify.push_config.get("CONSOLE", True) notify.send(title, body) except Exception as 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']})✅" message = f"{sign_message}\n{growth_message}" 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" ): print(message)