Linux-Test Nr. 2

This commit is contained in:
Hartmut Bauer committed 2026-02-14 01:06:05 +01:00
1 parent a6bfc81d47
commit 58933b301d
2 files changed
+11 -3

No files matched your search

+1
View File
@@ -24,6 +24,7 @@ kotlin {
sourceSets { sourceSets {
commonMain.dependencies { commonMain.dependencies {
implementation(masterLibs.utilLibrary)
implementation(libs.compose.material3) implementation(libs.compose.material3)
implementation(libs.compose.ui) implementation(libs.compose.ui)
@@ -1,6 +1,7 @@
package net.keinekekse.app.auth package net.keinekekse.app.auth
import io.ktor.http.* import io.ktor.http.*
import net.keinekekse.exec.ExecutionResult
import java.awt.Desktop import java.awt.Desktop
import java.security.MessageDigest import java.security.MessageDigest
import java.security.SecureRandom import java.security.SecureRandom
@@ -11,9 +12,15 @@ actual fun openInBrowser(url: Url) {
throw IllegalStateException("Desktop API not supported (cannot open browser automatically).") throw IllegalStateException("Desktop API not supported (cannot open browser automatically).")
} }
val desktop = Desktop.getDesktop() val desktop = Desktop.getDesktop()
// if (!desktop.isSupported(Desktop.Action.BROWSE)) { if (!desktop.isSupported(Desktop.Action.BROWSE)) {
// throw IllegalStateException("BROWSE action not supported (cannot open browser automatically).") // 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()) desktop.browse(url.toURI())