aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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"