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

Class VersionInfo

src/main/java/top/misec/utils/VersionInfo.java:14–46  ·  view source on GitHub ↗

version info. @author Junzhou Liu @since 2020/11/21 15:22

Source from the content-addressed store, hash-verified

12 * @since 2020/11/21 15:22
13 */
14@Slf4j
15@Data
16public class VersionInfo {
17 private static String releaseVersion = "";
18 private static String releaseDate = "";
19 private static String projectRepo = "https://github.com/Oreomeow/bili";
20 private static String releaseInfo = "";
21
22 public static void initInfo() {
23 String release = ReadFileUtils.loadJsonFromAsset("release.json");
24 JsonObject jsonObject = new Gson().fromJson(release, JsonObject.class);
25 releaseVersion = jsonObject.get("tag_main").getAsString();
26 releaseDate = jsonObject.get("release_date").getAsString();
27 releaseInfo = ReadFileUtils.loadJsonFromAsset("release.info");
28 }
29
30 public static void printVersionInfo() {
31 initInfo();
32 JsonObject jsonObject = HttpUtils.doGet("https://api.github.com/repos/Oreomeow/bili/releases/latest");
33 log.info("-----版本信息-----");
34 log.info("当前版本: {}", releaseVersion);
35 try {
36 log.info("最新版本为: {}", jsonObject.get("tag_name").getAsString().replaceAll("v", ""));
37 log.info("-----最新版本更新内容-----\n{}", jsonObject.get("body").getAsString().replaceAll("\"", ""));
38 log.info("最近更新时间: {}", HelpUtil.utcTime(jsonObject.get("created_at").getAsString()));
39 log.info("项目备份地址: {}", projectRepo);
40 log.info("-----版本信息-----\n");
41 } catch (Exception e) {
42 log.warn("网络问题,未请求到新版本", e);
43 }
44
45 }
46}

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…