mirror of
https://github.com/Suwayomi/Suwayomi-Server.git
synced 2026-07-01 01:44:34 -05:00
Electron launcher
This commit is contained in:
@@ -75,7 +75,12 @@ dependencies {
|
||||
val MainClass = "ir.armor.tachidesk.MainKt"
|
||||
application {
|
||||
mainClass.set(MainClass)
|
||||
// applicationDefaultJvmArgs = listOf("-Dir.armor.tachidesk.openInWebview=true")
|
||||
|
||||
// for testing electron
|
||||
// applicationDefaultJvmArgs = listOf(
|
||||
// "-Dir.armor.tachidesk.webInterface=electron",
|
||||
// "-Dir.armor.tachidesk.electronPath=/home/armor/programming/Suwayomi/Tachidesk/scripts/electron-v12.0.9-linux-x64/electron"
|
||||
// )
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
|
||||
@@ -14,15 +14,16 @@ object Browser {
|
||||
private val appIP = if (serverConfig.ip == "0.0.0.0") "127.0.0.1" else serverConfig.ip
|
||||
private val appBaseUrl = "http://$appIP:${serverConfig.port}"
|
||||
|
||||
private val webViewInstances = mutableListOf<Any>()
|
||||
private val electronInstances = mutableListOf<Any>()
|
||||
|
||||
fun openInBrowser() {
|
||||
|
||||
val openInWebView = System.getProperty("ir.armor.tachidesk.openInWebview")?.toBoolean()
|
||||
val openInElectron = System.getProperty("ir.armor.tachidesk.webInterface")?.equals("electron")
|
||||
|
||||
if (openInWebView == true) {
|
||||
if (openInElectron == true) {
|
||||
try {
|
||||
// TODO
|
||||
val electronPath = System.getProperty("ir.armor.tachidesk.electronPath")!!
|
||||
electronInstances.add(ProcessBuilder(electronPath, appBaseUrl).start())
|
||||
} catch (e: Throwable) { // cover both java.lang.Exception and java.lang.Error
|
||||
e.printStackTrace()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user