finalize Update checker
This commit is contained in:
parent
19d7017336
commit
aad5365d19
|
@ -96,6 +96,7 @@ gradle-app.setting
|
||||||
|
|
||||||
### MatterLink ###
|
### MatterLink ###
|
||||||
|
|
||||||
|
classes/
|
||||||
run/
|
run/
|
||||||
*.tmp
|
*.tmp
|
||||||
**/gen/
|
**/gen/
|
||||||
|
|
|
@ -22,16 +22,14 @@ class UpdateChecker : Runnable {
|
||||||
|
|
||||||
instance.info("Checking for new versions...")
|
instance.info("Checking for new versions...")
|
||||||
|
|
||||||
val apiUpdateList: List<CurseFile>
|
|
||||||
|
|
||||||
val client: HttpClient = HttpClients.createDefault()
|
val client: HttpClient = HttpClients.createDefault()
|
||||||
val response: HttpResponse = client.execute(HttpGet("https://cursemeta.nikky.moe/api/addon/287323/files"))
|
val response: HttpResponse = client.execute(HttpGet("http://bit.ly/matterlinkfiles"))
|
||||||
apiUpdateList = if (200 == response.statusLine.statusCode) { //HTTP 200 OK
|
val apiUpdateList = if (200 == response.statusLine.statusCode) { //HTTP 200 OK
|
||||||
val buffer: BufferedReader = response.entity.content.bufferedReader()
|
val buffer: BufferedReader = response.entity.content.bufferedReader()
|
||||||
|
|
||||||
//put all of the buffer content onto the string
|
//put all of the buffer content onto the string
|
||||||
val content = buffer.readText()
|
val content = buffer.readText()
|
||||||
instance.debug("updateData: $content")
|
instance.trace("updateData: $content")
|
||||||
|
|
||||||
gson.fromJson(content, Array<CurseFile>::class.java)
|
gson.fromJson(content, Array<CurseFile>::class.java)
|
||||||
.filter {
|
.filter {
|
||||||
|
@ -47,7 +45,6 @@ class UpdateChecker : Runnable {
|
||||||
val possibleUpdates = mutableListOf<CurseFile>()
|
val possibleUpdates = mutableListOf<CurseFile>()
|
||||||
apiUpdateList.forEach {
|
apiUpdateList.forEach {
|
||||||
instance.debug(it.toString())
|
instance.debug(it.toString())
|
||||||
//TODO: fix this if we ever release jars that support multiple versions
|
|
||||||
val version = it.fileName.substringAfter("-")
|
val version = it.fileName.substringAfter("-")
|
||||||
if(version > currentModVersion)
|
if(version > currentModVersion)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue