aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/moe/nea/notenoughupdates/repo
diff options
context:
space:
mode:
authornea <romangraef@gmail.com>2022-10-22 00:34:22 +0200
committernea <romangraef@gmail.com>2022-10-22 00:34:22 +0200
commitf85c449ed586c7ced780423943e55bfa5abaeb0f (patch)
tree0c5f59c73cc9e5fcb07de6e3f1f102e2413def27 /src/main/kotlin/moe/nea/notenoughupdates/repo
parentc98d4693f1fc9dcae8d78cb33e6233629f4cb2e7 (diff)
downloadFirmament-f85c449ed586c7ced780423943e55bfa5abaeb0f.tar.gz
Firmament-f85c449ed586c7ced780423943e55bfa5abaeb0f.tar.bz2
Firmament-f85c449ed586c7ced780423943e55bfa5abaeb0f.zip
rudimentary config gui (again)
Diffstat (limited to 'src/main/kotlin/moe/nea/notenoughupdates/repo')
-rw-r--r--src/main/kotlin/moe/nea/notenoughupdates/repo/RepoDownloadManager.kt4
-rw-r--r--src/main/kotlin/moe/nea/notenoughupdates/repo/RepoManager.kt6
2 files changed, 5 insertions, 5 deletions
diff --git a/src/main/kotlin/moe/nea/notenoughupdates/repo/RepoDownloadManager.kt b/src/main/kotlin/moe/nea/notenoughupdates/repo/RepoDownloadManager.kt
index 2d700c1..34b49e7 100644
--- a/src/main/kotlin/moe/nea/notenoughupdates/repo/RepoDownloadManager.kt
+++ b/src/main/kotlin/moe/nea/notenoughupdates/repo/RepoDownloadManager.kt
@@ -50,7 +50,7 @@ object RepoDownloadManager {
private suspend fun requestLatestGithubSha(): String? {
val response =
- NotEnoughUpdates.httpClient.get("https://api.github.com/repos/${RepoManager.config.user}/${RepoManager.config.repo}/commits/${RepoManager.config.branch}")
+ NotEnoughUpdates.httpClient.get("https://api.github.com/repos/${RepoManager.data.user}/${RepoManager.data.repo}/commits/${RepoManager.data.branch}")
if (response.status.value != 200) {
return null
}
@@ -77,7 +77,7 @@ object RepoDownloadManager {
}
val currentSha = loadSavedVersionHash()
if (latestSha != currentSha || force) {
- val requestUrl = "https://github.com/${RepoManager.config.user}/${RepoManager.config.repo}/archive/$latestSha.zip"
+ val requestUrl = "https://github.com/${RepoManager.data.user}/${RepoManager.data.repo}/archive/$latestSha.zip"
logger.info("Planning to upgrade repository from $currentSha to $latestSha from $requestUrl")
val zipFile = downloadGithubArchive(requestUrl)
logger.info("Download repository zip file to $zipFile. Deleting old repository")
diff --git a/src/main/kotlin/moe/nea/notenoughupdates/repo/RepoManager.kt b/src/main/kotlin/moe/nea/notenoughupdates/repo/RepoManager.kt
index 26bca51..06a8a87 100644
--- a/src/main/kotlin/moe/nea/notenoughupdates/repo/RepoManager.kt
+++ b/src/main/kotlin/moe/nea/notenoughupdates/repo/RepoManager.kt
@@ -9,13 +9,13 @@ import kotlinx.serialization.serializer
import moe.nea.notenoughupdates.NotEnoughUpdates
import moe.nea.notenoughupdates.NotEnoughUpdates.logger
import moe.nea.notenoughupdates.hud.ProgressBar
-import moe.nea.notenoughupdates.util.config.ConfigHolder
+import moe.nea.notenoughupdates.util.data.DataHolder
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents
import net.minecraft.client.MinecraftClient
import net.minecraft.network.packet.s2c.play.SynchronizeRecipesS2CPacket
import net.minecraft.text.Text
-object RepoManager : ConfigHolder<RepoManager.Config>(serializer(), "repo", ::Config) {
+object RepoManager : DataHolder<RepoManager.Config>(serializer(), "repo", ::Config) {
@Serializable
data class Config(
var user: String = "NotEnoughUpdates",
@@ -80,7 +80,7 @@ object RepoManager : ConfigHolder<RepoManager.Config>(serializer(), "repo", ::Co
}
fun initialize() {
- if (config.autoUpdate) {
+ if (data.autoUpdate) {
launchAsyncUpdate()
} else {
reload()