mirror of
https://github.com/Suwayomi/Tachidesk.git
synced 2025-12-13 08:12:04 +01:00
only open browser when appropriate
This commit is contained in:
@@ -22,7 +22,6 @@ class SystemPropertyOverrideDelegate(val config: Config, val moduleName: String)
|
||||
inline operator fun <R, reified T> getValue(thisRef: R, property: KProperty<*>): T {
|
||||
val configValue: T = config.getValue(thisRef, property)
|
||||
|
||||
println("getting " + "suwayomi.tachidesk.config.$moduleName.${property.name}")
|
||||
val combined = System.getProperty(
|
||||
"suwayomi.tachidesk.config.$moduleName.${property.name}",
|
||||
configValue.toString()
|
||||
|
||||
@@ -50,7 +50,7 @@ object JavalinSetup {
|
||||
config.enableCorsForAllOrigins()
|
||||
}.events { event ->
|
||||
event.serverStarted {
|
||||
if (serverConfig.webUIEnabled && serverConfig.initialOpenInBrowserEnabled) {
|
||||
if (serverConfig.initialOpenInBrowserEnabled) {
|
||||
Browser.openInBrowser()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,18 +17,20 @@ object Browser {
|
||||
private val electronInstances = mutableListOf<Any>()
|
||||
|
||||
fun openInBrowser() {
|
||||
if (serverConfig.webUIBrowser == ("electron")) {
|
||||
try {
|
||||
val electronPath = serverConfig.electronPath
|
||||
electronInstances.add(ProcessBuilder(electronPath, appBaseUrl).start())
|
||||
} catch (e: Throwable) { // cover both java.lang.Exception and java.lang.Error
|
||||
e.printStackTrace()
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
Desktop.browseURL(appBaseUrl)
|
||||
} catch (e: Throwable) { // cover both java.lang.Exception and java.lang.Error
|
||||
e.printStackTrace()
|
||||
if (serverConfig.webUIEnabled) {
|
||||
if (serverConfig.webUIBrowser == ("electron")) {
|
||||
try {
|
||||
val electronPath = serverConfig.electronPath
|
||||
electronInstances.add(ProcessBuilder(electronPath, appBaseUrl).start())
|
||||
} catch (e: Throwable) { // cover both java.lang.Exception and java.lang.Error
|
||||
e.printStackTrace()
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
Desktop.browseURL(appBaseUrl)
|
||||
} catch (e: Throwable) { // cover both java.lang.Exception and java.lang.Error
|
||||
e.printStackTrace()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user