diff options
author | Linnea Gräf <nea@nea.moe> | 2024-07-24 02:22:30 +0200 |
---|---|---|
committer | Linnea Gräf <nea@nea.moe> | 2024-07-24 02:22:30 +0200 |
commit | c7143936d7a1bf3ae49362049541b2d23b11ab8c (patch) | |
tree | 4e905377b8abf56d1a9e253543a6d3a251f9da82 /src/main/kotlin/moe/nea/firmament/repo/RepoDownloadManager.kt | |
parent | 4585a11434f44fa0900351825eb3ca38ce64f187 (diff) | |
download | firmament-c7143936d7a1bf3ae49362049541b2d23b11ab8c.tar.gz firmament-c7143936d7a1bf3ae49362049541b2d23b11ab8c.tar.bz2 firmament-c7143936d7a1bf3ae49362049541b2d23b11ab8c.zip |
Add essence upgrade recipes
Diffstat (limited to 'src/main/kotlin/moe/nea/firmament/repo/RepoDownloadManager.kt')
-rw-r--r-- | src/main/kotlin/moe/nea/firmament/repo/RepoDownloadManager.kt | 29 |
1 files changed, 19 insertions, 10 deletions
diff --git a/src/main/kotlin/moe/nea/firmament/repo/RepoDownloadManager.kt b/src/main/kotlin/moe/nea/firmament/repo/RepoDownloadManager.kt index 1c27a97..afd9b9f 100644 --- a/src/main/kotlin/moe/nea/firmament/repo/RepoDownloadManager.kt +++ b/src/main/kotlin/moe/nea/firmament/repo/RepoDownloadManager.kt @@ -1,28 +1,34 @@ /* * SPDX-FileCopyrightText: 2023 Linnea Gräf <nea@nea.moe> + * SPDX-FileCopyrightText: 2024 Linnea Gräf <nea@nea.moe> * * SPDX-License-Identifier: GPL-3.0-or-later */ package moe.nea.firmament.repo -import io.ktor.client.call.* -import io.ktor.client.request.* -import io.ktor.client.statement.* -import io.ktor.utils.io.jvm.nio.* +import io.ktor.client.call.body +import io.ktor.client.request.get +import io.ktor.client.statement.bodyAsChannel +import io.ktor.utils.io.jvm.nio.copyTo +import java.io.IOException +import java.nio.file.Files +import java.nio.file.Path +import java.nio.file.StandardOpenOption +import java.util.zip.ZipInputStream import kotlinx.coroutines.CoroutineName import kotlinx.coroutines.Dispatchers.IO import kotlinx.coroutines.withContext import kotlinx.serialization.Serializable +import kotlin.io.path.createDirectories +import kotlin.io.path.exists +import kotlin.io.path.inputStream +import kotlin.io.path.outputStream +import kotlin.io.path.readText +import kotlin.io.path.writeText import moe.nea.firmament.Firmament import moe.nea.firmament.Firmament.logger import moe.nea.firmament.util.iterate -import java.io.IOException -import java.nio.file.Files -import java.nio.file.Path -import java.nio.file.StandardOpenOption -import java.util.zip.ZipInputStream -import kotlin.io.path.* object RepoDownloadManager { @@ -55,6 +61,9 @@ object RepoDownloadManager { private class GithubCommitsResponse(val sha: String) private suspend fun requestLatestGithubSha(): String? { + if (RepoManager.Config.branch == "prerelease") { + RepoManager.Config.branch = "master" + } val response = Firmament.httpClient.get("https://api.github.com/repos/${RepoManager.Config.username}/${RepoManager.Config.reponame}/commits/${RepoManager.Config.branch}") if (response.status.value != 200) { |