tidy up factorio mod publish task
This commit is contained in:
parent
33d31bfbdd
commit
ea0a6b939d
2 changed files with 19 additions and 5 deletions
|
|
@ -27,7 +27,6 @@ import kotlinx.coroutines.runBlocking
|
|||
import kotlinx.serialization.json.Json
|
||||
import org.gradle.api.internal.tasks.userinput.UserInputHandler
|
||||
import org.gradle.kotlin.dsl.support.useToRun
|
||||
import org.jetbrains.kotlin.cli.common.toBooleanLenient
|
||||
|
||||
|
||||
class FactorioModPortalPublishClient(
|
||||
|
|
@ -122,4 +121,18 @@ class FactorioModPortalPublishClient(
|
|||
"upload request failed"
|
||||
}
|
||||
}
|
||||
|
||||
companion object {
|
||||
|
||||
/**
|
||||
* @see org.jetbrains.kotlin.cli.common.toBooleanLenient
|
||||
*/
|
||||
private fun String?.toBooleanLenient(): Boolean? = when (this?.lowercase()?.trim()) {
|
||||
null -> false
|
||||
in listOf("yes", "true", "on", "y") -> true
|
||||
in listOf("", "no", "false", "off", "n") -> false
|
||||
else -> null
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,7 +21,8 @@ sealed interface InitUploadResponse {
|
|||
*/
|
||||
@Serializable
|
||||
data class Success(
|
||||
@SerialName("upload_url") val uploadUrl: String,
|
||||
@SerialName("upload_url")
|
||||
val uploadUrl: String,
|
||||
) : InitUploadResponse
|
||||
|
||||
object Serializer :
|
||||
|
|
@ -68,10 +69,10 @@ data class Failure(
|
|||
private val reasons: Map<String?, String> = mapOf(
|
||||
//@formatter:off
|
||||
"InvalidApiKey" to "Missing or invalid API key for the current endpoint",
|
||||
"InvalidRequest" to "Invalid request.",
|
||||
"InvalidRequest" to "Invalid request",
|
||||
"InternalError" to "Internal error, please try again later.",
|
||||
"Forbidden" to "Insufficient permission for current endpoint",
|
||||
"Unknown" to "Unknown error, please try again later.",
|
||||
"Unknown" to "Unknown error, please try again later",
|
||||
"InvalidModRelease" to "Invalid release data in info.json",
|
||||
"InvalidModUpload" to "Invalid mod data in zipfile",
|
||||
"UnknownMod" to "Mod does not exist in mod portal",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue