aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornea <nea@nea.moe>2023-09-23 01:50:41 +0200
committernea <nea@nea.moe>2023-09-23 01:50:41 +0200
commitfcdc9bc55031116f0e9f2347ab696e9927e7a7cc (patch)
tree22b0b115133d6398821e8a82dcfc86fce1427277
parentb057746b0ba7d87d9ffe0ce59ead44e11ab6c504 (diff)
downloadlibautoupdate-fcdc9bc55031116f0e9f2347ab696e9927e7a7cc.tar.gz
libautoupdate-fcdc9bc55031116f0e9f2347ab696e9927e7a7cc.tar.bz2
libautoupdate-fcdc9bc55031116f0e9f2347ab696e9927e7a7cc.zip
Add description to github releases
-rw-r--r--src/main/java/moe/nea/libautoupdate/GithubReleaseUpdateData.java31
-rw-r--r--src/main/java/moe/nea/libautoupdate/GithubReleaseUpdateSource.java9
-rw-r--r--src/main/java/moe/nea/libautoupdate/Main.java2
3 files changed, 39 insertions, 3 deletions
diff --git a/src/main/java/moe/nea/libautoupdate/GithubReleaseUpdateData.java b/src/main/java/moe/nea/libautoupdate/GithubReleaseUpdateData.java
new file mode 100644
index 0000000..f1ebf74
--- /dev/null
+++ b/src/main/java/moe/nea/libautoupdate/GithubReleaseUpdateData.java
@@ -0,0 +1,31 @@
+package moe.nea.libautoupdate;
+
+import com.google.gson.JsonElement;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.ToString;
+
+import java.util.Date;
+
+@Data
+@ToString(callSuper = true)
+@EqualsAndHashCode(callSuper = true)
+public class GithubReleaseUpdateData extends UpdateData {
+
+ String releaseDescription;
+ String targetCommittish;
+ Date createdAt;
+ Date publishedAt;
+ String htmlUrl;
+
+ public GithubReleaseUpdateData(String versionName, JsonElement versionNumber, String sha256, String download,
+ String releaseDescription, String targetCommittish,
+ Date createdAt, Date publishedAt, String htmlUrl) {
+ super(versionName, versionNumber, sha256, download);
+ this.releaseDescription = releaseDescription;
+ this.targetCommittish = targetCommittish;
+ this.createdAt = createdAt;
+ this.publishedAt = publishedAt;
+ this.htmlUrl = htmlUrl;
+ }
+}
diff --git a/src/main/java/moe/nea/libautoupdate/GithubReleaseUpdateSource.java b/src/main/java/moe/nea/libautoupdate/GithubReleaseUpdateSource.java
index 38bfd86..9627365 100644
--- a/src/main/java/moe/nea/libautoupdate/GithubReleaseUpdateSource.java
+++ b/src/main/java/moe/nea/libautoupdate/GithubReleaseUpdateSource.java
@@ -64,11 +64,16 @@ public class GithubReleaseUpdateSource extends JsonUpdateSource {
if (release.getAssets() == null) return null;
return release.getAssets().stream()
.filter(it -> (Objects.equals(it.getContentType(), "application/x-java-archive") || (it.getName() != null && it.getName().endsWith(".jar"))) && it.getBrowserDownloadUrl() != null)
- .map(it -> new UpdateData(
+ .map(it -> new GithubReleaseUpdateData(
release.getName() == null ? release.getTagName() : release.getName(),
new JsonPrimitive(release.getTagName()),
null,
- it.getBrowserDownloadUrl()
+ it.getBrowserDownloadUrl(),
+ release.getBody(),
+ release.getTargetCommitish(),
+ release.getCreated_at(),
+ release.getPublishedAt(),
+ release.getHtmlUrl()
))
.findFirst().orElse(null);
}
diff --git a/src/main/java/moe/nea/libautoupdate/Main.java b/src/main/java/moe/nea/libautoupdate/Main.java
index de91b08..dc6c458 100644
--- a/src/main/java/moe/nea/libautoupdate/Main.java
+++ b/src/main/java/moe/nea/libautoupdate/Main.java
@@ -4,7 +4,7 @@ public class Main {
public static void main(String[] args) {
UpdateContext updater = new UpdateContext(
- UpdateSource.mavenSource("https://repo.nea.moe/releases", "moe.nea", "neuhax"),
+ UpdateSource.githubUpdateSource("hannibal002", "SkyHanni"),
UpdateTarget.deleteAndSaveInTheSameFolder(Main.class),
CurrentVersion.ofTag("1.1.0"),
"test"