prepare for electron

This commit is contained in:
Aria Moradi
2021-05-24 00:42:25 +04:30
parent a458a696db
commit d082809776
12 changed files with 24 additions and 155 deletions
+1 -4
View File
@@ -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
View File
@@ -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()
}