use release tag for downloading latest github releases...

This commit is contained in:
Anthony Calosa
2024-10-25 17:24:48 +08:00
parent dcbd25d00e
commit 9897c85559
6 changed files with 55 additions and 4 deletions

View File

@@ -49,4 +49,28 @@ public class RSSReader {
}
return message;
}
public static String getLatestReleaseTag() {
String tag = "";
try {
RssReader reader = new RssReader();
URL url = new URL("https://github.com/Card-Forge/forge/releases.atom");
InputStream inputStream = url.openStream();
List<Item> items = reader.read(inputStream).toList();
for (Item i : items) {
if (i.getLink().isPresent()) {
try {
String val = i.getLink().get();
tag = val.substring(val.lastIndexOf("forge"));
break;
} catch (Exception e) {
e.printStackTrace();
}
}
}
inputStream.close();
} catch (Exception e) {
e.printStackTrace();
}
return tag;
}
}