From 7bebbf7bd7c96a04f4e6295b5f2a1cf103d34e40 Mon Sep 17 00:00:00 2001 From: sergeych Date: Sun, 31 May 2026 00:12:35 +0300 Subject: [PATCH] 0.7.1-SNAPSHOT: small improvements to make it more universal and easy to use --- .gitignore | 1 + .idea/misc.xml | 1 - build.gradle.kts | 5 +++-- .../kotlin/net/sergeych/kiloparsec/KiloServer.kt | 5 ++--- .../net/sergeych/kiloparsec/adapter/websocketClient.kt | 10 ++++++++-- 5 files changed, 14 insertions(+), 8 deletions(-) diff --git a/.gitignore b/.gitignore index 7fa6c66..e5f7bd8 100644 --- a/.gitignore +++ b/.gitignore @@ -46,3 +46,4 @@ out/ /.idea/workspace.xml /.gigaide/gigaide.properties local.properties +/kotlin-js-store/yarn.lock diff --git a/.idea/misc.xml b/.idea/misc.xml index 7deb2c1..e0c5638 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,4 +1,3 @@ - diff --git a/build.gradle.kts b/build.gradle.kts index 9cfadc9..fa93ccd 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,5 +1,5 @@ /* - * Copyright (c) 2025. Sergey S. Chernov - All Rights Reserved + * Copyright (c) 2025-2026. Sergey S. Chernov - All Rights Reserved * * You may use, distribute and modify this code under the * terms of the private license, which you must obtain from the author @@ -19,7 +19,7 @@ plugins { } group = "net.sergeych" -version = "0.7.0-SNAPSHOT" +version = "0.7.1-SNAPSHOT" repositories { mavenCentral() @@ -98,6 +98,7 @@ kotlin { implementation("io.ktor:ktor-server-core:$ktor_version") implementation("io.ktor:ktor-server-core-jvm:$ktor_version") implementation("io.ktor:ktor-server-websockets-jvm:$ktor_version") + implementation("io.ktor:ktor-server-websockets:${ktor_version}") implementation("io.ktor:ktor-server-netty:$ktor_version") api("io.ktor:ktor-client-cio:$ktor_version") } diff --git a/src/commonMain/kotlin/net/sergeych/kiloparsec/KiloServer.kt b/src/commonMain/kotlin/net/sergeych/kiloparsec/KiloServer.kt index c5addae..a3e538e 100644 --- a/src/commonMain/kotlin/net/sergeych/kiloparsec/KiloServer.kt +++ b/src/commonMain/kotlin/net/sergeych/kiloparsec/KiloServer.kt @@ -1,5 +1,5 @@ /* - * Copyright (c) 2025. Sergey S. Chernov - All Rights Reserved + * Copyright (c) 2025-2026. Sergey S. Chernov - All Rights Reserved * * You may use, distribute and modify this code under the * terms of the private license, which you must obtain from the author @@ -14,7 +14,6 @@ import kotlinx.coroutines.CancellationException import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.launch import net.sergeych.crypto2.SigningKey -import net.sergeych.kiloparsec.adapter.InetTransportDevice import net.sergeych.mp_logger.LogTag import net.sergeych.mp_logger.debug import net.sergeych.mp_logger.exception @@ -113,7 +112,7 @@ private val instances = AtomicCounter() */ class KiloServer( private val clientInterface: KiloInterface, - private val connections: Flow, + private val connections: Flow, private val serverSecretKey: SigningKey? = null, private val sessionBuilder: () -> S, ) : LogTag("KS:${instances.incrementAndGet()}") { diff --git a/src/commonMain/kotlin/net/sergeych/kiloparsec/adapter/websocketClient.kt b/src/commonMain/kotlin/net/sergeych/kiloparsec/adapter/websocketClient.kt index 6838843..788e3d6 100644 --- a/src/commonMain/kotlin/net/sergeych/kiloparsec/adapter/websocketClient.kt +++ b/src/commonMain/kotlin/net/sergeych/kiloparsec/adapter/websocketClient.kt @@ -1,5 +1,5 @@ /* - * Copyright (c) 2025. Sergey S. Chernov - All Rights Reserved + * Copyright (c) 2025-2026. Sergey S. Chernov - All Rights Reserved * * You may use, distribute and modify this code under the * terms of the private license, which you must obtain from the author @@ -62,11 +62,17 @@ fun websocketTransportDevice( install(WebSockets) }, ): Transport.Device { + + val log = LogTag("WSTD") var u = Url(path) - if (u.encodedPath.length <= 1) + log.debug { "Creating websocket transport device at $u" } + if (u.encodedPath.length <= 1) { + log.debug {"Correcting path as up = ${u.encodedPath}" } u = URLBuilder(u).apply { encodedPath = "/kp" }.build() + } + log.debug { "Url to process is $u" } val input = Channel() val output = Channel()