diff --git a/vripper-core/src/main/kotlin/me/vripper/services/HTTPService.kt b/vripper-core/src/main/kotlin/me/vripper/services/HTTPService.kt index 95d7467..79b8490 100644 --- a/vripper-core/src/main/kotlin/me/vripper/services/HTTPService.kt +++ b/vripper-core/src/main/kotlin/me/vripper/services/HTTPService.kt @@ -41,7 +41,7 @@ internal class HTTPService { connectionExpiryJob = coroutineScope.launch { while (isActive) { it.closeExpired() - delay(60_000) + delay(300_000) } } } diff --git a/vripper-core/src/main/resources/logback.xml b/vripper-core/src/main/resources/logback.xml index 5a79e21..31a9bf2 100644 --- a/vripper-core/src/main/resources/logback.xml +++ b/vripper-core/src/main/resources/logback.xml @@ -25,6 +25,18 @@ + + + + + + + + + + + + @@ -32,8 +44,8 @@ - - - + + + diff --git a/vripper-gui/src/main/kotlin/me/vripper/gui/components/views/AppView.kt b/vripper-gui/src/main/kotlin/me/vripper/gui/components/views/AppView.kt index 45ff3d8..91d6a2d 100644 --- a/vripper-gui/src/main/kotlin/me/vripper/gui/components/views/AppView.kt +++ b/vripper-gui/src/main/kotlin/me/vripper/gui/components/views/AppView.kt @@ -2,11 +2,19 @@ package me.vripper.gui.components.views import atlantafx.base.theme.* import javafx.application.Application.setUserAgentStylesheet +import javafx.event.EventHandler +import javafx.scene.input.TransferMode +import kotlinx.coroutines.CoroutineScope +import kotlinx.coroutines.Dispatchers +import kotlinx.coroutines.SupervisorJob +import kotlinx.coroutines.launch +import me.vripper.gui.controller.AppController import me.vripper.gui.controller.MainController import me.vripper.gui.controller.WidgetsController import tornadofx.View import tornadofx.onChange import tornadofx.vbox +import java.net.URI class AppView : View() { @@ -17,6 +25,8 @@ class AppView : View() { private val statusBarView: StatusBarView by inject() private val actionBarView: ActionBarView by inject() private val widgetsController: WidgetsController by inject() + private val appController: AppController by inject() + private val coroutineScope = CoroutineScope(SupervisorJob() + Dispatchers.IO) init { title = "VRipper ${mainController.version}" with(root) { @@ -30,6 +40,24 @@ class AppView : View() { } prefWidth = widgetsController.currentSettings.width prefHeight = widgetsController.currentSettings.height + onDragOver = EventHandler { event -> + if (event.dragboard.hasString()) { + event.acceptTransferModes(TransferMode.COPY) + } + event.consume() + } + onDragDropped = EventHandler { event -> + val dragBoard = event.dragboard + if (dragBoard != null && dragBoard.hasString()) { + val url = dragBoard.string.trim() + runCatching { + val uri = URI(url) + coroutineScope.launch { + appController.scan(uri.toString()) + } + } + } + } } widgetsController.currentSettings.visibleToolbarPanelProperty.onChange { it -> diff --git a/vripper-gui/src/main/kotlin/me/vripper/gui/controller/AppController.kt b/vripper-gui/src/main/kotlin/me/vripper/gui/controller/AppController.kt new file mode 100644 index 0000000..13ebacd --- /dev/null +++ b/vripper-gui/src/main/kotlin/me/vripper/gui/controller/AppController.kt @@ -0,0 +1,10 @@ +package me.vripper.gui.controller + +import me.vripper.gui.utils.AppEndpointManager.currentAppEndpointService +import tornadofx.Controller + +class AppController : Controller() { + suspend fun scan(postLinks: String) { + runCatching { currentAppEndpointService().scanLinks(postLinks) } + } +} \ No newline at end of file