diff --git a/README.md b/README.md index 951ed46..770db9c 100644 --- a/README.md +++ b/README.md @@ -78,6 +78,7 @@ You need this software packages installed in order to build this project: - Java Development Kit and Java Runtime Environment version 8 or newer(both Oracle JDK and OpenJDK works) - Nodejs LTS or latest - Yarn +- Git ### building the full-blown jar Run `./gradlew :webUI:copyBuild server:shadowJar`, the resulting built jar file will be `server/build/Tachidesk-vX.Y.Z-rxxx.jar`. ### building without `webUI` bundled(server only) diff --git a/server/src/main/kotlin/ir/armor/tachidesk/server/JavalinSetup.kt b/server/src/main/kotlin/ir/armor/tachidesk/server/JavalinSetup.kt index 511801c..0164cb2 100644 --- a/server/src/main/kotlin/ir/armor/tachidesk/server/JavalinSetup.kt +++ b/server/src/main/kotlin/ir/armor/tachidesk/server/JavalinSetup.kt @@ -44,6 +44,7 @@ import java.io.IOException import java.text.SimpleDateFormat import java.util.Date import java.util.concurrent.CompletableFuture +import kotlin.concurrent.thread /* * Copyright (C) Contributors to the Suwayomi project @@ -75,6 +76,13 @@ object JavalinSetup { } config.enableCorsForAllOrigins() }.start(serverConfig.ip, serverConfig.port) + + Runtime.getRuntime().addShutdownHook( + thread(start = false) { + app.stop() + } + ) + if (hasWebUiBundled && serverConfig.initialOpenInBrowserEnabled) { openInBrowser() }