mirror of
https://github.com/Suwayomi/Suwayomi-Server.git
synced 2026-07-01 01:44:34 -05:00
prepare for electron
This commit is contained in:
@@ -65,9 +65,6 @@ dependencies {
|
||||
implementation(project(":AndroidCompat"))
|
||||
implementation(project(":AndroidCompat:Config"))
|
||||
|
||||
// webview
|
||||
implementation(files("lib/WebView.jar"))
|
||||
|
||||
// uncomment to test extensions directly
|
||||
// implementation(fileTree("lib/"))
|
||||
|
||||
@@ -78,7 +75,7 @@ dependencies {
|
||||
val MainClass = "ir.armor.tachidesk.MainKt"
|
||||
application {
|
||||
mainClass.set(MainClass)
|
||||
applicationDefaultJvmArgs = listOf("-Dir.armor.tachidesk.openInWebview=true")
|
||||
// applicationDefaultJvmArgs = listOf("-Dir.armor.tachidesk.openInWebview=true")
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
WebView.jar is taken from https://github.com/shannah/webviewjar
|
||||
Binary file not shown.
@@ -80,7 +80,6 @@ object JavalinSetup {
|
||||
config.enableCorsForAllOrigins()
|
||||
}.events { event ->
|
||||
event.serverStarted {
|
||||
println("started")
|
||||
if (hasWebUiBundled && serverConfig.initialOpenInBrowserEnabled) {
|
||||
Browser.openInBrowser()
|
||||
}
|
||||
|
||||
@@ -7,7 +7,6 @@ package ir.armor.tachidesk.server.util
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||
|
||||
import ca.weblite.webview.WebViewCLIClient
|
||||
import dorkbox.util.Desktop
|
||||
import ir.armor.tachidesk.server.serverConfig
|
||||
|
||||
@@ -17,26 +16,13 @@ object Browser {
|
||||
|
||||
private val webViewInstances = mutableListOf<Any>()
|
||||
|
||||
private fun createWebView() =
|
||||
WebViewCLIClient.Builder()
|
||||
.size(800, 600)
|
||||
.title("Tachidesk")
|
||||
.resizable(true)
|
||||
.url(appBaseUrl)
|
||||
.build()
|
||||
.also {
|
||||
webViewInstances.add(it)
|
||||
}
|
||||
|
||||
fun openInBrowser() {
|
||||
|
||||
val openInWebView = System.getProperty("ir.armor.tachidesk.openInWebview")?.toBoolean()
|
||||
|
||||
if (openInWebView == true) {
|
||||
try {
|
||||
Thread {
|
||||
createWebView()
|
||||
}.start()
|
||||
// TODO
|
||||
} catch (e: Throwable) { // cover both java.lang.Exception and java.lang.Error
|
||||
e.printStackTrace()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user