From e03d2342ee21f18c2c019fdf39fae59e0b382eff Mon Sep 17 00:00:00 2001 From: MeLike2D Date: Fri, 2 Apr 2021 21:58:27 -0700 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=96=201.0.0=20done=3F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Server/src/main/kotlin/obsidian/server/Obsidian.kt | 11 ++++------- .../src/main/kotlin/obsidian/server/io/MagmaClient.kt | 10 +++++----- 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/Server/src/main/kotlin/obsidian/server/Obsidian.kt b/Server/src/main/kotlin/obsidian/server/Obsidian.kt index 251b4d0..64db5ac 100644 --- a/Server/src/main/kotlin/obsidian/server/Obsidian.kt +++ b/Server/src/main/kotlin/obsidian/server/Obsidian.kt @@ -27,7 +27,6 @@ import io.ktor.application.* import io.ktor.auth.* import io.ktor.features.* import io.ktor.http.* -import io.ktor.http.content.* import io.ktor.locations.* import io.ktor.metrics.micrometer.* import io.ktor.request.* @@ -36,7 +35,6 @@ import io.ktor.routing.* import io.ktor.serialization.* import io.ktor.server.cio.* import io.ktor.server.engine.* -import io.ktor.util.pipeline.* import io.ktor.websocket.* import io.micrometer.prometheus.PrometheusConfig import io.micrometer.prometheus.PrometheusMeterRegistry @@ -57,7 +55,7 @@ object Obsidian { addSpec(Bedrock.Config) addSpec(LoggingConfig) } - .from.yaml.file(".obsidianrc", true) + .from.yaml.file("obsidian.yml", true) .from.env() .from.systemProperties() @@ -98,10 +96,9 @@ object Obsidian { pipeline.intercept(AuthenticationPipeline.RequestAuthentication) { context -> val authorization = call.request.authorization() if (!ObsidianConfig.validateAuth(authorization)) { - val cause = when (authorization) { - null -> AuthenticationFailedCause.NoCredentials - else -> AuthenticationFailedCause.InvalidCredentials - } + val cause = + if (authorization == null) AuthenticationFailedCause.NoCredentials + else AuthenticationFailedCause.InvalidCredentials context.challenge("ObsidianAuth", cause) { call.respond(HttpStatusCode.Unauthorized) diff --git a/Server/src/main/kotlin/obsidian/server/io/MagmaClient.kt b/Server/src/main/kotlin/obsidian/server/io/MagmaClient.kt index 7d84531..b63d69c 100644 --- a/Server/src/main/kotlin/obsidian/server/io/MagmaClient.kt +++ b/Server/src/main/kotlin/obsidian/server/io/MagmaClient.kt @@ -65,14 +65,14 @@ class MagmaClient( val links = ConcurrentHashMap() /** - * Whether this magma client is active + * Resume key */ - private var active: Boolean = false + var resumeKey: String? = null /** - * Resume key + * Whether this magma client is active */ - var resumeKey: String? = null + private var active: Boolean = false /** * Resume timeout @@ -351,7 +351,7 @@ class MagmaClient( } if (lastHeartbeatNonce != nonce) { - logger.warn("A heartbeat was acknowledged but it wasn't the last?") + logger.debug("A heartbeat was acknowledged but it wasn't the last?") return }