From 58933b301dc0d165d4d06cdc27b79802238cd836 Mon Sep 17 00:00:00 2001 From: Hartmut Bauer Date: Sat, 14 Feb 2026 01:06:05 +0100 Subject: [PATCH] Linux-Test Nr. 2 --- shared/build.gradle.kts | 1 + .../net/keinekekse/app/auth/AuthModule.jvm.kt | 13 ++++++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/shared/build.gradle.kts b/shared/build.gradle.kts index a457ee3..4ccc373 100644 --- a/shared/build.gradle.kts +++ b/shared/build.gradle.kts @@ -24,6 +24,7 @@ kotlin { sourceSets { commonMain.dependencies { + implementation(masterLibs.utilLibrary) implementation(libs.compose.material3) implementation(libs.compose.ui) diff --git a/shared/src/jvmMain/kotlin/net/keinekekse/app/auth/AuthModule.jvm.kt b/shared/src/jvmMain/kotlin/net/keinekekse/app/auth/AuthModule.jvm.kt index 9629657..f024471 100644 --- a/shared/src/jvmMain/kotlin/net/keinekekse/app/auth/AuthModule.jvm.kt +++ b/shared/src/jvmMain/kotlin/net/keinekekse/app/auth/AuthModule.jvm.kt @@ -1,6 +1,7 @@ package net.keinekekse.app.auth import io.ktor.http.* +import net.keinekekse.exec.ExecutionResult import java.awt.Desktop import java.security.MessageDigest import java.security.SecureRandom @@ -11,9 +12,15 @@ actual fun openInBrowser(url: Url) { throw IllegalStateException("Desktop API not supported (cannot open browser automatically).") } val desktop = Desktop.getDesktop() -// if (!desktop.isSupported(Desktop.Action.BROWSE)) { -// throw IllegalStateException("BROWSE action not supported (cannot open browser automatically).") -// } + if (!desktop.isSupported(Desktop.Action.BROWSE)) { + // TODO check if Linux -> run xdg-open $url + if (System.getProperty("os.name").lowercase(Locale.getDefault()).contains("linux")) { + // throws at error - that's all that matters here + ExecutionResult(listOf("xdg-open", url.toString())) + return + } + throw IllegalStateException("BROWSE action not supported (cannot open browser automatically).") + } desktop.browse(url.toURI())