MCPcopy Create free account
hub / github.com/OreosLab/bili / PushPlusPush

Class PushPlusPush

src/main/java/top/misec/push/impl/PushPlusPush.java:17–61  ·  view source on GitHub ↗

Push Plus 推送. @author itning @since 2021/3/28 15:49

Source from the content-addressed store, hash-verified

15 * @since 2021/3/28 15:49
16 */
17public class PushPlusPush extends AbstractPush {
18
19 /**
20 * Push ++ 默认TOKEN长度.
21 */
22 public static final int PUSH_PLUS_CHANNEL_TOKEN_DEFAULT_LENGTH = 32;
23
24 @Override
25 protected String generatePushUrl(PushMetaInfo metaInfo) {
26 return ApiList.PUSH_PLUS;
27 }
28
29 @Override
30 protected boolean checkPushStatus(JsonObject jsonObject) {
31 if (null == jsonObject) {
32 return false;
33 }
34 // See https://www.pushplus.plus/doc/guide/api.htm
35 JsonElement code = jsonObject.get("code");
36
37 if (code == null) {
38 return false;
39 }
40
41 return code.getAsInt() == 200;
42 }
43
44 @Override
45 protected String generatePushBody(PushMetaInfo metaInfo, String content) {
46 return new Gson().toJson(new PushModel(metaInfo.getToken(), content));
47 }
48
49 @Getter
50 static class PushModel {
51 private final String title = "BILIBILI-HELPER任务简报";
52 private final String template = "txt";
53 private final String token;
54 private final String content;
55
56 public PushModel(String token, String content) {
57 this.token = token;
58 this.content = content;
59 }
60 }
61}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…