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())