mirror of
https://github.com/Suwayomi/Tachidesk.git
synced 2025-12-10 06:42:07 +01:00
fixes #175, better webUI download task
This commit is contained in:
@@ -1 +1 @@
|
|||||||
jre\bin\javaw "-Dsuwayomi.tachidesk.config.server.webInterface=electron" "-Dsuwayomi.tachidesk.config.server.electronPath=electron/electron.exe" -jar Tachidesk.jar
|
jre\bin\javaw "-Dsuwayomi.tachidesk.config.server.webUIInterface=electron" "-Dsuwayomi.tachidesk.config.server.electronPath=electron/electron.exe" -jar Tachidesk.jar
|
||||||
@@ -12,6 +12,15 @@ plugins {
|
|||||||
id("de.fuerstenau.buildconfig") version "1.1.8"
|
id("de.fuerstenau.buildconfig") version "1.1.8"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
buildscript {
|
||||||
|
repositories {
|
||||||
|
mavenCentral()
|
||||||
|
}
|
||||||
|
dependencies {
|
||||||
|
classpath("net.lingala.zip4j:zip4j:2.9.0")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
maven {
|
maven {
|
||||||
url = uri("https://repo1.maven.org/maven2/")
|
url = uri("https://repo1.maven.org/maven2/")
|
||||||
@@ -53,7 +62,6 @@ dependencies {
|
|||||||
implementation("com.dorkbox:Utilities:1.9")
|
implementation("com.dorkbox:Utilities:1.9")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// dependencies of Tachiyomi extensions, some are duplicate, keeping it here for reference
|
// dependencies of Tachiyomi extensions, some are duplicate, keeping it here for reference
|
||||||
implementation("com.github.inorichi.injekt:injekt-core:65b0440")
|
implementation("com.github.inorichi.injekt:injekt-core:65b0440")
|
||||||
implementation("com.squareup.okhttp3:okhttp:4.9.1")
|
implementation("com.squareup.okhttp3:okhttp:4.9.1")
|
||||||
@@ -87,8 +95,8 @@ application {
|
|||||||
|
|
||||||
// for testing electron
|
// for testing electron
|
||||||
// applicationDefaultJvmArgs = listOf(
|
// applicationDefaultJvmArgs = listOf(
|
||||||
// "-Dsuwayomi.tachidesk.webInterface=electron",
|
// "-Dsuwayomi.tachidesk.config.server.webUIInterface=electron",
|
||||||
// "-Dsuwayomi.tachidesk.electronPath=/usr/bin/electron"
|
// "-Dsuwayomi.tachidesk.config.server.electronPath=/usr/bin/electron"
|
||||||
// )
|
// )
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -143,13 +151,13 @@ tasks {
|
|||||||
shadowJar {
|
shadowJar {
|
||||||
manifest {
|
manifest {
|
||||||
attributes(
|
attributes(
|
||||||
mapOf(
|
mapOf(
|
||||||
"Main-Class" to MainClass,
|
"Main-Class" to MainClass,
|
||||||
"Implementation-Title" to rootProject.name,
|
"Implementation-Title" to rootProject.name,
|
||||||
"Implementation-Vendor" to "The Suwayomi Project",
|
"Implementation-Vendor" to "The Suwayomi Project",
|
||||||
"Specification-Version" to tachideskVersion,
|
"Specification-Version" to tachideskVersion,
|
||||||
"Implementation-Version" to tachideskRevision
|
"Implementation-Version" to tachideskRevision
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
archiveBaseName.set(rootProject.name)
|
archiveBaseName.set(rootProject.name)
|
||||||
@@ -159,9 +167,9 @@ tasks {
|
|||||||
withType<KotlinCompile> {
|
withType<KotlinCompile> {
|
||||||
kotlinOptions {
|
kotlinOptions {
|
||||||
freeCompilerArgs = listOf(
|
freeCompilerArgs = listOf(
|
||||||
"-Xopt-in=kotlin.RequiresOptIn",
|
"-Xopt-in=kotlin.RequiresOptIn",
|
||||||
"-Xopt-in=kotlinx.coroutines.ExperimentalCoroutinesApi",
|
"-Xopt-in=kotlinx.coroutines.ExperimentalCoroutinesApi",
|
||||||
"-Xopt-in=kotlinx.coroutines.InternalCoroutinesApi"
|
"-Xopt-in=kotlinx.coroutines.InternalCoroutinesApi"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -175,7 +183,7 @@ tasks {
|
|||||||
}
|
}
|
||||||
|
|
||||||
named("run") {
|
named("run") {
|
||||||
dependsOn("formatKotlin", "lintKotlin")
|
dependsOn("formatKotlin", "lintKotlin", "downloadWebUI")
|
||||||
}
|
}
|
||||||
|
|
||||||
named<Copy>("processResources") {
|
named<Copy>("processResources") {
|
||||||
@@ -186,6 +194,26 @@ tasks {
|
|||||||
register<de.undercouch.gradle.tasks.download.Download>("downloadWebUI") {
|
register<de.undercouch.gradle.tasks.download.Download>("downloadWebUI") {
|
||||||
src("https://github.com/Suwayomi/Tachidesk-WebUI-preview/releases/download/$webUIRevisionTag/Tachidesk-WebUI-$webUIRevisionTag.zip")
|
src("https://github.com/Suwayomi/Tachidesk-WebUI-preview/releases/download/$webUIRevisionTag/Tachidesk-WebUI-$webUIRevisionTag.zip")
|
||||||
dest("src/main/resources/WebUI.zip")
|
dest("src/main/resources/WebUI.zip")
|
||||||
|
|
||||||
|
|
||||||
|
fun shouldOverwrite(): Boolean {
|
||||||
|
val zipPath = "src/main/resources/WebUI.zip"
|
||||||
|
val zipFile = net.lingala.zip4j.ZipFile(zipPath)
|
||||||
|
|
||||||
|
var shouldOverwrite = true
|
||||||
|
if (zipFile.isValidZipFile) {
|
||||||
|
val zipRevision = zipFile.getInputStream(zipFile.getFileHeader("revision")).bufferedReader().use {
|
||||||
|
it.readText().trim()
|
||||||
|
}
|
||||||
|
|
||||||
|
if (zipRevision == webUIRevisionTag)
|
||||||
|
shouldOverwrite = false
|
||||||
|
}
|
||||||
|
|
||||||
|
return shouldOverwrite
|
||||||
|
}
|
||||||
|
|
||||||
|
overwrite(shouldOverwrite())
|
||||||
}
|
}
|
||||||
|
|
||||||
withType<LintTask> {
|
withType<LintTask> {
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ class ServerConfig(config: Config, moduleName: String = "") : ConfigModule(confi
|
|||||||
// webUI
|
// webUI
|
||||||
val webUIEnabled: Boolean by overridableWithSysProperty
|
val webUIEnabled: Boolean by overridableWithSysProperty
|
||||||
val initialOpenInBrowserEnabled: Boolean by overridableWithSysProperty
|
val initialOpenInBrowserEnabled: Boolean by overridableWithSysProperty
|
||||||
val webUIBrowser: String by overridableWithSysProperty
|
val webUIInterface: String by overridableWithSysProperty
|
||||||
val electronPath: String by overridableWithSysProperty
|
val electronPath: String by overridableWithSysProperty
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ object Browser {
|
|||||||
|
|
||||||
fun openInBrowser() {
|
fun openInBrowser() {
|
||||||
if (serverConfig.webUIEnabled) {
|
if (serverConfig.webUIEnabled) {
|
||||||
if (serverConfig.webUIBrowser == ("electron")) {
|
if (serverConfig.webUIInterface == ("electron")) {
|
||||||
try {
|
try {
|
||||||
val electronPath = serverConfig.electronPath
|
val electronPath = serverConfig.electronPath
|
||||||
electronInstances.add(ProcessBuilder(electronPath, appBaseUrl).start())
|
electronInstances.add(ProcessBuilder(electronPath, appBaseUrl).start())
|
||||||
|
|||||||
@@ -14,5 +14,5 @@ server.systemTrayEnabled = true
|
|||||||
# webUI
|
# webUI
|
||||||
server.webUIEnabled = true
|
server.webUIEnabled = true
|
||||||
server.initialOpenInBrowserEnabled = true
|
server.initialOpenInBrowserEnabled = true
|
||||||
server.webUIBrowser = "browser" # "browser" or "electron"
|
server.webUIInterface = "browser" # "browser" or "electron"
|
||||||
server.electronPath = ""
|
server.electronPath = ""
|
||||||
|
|||||||
Reference in New Issue
Block a user