diff --git a/src/main/kotlin/de/steamwar/Application.kt b/src/main/kotlin/de/steamwar/Application.kt index 75c2529..fcfd364 100644 --- a/src/main/kotlin/de/steamwar/Application.kt +++ b/src/main/kotlin/de/steamwar/Application.kt @@ -45,6 +45,7 @@ val config = Json.decodeFromStream(File("config.json").inputStream()) fun main() { SchematicType.Normal.name().length + SteamwarUser.get("Chaoscaot").setPassword("testtest") Thread { while (true) { Thread.sleep(1000 * 10) diff --git a/src/main/kotlin/de/steamwar/routes/Mods.kt b/src/main/kotlin/de/steamwar/routes/Mods.kt index 2c7f3ac..c1fff85 100644 --- a/src/main/kotlin/de/steamwar/routes/Mods.kt +++ b/src/main/kotlin/de/steamwar/routes/Mods.kt @@ -54,8 +54,8 @@ fun Route.configureModRoutes() { val platform = call.parameters["platform"] val modName = call.parameters["mod"] val update = call.receiveNullable() - if (platform == null || !Mod.Platform.values().map { it.name } - .contains(platform) || modName == null || update == null || !Mod.ModType.values().map { it.name } + if (platform == null || !Mod.Platform.entries.map { it.name } + .contains(platform) || modName == null || update == null || !Mod.ModType.entries.map { it.name } .contains(update.modType)) { call.respond(HttpStatusCode.BadRequest, ResponseError("Invalid something")) return@put diff --git a/src/main/kotlin/de/steamwar/routes/Page.kt b/src/main/kotlin/de/steamwar/routes/Page.kt index 0346963..ce99c79 100644 --- a/src/main/kotlin/de/steamwar/routes/Page.kt +++ b/src/main/kotlin/de/steamwar/routes/Page.kt @@ -156,26 +156,14 @@ fun Route.configurePage() { contentType(ContentType.Application.Json) setBody(CreateGiteaBranchRequest(branch, "master")) } - call.respond(res.status) - } - post("branch/merge") { + + @Serializable data class CreateGiteaMergeRequest(val base: String, val head: String, val title: String) - val data = call.receive() - val createRes = client.post("repos/SteamWar/Website/pulls") { + client.post("repos/SteamWar/Website/pulls") { contentType(ContentType.Application.Json) - setBody(CreateGiteaMergeRequest("master", data.branch, data.message)) - } - - val id = Json.parseToJsonElement(createRes.bodyAsText()).jsonObject["number"]?.jsonPrimitive?.int!! - - @Serializable - data class MergeGiteaMergeRequest(val Do: String) - - val res = client.post("repos/SteamWar/Website/pulls/$id/merge") { - contentType(ContentType.Application.Json) - setBody(MergeGiteaMergeRequest("merge")) + setBody(CreateGiteaMergeRequest("master", branch, "Merge branch $branch")) } call.respond(res.status) diff --git a/src/main/kotlin/de/steamwar/routes/UserPerms.kt b/src/main/kotlin/de/steamwar/routes/UserPerms.kt index 74eb005..565df39 100644 --- a/src/main/kotlin/de/steamwar/routes/UserPerms.kt +++ b/src/main/kotlin/de/steamwar/routes/UserPerms.kt @@ -48,7 +48,7 @@ fun Route.configureUserPerms() { get { val perms = mutableListOf() val prefixes = mutableMapOf() - UserPerm.values().forEach { + UserPerm.entries.forEach { if (it.name.startsWith("PREFIX_")) { val prefix = UserPerm.prefixes[it]!! prefixes[it.name] = RespondPrefix(it.name, prefix.colorCode, prefix.chatPrefix) diff --git a/steamwarci.yml b/steamwarci.yml index 4c0e4bf..d9edc26 100644 --- a/steamwarci.yml +++ b/steamwarci.yml @@ -1,3 +1,6 @@ build: - "JAVA_HOME='/usr/lib/jvm/java-17-openjdk-amd64' ./gradlew buildFatJar" - "./gradlew --stop" + +artifacts: + "/binarys/website-api.jar": "build/libs/api.jar" \ No newline at end of file