From 344dc7bdfa037cfe6522ea14124b52d585888aba Mon Sep 17 00:00:00 2001 From: Ghost_chu Date: Mon, 2 Dec 2024 19:45:48 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8D=87=E7=BA=A7=E6=97=B6=EF=BC=8C=E5=88=A0?= =?UTF-8?q?=E9=99=A4=E6=9C=AA=E4=BD=BF=E7=94=A8=E7=9A=84=E6=8E=A8=E9=80=81?= =?UTF-8?q?=E6=B8=A0=E9=81=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../config/MainConfigUpdateScript.java | 25 +++++++++++-------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/src/main/java/com/ghostchu/peerbanhelper/config/MainConfigUpdateScript.java b/src/main/java/com/ghostchu/peerbanhelper/config/MainConfigUpdateScript.java index 2846ce1d9..4dd595c74 100644 --- a/src/main/java/com/ghostchu/peerbanhelper/config/MainConfigUpdateScript.java +++ b/src/main/java/com/ghostchu/peerbanhelper/config/MainConfigUpdateScript.java @@ -37,18 +37,23 @@ public void pushProvidersSMTPStructUpgrade() { for (String key : pushNotification.getKeys(false)) { var single = pushNotification.getConfigurationSection(key); if (single == null) continue; - var type = single.getString("type"); - if ("smtp".equals(type)) { - single.set("auth", true); - if(single.getBoolean("ssl")) { - single.set("encryption", "STARTTLS"); - }else{ - single.set("encryption", "NONE"); + if(single.getBoolean("enabled", false)){ + pushNotification.set(key, null); // 删除未启用的推送渠道 + }else { + var type = single.getString("type"); + if ("smtp".equals(type)) { + single.set("auth", true); + if (single.getBoolean("ssl")) { + single.set("encryption", "STARTTLS"); + } else { + single.set("encryption", "NONE"); + } + single.set("ssl", null); + single.set("sendPartial", true); } - single.set("ssl", null); - single.set("sendPartial", true); + pushNotification.set(key, single); } - pushNotification.set(key, single); + conf.set("push-notification", pushNotification); } }