From a9f55a986c166f0e26c149b4e1d45f88836f0dae Mon Sep 17 00:00:00 2001 From: oSumAtrIX Date: Wed, 5 Jun 2024 04:32:27 +0200 Subject: [PATCH] refactor: Lint & code cleanup --- .../app/revanced/api/command/StartAPICommand.kt | 8 ++++---- .../app/revanced/api/repository/OldApiService.kt | 13 ++++++++----- .../kotlin/app/revanced/api/services/AuthService.kt | 10 ++++------ 3 files changed, 16 insertions(+), 15 deletions(-) diff --git a/src/main/kotlin/app/revanced/api/command/StartAPICommand.kt b/src/main/kotlin/app/revanced/api/command/StartAPICommand.kt index ba473448..88e69455 100644 --- a/src/main/kotlin/app/revanced/api/command/StartAPICommand.kt +++ b/src/main/kotlin/app/revanced/api/command/StartAPICommand.kt @@ -1,12 +1,12 @@ package app.revanced.api.command -import app.revanced.api.configuration.* +import app.revanced.api.configuration.configureDependencies +import app.revanced.api.configuration.configureHTTP +import app.revanced.api.configuration.configureSecurity +import app.revanced.api.configuration.configureSerialization import app.revanced.api.configuration.routing.configureRouting -import io.ktor.server.application.* import io.ktor.server.engine.* import io.ktor.server.netty.* -import io.ktor.server.response.* -import io.ktor.server.routing.* import picocli.CommandLine @CommandLine.Command( diff --git a/src/main/kotlin/app/revanced/api/repository/OldApiService.kt b/src/main/kotlin/app/revanced/api/repository/OldApiService.kt index 4c5612da..97a4443e 100644 --- a/src/main/kotlin/app/revanced/api/repository/OldApiService.kt +++ b/src/main/kotlin/app/revanced/api/repository/OldApiService.kt @@ -28,10 +28,12 @@ internal class OldApiService(private val client: HttpClient) { !key.equals( HttpHeaders.ContentType, ignoreCase = true, - ) && !key.equals( - HttpHeaders.ContentLength, - ignoreCase = true, - ) && !key.equals(HttpHeaders.Host, ignoreCase = true) + ) && + !key.equals( + HttpHeaders.ContentLength, + ignoreCase = true, + ) && + !key.equals(HttpHeaders.Host, ignoreCase = true) }, ) } @@ -51,7 +53,8 @@ internal class OldApiService(private val client: HttpClient) { !key.equals( HttpHeaders.ContentType, ignoreCase = true, - ) && !key.equals(HttpHeaders.ContentLength, ignoreCase = true) + ) && + !key.equals(HttpHeaders.ContentLength, ignoreCase = true) }, ) } diff --git a/src/main/kotlin/app/revanced/api/services/AuthService.kt b/src/main/kotlin/app/revanced/api/services/AuthService.kt index af824a0b..29f9a818 100644 --- a/src/main/kotlin/app/revanced/api/services/AuthService.kt +++ b/src/main/kotlin/app/revanced/api/services/AuthService.kt @@ -38,10 +38,8 @@ internal class AuthService( } } - fun newToken(): String { - return JWT.create() - .withIssuer(issuer) - .withExpiresAt(Date(System.currentTimeMillis() + validityInMin.minutes.inWholeMilliseconds)) - .sign(Algorithm.HMAC256(jwtSecret)) - } + fun newToken(): String = JWT.create() + .withIssuer(issuer) + .withExpiresAt(Date(System.currentTimeMillis() + validityInMin.minutes.inWholeMilliseconds)) + .sign(Algorithm.HMAC256(jwtSecret)) }