Linux-Test Nr. 2
This commit is contained in:
1 parent
a6bfc81d47
commit
58933b301d
2 files changed
+11
-3
No files matched your search
@@ -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())
|
||||
|
||||
|
||||
Reference in new issue
Block a user