Skip to content

Commit

Permalink
升级时,删除未使用的推送渠道
Browse files Browse the repository at this point in the history
  • Loading branch information
Ghost-chu committed Dec 2, 2024
1 parent 2e5f7b7 commit 344dc7b
Showing 1 changed file with 15 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Expand Down

0 comments on commit 344dc7b

Please sign in to comment.