1
0
Fork 0
mirror of https://github.com/Corewala/Buran synced 2024-12-22 07:42:43 +00:00

Update checking function

This commit is contained in:
Corewala 2022-03-07 15:51:07 -05:00
parent 4cd0e1977b
commit 48c7339d57

View file

@ -0,0 +1,28 @@
package corewala.buran.io.update
import java.net.URL
import java.net.HttpURLConnection
class BuranUpdates {
fun getLatestVersion(): String {
var latestVersion = ""
val updateCheckThread = Thread {
val url = "https://github.com/Corewala/Buran/releases/latest"
val con = URL(url).openConnection() as HttpURLConnection
con.connect()
con.getInputStream()
latestVersion = con.getURL().toString().drop(47)
}
updateCheckThread.start()
updateCheckThread.join()
println("Latest version: $latestVersion")
return latestVersion
}
}