From 2e259717b7c0cb6838f55e2e7bcd237d57ab828c Mon Sep 17 00:00:00 2001 From: powercas_gamer Date: Sat, 11 Nov 2023 19:46:52 +0100 Subject: [PATCH] chore(spotless): use ktlint --- app/build.gradle.kts | 3 ++- .../main/kotlin/dev/mizule/imagery/app/App.kt | 23 +++++++++++-------- .../dev/mizule/imagery/app/config/Config.kt | 2 +- .../mizule/imagery/app/launcher/Launcher.kt | 9 +++++--- 4 files changed, 23 insertions(+), 14 deletions(-) diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 87cfb51..7f6f72f 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -56,9 +56,11 @@ spotless { } kotlinGradle { applyCommon() + ktlint("0.50.0") } kotlin { applyCommon() + ktlint("0.50.0") } } @@ -76,7 +78,6 @@ indraSpotlessLicenser { property("year", year) property("description", project.description ?: "A template project") property("author", providers.gradleProperty("projectAuthor").getOrElse("template")) - } application { diff --git a/app/src/main/kotlin/dev/mizule/imagery/app/App.kt b/app/src/main/kotlin/dev/mizule/imagery/app/App.kt index a67365a..caa1077 100644 --- a/app/src/main/kotlin/dev/mizule/imagery/app/App.kt +++ b/app/src/main/kotlin/dev/mizule/imagery/app/App.kt @@ -115,8 +115,8 @@ class App { ctx.method(), ctx.ip(), ctx.port(), - ctx.fullUrl() - ) + ctx.fullUrl(), + ), ) } javalin.post("/upload") { ctx -> @@ -142,7 +142,7 @@ class App { System.currentTimeMillis(), file.filename(), file.extension(), - MimeTypes.getDefaultMimeByExtension(file.extension()) + MimeTypes.getDefaultMimeByExtension(file.extension()), ) dataConfig.node(uploadedFile.id).set(uploadedFile) try { @@ -151,12 +151,17 @@ class App { throw RuntimeException(e) } cache.put(fileName, Pair(uploadedFile, filePath)) - ctx.json(JsonObject().apply { - add("data", JsonObject().apply { - addProperty("url", "https://i.mizule.dev/$fileName") - addProperty("delete", "https://i.mizule.dev/$fileName/del") - }) - }) + ctx.json( + JsonObject().apply { + add( + "data", + JsonObject().apply { + addProperty("url", "https://i.mizule.dev/$fileName") + addProperty("delete", "https://i.mizule.dev/$fileName/del") + }, + ) + }, + ) } } diff --git a/app/src/main/kotlin/dev/mizule/imagery/app/config/Config.kt b/app/src/main/kotlin/dev/mizule/imagery/app/config/Config.kt index 421ae20..e9b42eb 100644 --- a/app/src/main/kotlin/dev/mizule/imagery/app/config/Config.kt +++ b/app/src/main/kotlin/dev/mizule/imagery/app/config/Config.kt @@ -33,5 +33,5 @@ data class Config( val port: Int = 8052, @Comment("The domain that this will be on") - val domain: String = "https://example.com" + val domain: String = "https://example.com", ) diff --git a/app/src/main/kotlin/dev/mizule/imagery/app/launcher/Launcher.kt b/app/src/main/kotlin/dev/mizule/imagery/app/launcher/Launcher.kt index 05a2383..d73f6a9 100644 --- a/app/src/main/kotlin/dev/mizule/imagery/app/launcher/Launcher.kt +++ b/app/src/main/kotlin/dev/mizule/imagery/app/launcher/Launcher.kt @@ -23,6 +23,7 @@ * SOFTWARE. */ @file:JvmName("Launcher") + package dev.mizule.imagery.app.launcher import dev.mizule.imagery.app.App @@ -33,7 +34,9 @@ fun main() { app.load() app.enable() - Runtime.getRuntime().addShutdownHook(Thread { - app.disable() - }) + Runtime.getRuntime().addShutdownHook( + Thread { + app.disable() + }, + ) }