Compare commits

...

3 Commits

Author SHA1 Message Date
comp500
fa9fe18215 Fix manual link resolution for files not visible in CF API (fixes #48) 2023-01-02 21:15:48 +00:00
comp500
01dcc09a78 Add main method so link.infra.packwiz.installer.Main can be launched directly
Useful for scripts or tools that already handle automatic updates of
packwiz-installer, such as docker-minecraft-server :)
Adds a message to suggest using the bootstrapper for automatic updates
2022-09-01 02:44:12 +01:00
comp500
a8f8444d45 Fix handling of old packwiz.json files with negative murmur2 values 2022-07-18 16:40:39 +01:00
3 changed files with 24 additions and 1 deletions

View File

@@ -135,6 +135,12 @@ class Main(args: Array<String>) {
options.addOption("g", "no-gui", false, "Don't display a GUI to show update progress")
options.addOption("h", "help", false, "Display this message") // Implemented in packwiz-installer-bootstrap!
}
@JvmStatic
fun main(args: Array<String>) {
Log.info("packwiz-installer was started without packwiz-installer-bootstrap. Use the bootstrapper for automatic updates! (Disregard this message if you have your own update mechanism)")
Main(args)
}
}
// Actual main() is in RequiresBootstrap!

View File

@@ -97,6 +97,16 @@ fun resolveCfMetadata(mods: List<IndexFile.File>, packFolder: PackwizFilePath, c
}
}
// Some file types don't show up in the API at all! (e.g. shaderpacks)
// Add unresolved files to manualDownloadMods
for ((fileId, file) in fileIdMap) {
if (file.linkedFile != null) {
if (file.linkedFile!!.resolvedUpdateData["curseforge"] == null) {
manualDownloadMods[(file.linkedFile!!.update["curseforge"] as CurseForgeUpdateData).projectId] = Pair(file, fileId)
}
}
}
if (manualDownloadMods.isNotEmpty()) {
val reqModsData = GetModsRequest(manualDownloadMods.keys.toList())
val reqMods = Request.Builder()

View File

@@ -21,7 +21,14 @@ data class Hash<T>(val type: HashFormat<T>, val value: T) {
object UInt: Encoding<kotlin.UInt> {
override fun encodeToString(value: kotlin.UInt) = value.toString()
override fun decodeFromString(str: String) = str.toUInt()
override fun decodeFromString(str: String) =
try {
str.toUInt()
} catch (e: NumberFormatException) {
// Old packwiz.json values are signed; if they are negative they should be parsed as signed integers
// and reinterpreted as unsigned integers
str.toInt().toUInt()
}
}
}