Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cdp-generate/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ repositories {

kotlin {
dependencies {
implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:2.1.10")
implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:2.1.21")
implementation("com.squareup:kotlinpoet:2.2.0")
}
}
Expand Down
7 changes: 7 additions & 0 deletions core/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,18 @@
api(libs.ktor.client.darwin)
}
}
val posixMain by creating {
dependsOn(commonMain)
}
val linuxMain by getting {
dependsOn(posixMain)
dependencies {
api(libs.ktor.client.curl)
}
}
val macosMain by getting {

Check warning on line 104 in core/build.gradle.kts

View check run for this annotation

codefactor.io / CodeFactor

core/build.gradle.kts#L104

Private property `macosMain` is unused. (detekt.UnusedPrivateProperty)
dependsOn(posixMain)
}
val mingwMain by getting {
dependencies {
api(libs.ktor.client.winhttp)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package dev.kdriver.core.utils
package dev.kdriver.core.connection

import io.ktor.client.engine.*
import io.ktor.client.engine.darwin.*

actual fun getWebSocketClientEngine(): HttpClientEngineFactory<*> = Darwin

Check warning on line 6 in core/src/appleMain/kotlin/dev/kdriver/core/connection/Client.apple.kt

View check run for this annotation

codefactor.io / CodeFactor

core/src/appleMain/kotlin/dev/kdriver/core/connection/Client.apple.kt#L6

The function getWebSocketClientEngine is missing documentation. (detekt.UndocumentedPublicFunction)
actual fun getHttpApiClientEngine(): HttpClientEngineFactory<*> = Darwin

Check warning on line 7 in core/src/appleMain/kotlin/dev/kdriver/core/connection/Client.apple.kt

View check run for this annotation

codefactor.io / CodeFactor

core/src/appleMain/kotlin/dev/kdriver/core/connection/Client.apple.kt#L7

The function getHttpApiClientEngine is missing documentation. (detekt.UndocumentedPublicFunction)
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
package dev.kdriver.core.network

import kotlinx.cinterop.BetaInteropApi
import kotlinx.cinterop.ExperimentalForeignApi
import kotlinx.cinterop.addressOf
import kotlinx.cinterop.usePinned
import platform.Foundation.*
import platform.posix.memcpy

actual fun ByteArray.decompressZstd(): ByteArray {

Check warning on line 10 in core/src/appleMain/kotlin/dev/kdriver/core/network/Extensions.apple.kt

View check run for this annotation

codefactor.io / CodeFactor

core/src/appleMain/kotlin/dev/kdriver/core/network/Extensions.apple.kt#L10

The function decompressZstd is missing documentation. (detekt.UndocumentedPublicFunction)
// Zstandard decompression is not readily available in Kotlin/Native without additional libraries
// For now, return data as-is or throw an exception
throw UnsupportedOperationException("Zstandard decompression not yet supported on macOS native")
}

@OptIn(ExperimentalForeignApi::class, BetaInteropApi::class)
actual fun ByteArray.decompressGzip(): ByteArray {

Check warning on line 17 in core/src/appleMain/kotlin/dev/kdriver/core/network/Extensions.apple.kt

View check run for this annotation

codefactor.io / CodeFactor

core/src/appleMain/kotlin/dev/kdriver/core/network/Extensions.apple.kt#L17

The function decompressGzip is missing documentation. (detekt.UndocumentedPublicFunction)
// Create NSData from ByteArray
val nsData = usePinned { pinned ->
NSData.create(bytes = pinned.addressOf(0), length = size.toULong())
}

// Use the /usr/bin/gunzip command as a workaround
// This is not ideal but works without needing zlib cinterop definitions
val tempDir = NSTemporaryDirectory()
val inputPath = tempDir + "input.gz"

// Write compressed data to temp file
nsData.writeToFile(inputPath, atomically = false)

// Run gunzip command
val task = NSTask()
task.launchPath = "/usr/bin/gunzip"
task.arguments = listOf("-c", inputPath)

val outputPipe = NSPipe()
task.standardOutput = outputPipe
task.standardError = NSPipe()

task.launch()
task.waitUntilExit()

// Read decompressed data
val outputData = outputPipe.fileHandleForReading.readDataToEndOfFile()

// Clean up temp file
NSFileManager.defaultManager.removeItemAtPath(inputPath, error = null)

// Convert NSData back to ByteArray
val size = outputData.length.toInt()
return if (size > 0) {
val result = ByteArray(size)
result.usePinned { pinned ->
memcpy(pinned.addressOf(0), outputData.bytes, size.toULong())
}
result
} else {
this // Return original if decompression failed
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,175 @@
package dev.kdriver.core.browser

import kotlinx.io.files.Path

/**
* Browser search configuration flags
*/
data class BrowserSearchConfig(
val pathSeparator: String,

Check warning on line 9 in core/src/commonMain/kotlin/dev/kdriver/core/browser/BrowserSearchConfig.kt

View check run for this annotation

codefactor.io / CodeFactor

core/src/commonMain/kotlin/dev/kdriver/core/browser/BrowserSearchConfig.kt#L9

The property pathSeparator is missing documentation. (detekt.UndocumentedPublicProperty)
val searchInPath: Boolean = true,

Check warning on line 10 in core/src/commonMain/kotlin/dev/kdriver/core/browser/BrowserSearchConfig.kt

View check run for this annotation

codefactor.io / CodeFactor

core/src/commonMain/kotlin/dev/kdriver/core/browser/BrowserSearchConfig.kt#L10

The property searchInPath is missing documentation. (detekt.UndocumentedPublicProperty)
val searchMacosApplications: Boolean = false,

Check warning on line 11 in core/src/commonMain/kotlin/dev/kdriver/core/browser/BrowserSearchConfig.kt

View check run for this annotation

codefactor.io / CodeFactor

core/src/commonMain/kotlin/dev/kdriver/core/browser/BrowserSearchConfig.kt#L11

The property searchMacosApplications is missing documentation. (detekt.UndocumentedPublicProperty)
val searchWindowsProgramFiles: Boolean = false,

Check warning on line 12 in core/src/commonMain/kotlin/dev/kdriver/core/browser/BrowserSearchConfig.kt

View check run for this annotation

codefactor.io / CodeFactor

core/src/commonMain/kotlin/dev/kdriver/core/browser/BrowserSearchConfig.kt#L12

The property searchWindowsProgramFiles is missing documentation. (detekt.UndocumentedPublicProperty)
val searchLinuxCommonPaths: Boolean = false,

Check warning on line 13 in core/src/commonMain/kotlin/dev/kdriver/core/browser/BrowserSearchConfig.kt

View check run for this annotation

codefactor.io / CodeFactor

core/src/commonMain/kotlin/dev/kdriver/core/browser/BrowserSearchConfig.kt#L13

The property searchLinuxCommonPaths is missing documentation. (detekt.UndocumentedPublicProperty)
) {

fun findBrowserExecutable(): Path? {

Check warning on line 16 in core/src/commonMain/kotlin/dev/kdriver/core/browser/BrowserSearchConfig.kt

View check run for this annotation

codefactor.io / CodeFactor

core/src/commonMain/kotlin/dev/kdriver/core/browser/BrowserSearchConfig.kt#L16

The function findBrowserExecutable is missing documentation. (detekt.UndocumentedPublicFunction)
return findChromeExecutable()
?: findOperaExecutable()
?: findBraveExecutable()
?: findEdgeExecutable()
}

fun findChromeExecutable(): Path? {

Check warning on line 23 in core/src/commonMain/kotlin/dev/kdriver/core/browser/BrowserSearchConfig.kt

View check run for this annotation

codefactor.io / CodeFactor

core/src/commonMain/kotlin/dev/kdriver/core/browser/BrowserSearchConfig.kt#L23

The function findChromeExecutable is missing documentation. (detekt.UndocumentedPublicFunction)
return findBrowserExecutableCommon(
executableNames = listOf(
"google-chrome",
"chromium",
"chromium-browser",
"chrome",
"google-chrome-stable"
),
macosAppPaths = listOf(
"/Applications/Google Chrome.app/Contents/MacOS/Google Chrome",
"/Applications/Chromium.app/Contents/MacOS/Chromium"
),
linuxCommonPaths = listOf(
"/usr/bin/google-chrome",
"/usr/bin/chromium",
"/usr/bin/chromium-browser",
"/snap/bin/chromium",
"/opt/google/chrome/chrome",
),
windowsProgramFilesSuffixes = listOf(
"Google/Chrome/Application",
"Google/Chrome Beta/Application",
"Google/Chrome Canary/Application",
"Google/Chrome SxS/Application",
),
windowsExecutableNames = listOf("chrome.exe"),
)
}

fun findOperaExecutable(): Path? {

Check warning on line 53 in core/src/commonMain/kotlin/dev/kdriver/core/browser/BrowserSearchConfig.kt

View check run for this annotation

codefactor.io / CodeFactor

core/src/commonMain/kotlin/dev/kdriver/core/browser/BrowserSearchConfig.kt#L53

The function findOperaExecutable is missing documentation. (detekt.UndocumentedPublicFunction)
return findBrowserExecutableCommon(
executableNames = listOf("opera"),
macosAppPaths = listOf(
"/Applications/Opera.app/Contents/MacOS/Opera"
),
linuxCommonPaths = listOf(
"/usr/bin/opera",
"/usr/local/bin/opera",
),
windowsProgramFilesSuffixes = listOf(
"Opera",
"Programs/Opera"
),
windowsExecutableNames = listOf("opera.exe"),
)
}

fun findBraveExecutable(): Path? {

Check warning on line 71 in core/src/commonMain/kotlin/dev/kdriver/core/browser/BrowserSearchConfig.kt

View check run for this annotation

codefactor.io / CodeFactor

core/src/commonMain/kotlin/dev/kdriver/core/browser/BrowserSearchConfig.kt#L71

The function findBraveExecutable is missing documentation. (detekt.UndocumentedPublicFunction)
return findBrowserExecutableCommon(
executableNames = listOf("brave-browser", "brave"),
macosAppPaths = listOf(
"/Applications/Brave Browser.app/Contents/MacOS/Brave Browser"
),
linuxCommonPaths = listOf(
"/usr/bin/brave-browser",
"/usr/bin/brave",
"/snap/bin/brave",
),
windowsProgramFilesSuffixes = listOf(
"BraveSoftware/Brave-Browser/Application"
),
windowsExecutableNames = listOf("brave.exe"),
)
}

fun findEdgeExecutable(): Path? {

Check warning on line 89 in core/src/commonMain/kotlin/dev/kdriver/core/browser/BrowserSearchConfig.kt

View check run for this annotation

codefactor.io / CodeFactor

core/src/commonMain/kotlin/dev/kdriver/core/browser/BrowserSearchConfig.kt#L89

The function findEdgeExecutable is missing documentation. (detekt.UndocumentedPublicFunction)
return findBrowserExecutableCommon(
executableNames = listOf(
"microsoft-edge",
"microsoft-edge-stable",
"microsoft-edge-beta",
"microsoft-edge-dev"
),
macosAppPaths = listOf(
"/Applications/Microsoft Edge.app/Contents/MacOS/Microsoft Edge"
),
linuxCommonPaths = listOf(
"/usr/bin/microsoft-edge",
"/usr/bin/microsoft-edge-stable",
),
windowsProgramFilesSuffixes = listOf(
"Microsoft/Edge/Application"
),
windowsExecutableNames = listOf("msedge.exe"),
)
}

/**
* Common helper to search for browser executables based on platform configuration.
*
* @param executableNames List of executable names to search for (e.g., ["chrome", "google-chrome"])
* @param macosAppPaths macOS .app bundle paths (only used if searchMacosApplications is true)
* @param windowsProgramFilesSuffixes Windows Program Files subdirectories (only used if searchWindowsProgramFiles is true)

Check warning on line 116 in core/src/commonMain/kotlin/dev/kdriver/core/browser/BrowserSearchConfig.kt

View check run for this annotation

codefactor.io / CodeFactor

core/src/commonMain/kotlin/dev/kdriver/core/browser/BrowserSearchConfig.kt#L116

Line detected, which is longer than the defined maximum line length in the code style. (detekt.MaxLineLength)
* @param linuxCommonPaths Common Linux installation paths (only used if searchLinuxCommonPaths is true)
* @param windowsExecutableNames Windows executable names with .exe extension
*
* @return The Path to the found executable, or null if not found.
*/
private fun findBrowserExecutableCommon(

Check warning on line 122 in core/src/commonMain/kotlin/dev/kdriver/core/browser/BrowserSearchConfig.kt

View check run for this annotation

codefactor.io / CodeFactor

core/src/commonMain/kotlin/dev/kdriver/core/browser/BrowserSearchConfig.kt#L122

Function findBrowserExecutableCommon is nested too deeply. (detekt.NestedBlockDepth)

Check warning on line 122 in core/src/commonMain/kotlin/dev/kdriver/core/browser/BrowserSearchConfig.kt

View check run for this annotation

codefactor.io / CodeFactor

core/src/commonMain/kotlin/dev/kdriver/core/browser/BrowserSearchConfig.kt#L122

Documentation of findBrowserExecutableCommon is outdated. (detekt.OutdatedDocumentation)
executableNames: List<String>,
macosAppPaths: List<String> = emptyList(),
windowsProgramFilesSuffixes: List<String> = emptyList(),
windowsExecutableNames: List<String> = emptyList(),
linuxCommonPaths: List<String> = emptyList(),
): Path? {
val candidates = mutableListOf<Path>()

// macOS applications
if (searchMacosApplications) {
candidates.addAll(macosAppPaths.map { Path(it) })
}

// Windows Program Files
if (searchWindowsProgramFiles) {
val programFiles = listOfNotNull(
getEnv("PROGRAMFILES"),
getEnv("PROGRAMFILES(X86)"),
getEnv("LOCALAPPDATA"),
getEnv("PROGRAMW6432")
)
for (base in programFiles) {
for (suffix in windowsProgramFilesSuffixes) {
for (exe in windowsExecutableNames) {
candidates.add(Path("$base/$suffix/$exe"))
}
}
}
}

// Linux common paths
if (searchLinuxCommonPaths) {
candidates.addAll(linuxCommonPaths.map { Path(it) })
}

// Search in PATH
if (searchInPath) {
val pathEnv = getEnv("PATH")
val paths = pathEnv?.split(pathSeparator) ?: emptyList()
for (pathDir in paths) {
for (exe in executableNames + windowsExecutableNames) {
candidates.add(Path("$pathDir/$exe"))
}
}
}

// Return the shortest path that exists
return candidates
.filter { exists(it) }
.minByOrNull { it.toString().length }
}

}
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package dev.kdriver.core.browser

import dev.kdriver.core.exceptions.NoBrowserExecutablePathException
import dev.kdriver.core.utils.*
import io.ktor.util.logging.*
import kotlinx.io.files.Path

Expand Down Expand Up @@ -30,10 +29,7 @@ class Config(
internal val _extensions: MutableList<Path> = mutableListOf()

val browserExecutablePath: Path = browserExecutablePath
?: findChromeExecutable()
?: findOperaExecutable()
?: findBraveExecutable()
?: findEdgeExecutable()
?: defaultBrowserSearchConfig().findBrowserExecutable()
?: throw NoBrowserExecutablePathException()

var sandbox: Boolean = sandbox
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import dev.kdriver.core.exceptions.BrowserExecutableNotFoundException
import dev.kdriver.core.exceptions.FailedToConnectToBrowserException
import dev.kdriver.core.tab.DefaultTab
import dev.kdriver.core.tab.Tab
import dev.kdriver.core.utils.*
import io.ktor.util.logging.*
import kotlinx.coroutines.*
import kotlinx.coroutines.sync.Mutex
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package dev.kdriver.core.browser

import dev.kaccelero.serializers.Serialization
import dev.kdriver.core.utils.getHttpApiClientEngine
import dev.kdriver.core.connection.getHttpApiClientEngine
import io.ktor.client.*
import io.ktor.client.call.*
import io.ktor.client.plugins.contentnegotiation.*
Expand Down
19 changes: 19 additions & 0 deletions core/src/commonMain/kotlin/dev/kdriver/core/browser/Process.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package dev.kdriver.core.browser

import kotlinx.io.files.Path

expect abstract class Process {

Check warning on line 5 in core/src/commonMain/kotlin/dev/kdriver/core/browser/Process.kt

View check run for this annotation

codefactor.io / CodeFactor

core/src/commonMain/kotlin/dev/kdriver/core/browser/Process.kt#L5

Process is missing required documentation. (detekt.UndocumentedPublicClass)
fun isAlive(): Boolean

Check warning on line 6 in core/src/commonMain/kotlin/dev/kdriver/core/browser/Process.kt

View check run for this annotation

codefactor.io / CodeFactor

core/src/commonMain/kotlin/dev/kdriver/core/browser/Process.kt#L6

The function isAlive is missing documentation. (detekt.UndocumentedPublicFunction)
fun pid(): Long

Check warning on line 7 in core/src/commonMain/kotlin/dev/kdriver/core/browser/Process.kt

View check run for this annotation

codefactor.io / CodeFactor

core/src/commonMain/kotlin/dev/kdriver/core/browser/Process.kt#L7

The function pid is missing documentation. (detekt.UndocumentedPublicFunction)
abstract fun destroy()

Check warning on line 8 in core/src/commonMain/kotlin/dev/kdriver/core/browser/Process.kt

View check run for this annotation

codefactor.io / CodeFactor

core/src/commonMain/kotlin/dev/kdriver/core/browser/Process.kt#L8

The function destroy is missing documentation. (detekt.UndocumentedPublicFunction)
}

expect suspend fun startProcess(exe: Path, params: List<String>): Process

Check warning on line 11 in core/src/commonMain/kotlin/dev/kdriver/core/browser/Process.kt

View check run for this annotation

codefactor.io / CodeFactor

core/src/commonMain/kotlin/dev/kdriver/core/browser/Process.kt#L11

The function startProcess is missing documentation. (detekt.UndocumentedPublicFunction)
expect fun addShutdownHook(hook: suspend () -> Unit)

Check warning on line 12 in core/src/commonMain/kotlin/dev/kdriver/core/browser/Process.kt

View check run for this annotation

codefactor.io / CodeFactor

core/src/commonMain/kotlin/dev/kdriver/core/browser/Process.kt#L12

The function addShutdownHook is missing documentation. (detekt.UndocumentedPublicFunction)
expect fun isPosix(): Boolean

Check warning on line 13 in core/src/commonMain/kotlin/dev/kdriver/core/browser/Process.kt

View check run for this annotation

codefactor.io / CodeFactor

core/src/commonMain/kotlin/dev/kdriver/core/browser/Process.kt#L13

The function isPosix is missing documentation. (detekt.UndocumentedPublicFunction)
expect fun isRoot(): Boolean

Check warning on line 14 in core/src/commonMain/kotlin/dev/kdriver/core/browser/Process.kt

View check run for this annotation

codefactor.io / CodeFactor

core/src/commonMain/kotlin/dev/kdriver/core/browser/Process.kt#L14

The function isRoot is missing documentation. (detekt.UndocumentedPublicFunction)
expect fun tempProfileDir(): Path

Check warning on line 15 in core/src/commonMain/kotlin/dev/kdriver/core/browser/Process.kt

View check run for this annotation

codefactor.io / CodeFactor

core/src/commonMain/kotlin/dev/kdriver/core/browser/Process.kt#L15

The function tempProfileDir is missing documentation. (detekt.UndocumentedPublicFunction)
expect fun exists(path: Path): Boolean

Check warning on line 16 in core/src/commonMain/kotlin/dev/kdriver/core/browser/Process.kt

View check run for this annotation

codefactor.io / CodeFactor

core/src/commonMain/kotlin/dev/kdriver/core/browser/Process.kt#L16

The function exists is missing documentation. (detekt.UndocumentedPublicFunction)
expect fun getEnv(name: String): String?

Check warning on line 17 in core/src/commonMain/kotlin/dev/kdriver/core/browser/Process.kt

View check run for this annotation

codefactor.io / CodeFactor

core/src/commonMain/kotlin/dev/kdriver/core/browser/Process.kt#L17

The function getEnv is missing documentation. (detekt.UndocumentedPublicFunction)
expect fun freePort(): Int?

Check warning on line 18 in core/src/commonMain/kotlin/dev/kdriver/core/browser/Process.kt

View check run for this annotation

codefactor.io / CodeFactor

core/src/commonMain/kotlin/dev/kdriver/core/browser/Process.kt#L18

The function freePort is missing documentation. (detekt.UndocumentedPublicFunction)
expect fun defaultBrowserSearchConfig(): BrowserSearchConfig

Check warning on line 19 in core/src/commonMain/kotlin/dev/kdriver/core/browser/Process.kt

View check run for this annotation

codefactor.io / CodeFactor

core/src/commonMain/kotlin/dev/kdriver/core/browser/Process.kt#L19

The function defaultBrowserSearchConfig is missing documentation. (detekt.UndocumentedPublicFunction)
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package dev.kdriver.core.utils
package dev.kdriver.core.connection

import io.ktor.client.engine.*

expect fun getWebSocketClientEngine(): HttpClientEngineFactory<*>

Check warning on line 5 in core/src/commonMain/kotlin/dev/kdriver/core/connection/Client.kt

View check run for this annotation

codefactor.io / CodeFactor

core/src/commonMain/kotlin/dev/kdriver/core/connection/Client.kt#L5

The function getWebSocketClientEngine is missing documentation. (detekt.UndocumentedPublicFunction)
expect fun getHttpApiClientEngine(): HttpClientEngineFactory<*>

Check warning on line 6 in core/src/commonMain/kotlin/dev/kdriver/core/connection/Client.kt

View check run for this annotation

codefactor.io / CodeFactor

core/src/commonMain/kotlin/dev/kdriver/core/connection/Client.kt#L6

The function getHttpApiClientEngine is missing documentation. (detekt.UndocumentedPublicFunction)
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
import dev.kdriver.cdp.*
import dev.kdriver.cdp.domain.*
import dev.kdriver.core.browser.Browser
import dev.kdriver.core.utils.getWebSocketClientEngine
import dev.kdriver.core.utils.parseWebSocketUrl
import dev.kdriver.core.browser.WebSocketInfo
import io.ktor.client.*
import io.ktor.client.plugins.websocket.*
import io.ktor.http.*
Expand All @@ -27,7 +26,7 @@
/**
* Default implementation of the [Connection] interface.
*/
open class DefaultConnection(

Check warning on line 29 in core/src/commonMain/kotlin/dev/kdriver/core/connection/DefaultConnection.kt

View check run for this annotation

codefactor.io / CodeFactor

core/src/commonMain/kotlin/dev/kdriver/core/connection/DefaultConnection.kt#L29

Class 'DefaultConnection' with '11' functions detected. Defined threshold inside classes is set to '11'. (detekt.TooManyFunctions)
private val websocketUrl: String,
private val messageListeningScope: CoroutineScope,
override var targetInfo: Target.TargetInfo? = null,
Expand Down Expand Up @@ -207,6 +206,20 @@
prepareExpertDone = true
}

private fun parseWebSocketUrl(url: String): WebSocketInfo {
val uri = Url(url)

val host = uri.host
val port = if (uri.port != -1) uri.port else when (uri.protocol) {
URLProtocol.WS -> 80

Check warning on line 214 in core/src/commonMain/kotlin/dev/kdriver/core/connection/DefaultConnection.kt

View check run for this annotation

codefactor.io / CodeFactor

core/src/commonMain/kotlin/dev/kdriver/core/connection/DefaultConnection.kt#L214

This expression contains a magic number. Consider defining it to a well named constant. (detekt.MagicNumber)
URLProtocol.WSS -> 443

Check warning on line 215 in core/src/commonMain/kotlin/dev/kdriver/core/connection/DefaultConnection.kt

View check run for this annotation

codefactor.io / CodeFactor

core/src/commonMain/kotlin/dev/kdriver/core/connection/DefaultConnection.kt#L215

This expression contains a magic number. Consider defining it to a well named constant. (detekt.MagicNumber)
else -> throw IllegalArgumentException("Unsupported scheme: ${uri.protocol}")
}
val path = uri.encodedPath

return WebSocketInfo(host, port, path)
}

override fun toString(): String {
return "Connection: ${targetInfo?.toString() ?: "no target"}"
}
Expand Down
Loading