mirror of
https://github.com/Suwayomi/Suwayomi-Server.git
synced 2026-07-04 03:14:40 -05: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 {
|
inline operator fun <R, reified T> getValue(thisRef: R, property: KProperty<*>): T {
|
||||||
val configValue: T = config.getValue(thisRef, property)
|
val configValue: T = config.getValue(thisRef, property)
|
||||||
|
|
||||||
println("getting " + "suwayomi.tachidesk.config.$moduleName.${property.name}")
|
|
||||||
val combined = System.getProperty(
|
val combined = System.getProperty(
|
||||||
"suwayomi.tachidesk.config.$moduleName.${property.name}",
|
"suwayomi.tachidesk.config.$moduleName.${property.name}",
|
||||||
configValue.toString()
|
configValue.toString()
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ object JavalinSetup {
|
|||||||
config.enableCorsForAllOrigins()
|
config.enableCorsForAllOrigins()
|
||||||
}.events { event ->
|
}.events { event ->
|
||||||
event.serverStarted {
|
event.serverStarted {
|
||||||
if (serverConfig.webUIEnabled && serverConfig.initialOpenInBrowserEnabled) {
|
if (serverConfig.initialOpenInBrowserEnabled) {
|
||||||
Browser.openInBrowser()
|
Browser.openInBrowser()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,18 +17,20 @@ object Browser {
|
|||||||
private val electronInstances = mutableListOf<Any>()
|
private val electronInstances = mutableListOf<Any>()
|
||||||
|
|
||||||
fun openInBrowser() {
|
fun openInBrowser() {
|
||||||
if (serverConfig.webUIBrowser == ("electron")) {
|
if (serverConfig.webUIEnabled) {
|
||||||
try {
|
if (serverConfig.webUIBrowser == ("electron")) {
|
||||||
val electronPath = serverConfig.electronPath
|
try {
|
||||||
electronInstances.add(ProcessBuilder(electronPath, appBaseUrl).start())
|
val electronPath = serverConfig.electronPath
|
||||||
} catch (e: Throwable) { // cover both java.lang.Exception and java.lang.Error
|
electronInstances.add(ProcessBuilder(electronPath, appBaseUrl).start())
|
||||||
e.printStackTrace()
|
} catch (e: Throwable) { // cover both java.lang.Exception and java.lang.Error
|
||||||
}
|
e.printStackTrace()
|
||||||
} else {
|
}
|
||||||
try {
|
} else {
|
||||||
Desktop.browseURL(appBaseUrl)
|
try {
|
||||||
} catch (e: Throwable) { // cover both java.lang.Exception and java.lang.Error
|
Desktop.browseURL(appBaseUrl)
|
||||||
e.printStackTrace()
|
} catch (e: Throwable) { // cover both java.lang.Exception and java.lang.Error
|
||||||
|
e.printStackTrace()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user