Skip to content

Commit

Permalink
修复推送格式问题
Browse files Browse the repository at this point in the history
  • Loading branch information
Ghost-chu committed Dec 6, 2024
1 parent 5036d1c commit fe19047
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,18 +51,14 @@ public static PushPlusPushProvider loadFromJson(String name, JsonObject json) {
public static PushPlusPushProvider loadFromYaml(String name, ConfigurationSection section) {
var token = section.getString("token", "");
var topic = section.getString("topic", "");
var template = section.getString("template", "");
var channel = section.getString("channel", "");
if (topic.isBlank()) {
topic = null;
}
if (template.isBlank()) {
template = null;
}
if (channel.isBlank()) {
channel = null;
}
Config config = new Config(token, topic, template, channel);
Config config = new Config(token, topic, channel);
return new PushPlusPushProvider(name, config);

}
Expand All @@ -84,14 +80,12 @@ public boolean push(String title, String content) throws IOException, Interrupte
if (config.getTopic() != null) {
put("topic", config.getTopic());
}
if (config.getTemplate() != null) {
put("template", config.getTemplate());
}
if (config.getChannel() != null) {
put("channel", config.getChannel());
}
put("title", title);
put("content", content);
put("template", "markdown");
}};
HttpResponse<String> resp = HTTPUtil.retryableSend(HTTPUtil.getHttpClient(false, null),
MutableRequest.POST("https://www.pushplus.plus/send"
Expand All @@ -110,7 +104,6 @@ public boolean push(String title, String content) throws IOException, Interrupte
public static class Config {
private String token;
private String topic;
private String template;
private String channel;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public String sendMail(List<String> email, String subject, String text) throws E
}
mail.setSendPartial(config.isSendPartial());
mail.setSubject(subject);
mail.setContent(text, "text/html");
mail.setContent(markdown2Html(text), "text/html");
mail.setFrom(config.getSender(), config.getSenderName(), "UTF-8");
mail.setTo(email.stream().map(str -> {
try {
Expand Down

0 comments on commit fe19047

Please # to comment.