mirror of
https://github.com/dev-claw/vripper-project.git
synced 2026-08-19 08:35:41 +02:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c3d07a8503 | ||
|
|
30c9c9f24d | ||
|
|
ecf74b7b00 | ||
|
|
ed0c5f76a6 | ||
|
|
46ddb66dc7 | ||
|
|
11c9b665ce | ||
|
|
5b17f17e18 | ||
|
|
d84f19b4af | ||
|
|
12fad45e8b | ||
|
|
dc74e1573c | ||
|
|
f9b89c0b4d |
@@ -6,7 +6,7 @@ on:
|
||||
release:
|
||||
description: 'Release'
|
||||
required: true
|
||||
default: ''
|
||||
type: string
|
||||
|
||||
jobs:
|
||||
build:
|
||||
@@ -24,37 +24,36 @@ jobs:
|
||||
uses: actions/setup-java@v3
|
||||
with:
|
||||
java-version: '25'
|
||||
distribution: 'temurin'
|
||||
cache: maven
|
||||
distribution: 'zulu'
|
||||
|
||||
- name: Build gui jar
|
||||
run: |
|
||||
mvn -N -q install --file pom.xml
|
||||
mvn -B -q install --file vripper-core/pom.xml
|
||||
mvn -B -q install --file vripper-gui/pom.xml
|
||||
mv vripper-gui/target/vripper-gui-${{ ${{ github.event.inputs.release }} }}-jar-with-dependencies.jar vripper-gui/target/vripper-noarch-gui-${{ ${{ github.event.inputs.release }} }}.jar
|
||||
mv vripper-gui/target/vripper-gui-${{ inputs.release }}-jar-with-dependencies.jar vripper-gui/target/vripper-noarch-gui-${{ inputs.release }}.jar
|
||||
|
||||
- if: matrix.os == 'ubuntu-latest'
|
||||
name: Release gui Jar
|
||||
uses: softprops/action-gh-release@v1
|
||||
with:
|
||||
files: vripper-gui/target/vripper-noarch-gui-${{ ${{ github.event.inputs.release }} }}.jar
|
||||
|
||||
files: vripper-gui/target/vripper-noarch-gui-${{ inputs.release }}.jar
|
||||
|
||||
# Start building WEB jar in ubuntu only
|
||||
- if: matrix.os == 'ubuntu-latest'
|
||||
name: Build web Jar
|
||||
run: |
|
||||
mvn -B -q install --file vripper-web-ui/pom.xml
|
||||
mvn -B -q install --file vripper-web/pom.xml
|
||||
mv vripper-web/target/vripper-web-${{ ${{ github.event.inputs.release }} }}.jar vripper-web/target/vripper-noarch-web-${{ ${{ github.event.inputs.release }} }}.jar
|
||||
mv vripper-web/target/vripper-web-${{ inputs.release }}.jar vripper-web/target/vripper-noarch-web-${{ inputs.release }}.jar
|
||||
|
||||
- if: matrix.os == 'ubuntu-latest'
|
||||
name: Release web Jar
|
||||
uses: softprops/action-gh-release@v1
|
||||
with:
|
||||
files: vripper-web/target/vripper-noarch-web-${{ ${{ github.event.inputs.release }} }}.jar
|
||||
files: vripper-web/target/vripper-noarch-web-${{ inputs.release }}.jar
|
||||
# End building WEB jar in ubuntu only
|
||||
|
||||
|
||||
# Start building docker image in ubuntu only
|
||||
- if: matrix.os == 'ubuntu-latest'
|
||||
name: Log in to GitHub Container Registry
|
||||
@@ -67,58 +66,58 @@ jobs:
|
||||
- if: matrix.os == 'ubuntu-latest'
|
||||
name: Build Docker image
|
||||
run: |
|
||||
mkdir docker_build && cp Dockerfile docker_build/Dockerfile && cp vripper-web/target/vripper-noarch-web-${{ ${{ github.event.inputs.release }} }}.jar docker_build/vripper-web.jar
|
||||
mkdir docker_build && cp Dockerfile docker_build/Dockerfile && cp vripper-web/target/vripper-noarch-web-${{ inputs.release }}.jar docker_build/vripper-web.jar
|
||||
docker build -t ghcr.io/dev-claw/vripper-web docker_build
|
||||
docker tag ghcr.io/dev-claw/vripper-web:latest ghcr.io/dev-claw/vripper-web:${{ ${{ github.event.inputs.release }} }}
|
||||
docker tag ghcr.io/dev-claw/vripper-web:latest ghcr.io/dev-claw/vripper-web:${{ inputs.release }}
|
||||
docker push ghcr.io/dev-claw/vripper-web:latest
|
||||
docker push ghcr.io/dev-claw/vripper-web:${{ ${{ github.event.inputs.release }} }}
|
||||
|
||||
docker push ghcr.io/dev-claw/vripper-web:${{ inputs.release }}
|
||||
|
||||
# End building docker image in ubuntu only
|
||||
|
||||
- name: Prepare Packaging
|
||||
run: |
|
||||
cp vripper-gui/target/vripper-noarch-gui-${{ ${{ github.event.inputs.release }} }}.jar jpackage/jar/vripper-gui.jar
|
||||
cp vripper-gui/target/vripper-noarch-gui-${{ inputs.release }}.jar jpackage/jar/vripper-gui.jar
|
||||
|
||||
- if: matrix.os == 'ubuntu-latest'
|
||||
name: Package for Linux
|
||||
run: |
|
||||
cd jpackage
|
||||
jpackage --app-version ${{ ${{ github.event.inputs.release }} }} "@jpackage.cfg" "@jpackage-app-image.cfg" --icon resources/VRipper.png
|
||||
jpackage --app-version ${{ ${{ github.event.inputs.release }} }} "@jpackage.cfg" "@jpackage-linux.cfg" --resource-dir resources --type deb
|
||||
jpackage --app-version ${{ ${{ github.event.inputs.release }} }} "@jpackage.cfg" "@jpackage-linux.cfg" --resource-dir resources --type rpm
|
||||
mv dist/vripper-${{ ${{ github.event.inputs.release }} }}-1.x86_64.rpm dist/vripper-linux-${{ ${{ github.event.inputs.release }} }}.x86_64.rpm
|
||||
mv dist/vripper_${{ ${{ github.event.inputs.release }} }}-1_amd64.deb dist/vripper-linux-${{ ${{ github.event.inputs.release }} }}_amd64.deb
|
||||
jpackage --app-version ${{ inputs.release }} "@jpackage.cfg" "@jpackage-app-image.cfg" --icon resources/VRipper.png
|
||||
jpackage --app-version ${{ inputs.release }} "@jpackage.cfg" "@jpackage-linux.cfg" --resource-dir resources --type deb
|
||||
jpackage --app-version ${{ inputs.release }} "@jpackage.cfg" "@jpackage-linux.cfg" --resource-dir resources --type rpm
|
||||
mv dist/vripper-${{ inputs.release }}-1.x86_64.rpm dist/vripper-linux-${{ inputs.release }}.x86_64.rpm
|
||||
mv dist/vripper_${{ inputs.release }}-1_amd64.deb dist/vripper-linux-${{ inputs.release }}_amd64.deb
|
||||
|
||||
- if: matrix.os == 'windows-latest'
|
||||
name: Package for Windows
|
||||
run: |
|
||||
cd jpackage
|
||||
jpackage --app-version ${{ ${{ github.event.inputs.release }} }} "@jpackage.cfg" "@jpackage-app-image.cfg" --icon resources/VRipper.ico
|
||||
jpackage --app-version ${{ ${{ github.event.inputs.release }} }} "@jpackage.cfg" "@jpackage-windows.cfg" --resource-dir resources --type msi
|
||||
jpackage --app-version ${{ ${{ github.event.inputs.release }} }} "@jpackage.cfg" "@jpackage-windows.cfg" --resource-dir resources --type exe
|
||||
jpackage --app-version ${{ inputs.release }} "@jpackage.cfg" "@jpackage-app-image.cfg" --icon resources/VRipper.ico
|
||||
jpackage --app-version ${{ inputs.release }} "@jpackage.cfg" "@jpackage-windows.cfg" --resource-dir resources --type msi
|
||||
jpackage --app-version ${{ inputs.release }} "@jpackage.cfg" "@jpackage-windows.cfg" --resource-dir resources --type exe
|
||||
cd dist
|
||||
ren VRipper-${{ ${{ github.event.inputs.release }} }}.msi vripper-windows-installer-${{ ${{ github.event.inputs.release }} }}.msi
|
||||
ren VRipper-${{ ${{ github.event.inputs.release }} }}.exe vripper-windows-installer-${{ ${{ github.event.inputs.release }} }}.exe
|
||||
ren VRipper-${{ inputs.release }}.msi vripper-windows-installer-${{ inputs.release }}.msi
|
||||
ren VRipper-${{ inputs.release }}.exe vripper-windows-installer-${{ inputs.release }}.exe
|
||||
|
||||
- if: matrix.os == 'macos-latest'
|
||||
name: Package for macOS(arm64)
|
||||
run: |
|
||||
cd jpackage
|
||||
jpackage --app-version ${{ ${{ github.event.inputs.release }} }} "@jpackage.cfg" "@jpackage-app-image.cfg" --icon resources/VRipper.icns
|
||||
jpackage --app-version ${{ ${{ github.event.inputs.release }} }} "@jpackage.cfg" "@jpackage-macos.cfg" --resource-dir resources --type pkg
|
||||
jpackage --app-version ${{ ${{ github.event.inputs.release }} }} "@jpackage.cfg" "@jpackage-macos.cfg" --resource-dir resources --type dmg
|
||||
mv dist/VRipper-${{ ${{ github.event.inputs.release }} }}.pkg dist/vripper-macos-${{ ${{ github.event.inputs.release }} }}.arm64.pkg
|
||||
mv dist/VRipper-${{ ${{ github.event.inputs.release }} }}.dmg dist/vripper-macos-${{ ${{ github.event.inputs.release }} }}.arm64.dmg
|
||||
jpackage --app-version ${{ inputs.release }} "@jpackage.cfg" "@jpackage-app-image.cfg" --icon resources/VRipper.icns
|
||||
jpackage --app-version ${{ inputs.release }} "@jpackage.cfg" "@jpackage-macos.cfg" --resource-dir resources --type pkg
|
||||
jpackage --app-version ${{ inputs.release }} "@jpackage.cfg" "@jpackage-macos.cfg" --resource-dir resources --type dmg
|
||||
mv dist/VRipper-${{ inputs.release }}.pkg dist/vripper-macos-${{ inputs.release }}.arm64.pkg
|
||||
mv dist/VRipper-${{ inputs.release }}.dmg dist/vripper-macos-${{ inputs.release }}.arm64.dmg
|
||||
|
||||
- if: matrix.os == 'macos-13'
|
||||
name: Package for macOS(x86_64)
|
||||
run: |
|
||||
cd jpackage
|
||||
jpackage --app-version ${{ ${{ github.event.inputs.release }} }} "@jpackage.cfg" "@jpackage-app-image.cfg" --icon resources/VRipper.icns
|
||||
jpackage --app-version ${{ ${{ github.event.inputs.release }} }} "@jpackage.cfg" "@jpackage-macos.cfg" --resource-dir resources --type pkg
|
||||
jpackage --app-version ${{ ${{ github.event.inputs.release }} }} "@jpackage.cfg" "@jpackage-macos.cfg" --resource-dir resources --type dmg
|
||||
mv dist/VRipper-${{ ${{ github.event.inputs.release }} }}.pkg dist/vripper-macos-${{ ${{ github.event.inputs.release }} }}.x86_64.pkg
|
||||
mv dist/VRipper-${{ ${{ github.event.inputs.release }} }}.dmg dist/vripper-macos-${{ ${{ github.event.inputs.release }} }}.x86_64.dmg
|
||||
jpackage --app-version ${{ inputs.release }} "@jpackage.cfg" "@jpackage-app-image.cfg" --icon resources/VRipper.icns
|
||||
jpackage --app-version ${{ inputs.release }} "@jpackage.cfg" "@jpackage-macos.cfg" --resource-dir resources --type pkg
|
||||
jpackage --app-version ${{ inputs.release }} "@jpackage.cfg" "@jpackage-macos.cfg" --resource-dir resources --type dmg
|
||||
mv dist/VRipper-${{ inputs.release }}.pkg dist/vripper-macos-${{ inputs.release }}.x86_64.pkg
|
||||
mv dist/VRipper-${{ inputs.release }}.dmg dist/vripper-macos-${{ inputs.release }}.x86_64.dmg
|
||||
|
||||
- if: matrix.os == 'ubuntu-latest'
|
||||
name: Zip Ubuntu portable
|
||||
@@ -127,7 +126,7 @@ jobs:
|
||||
type: 'zip'
|
||||
directory: 'jpackage/dist'
|
||||
path: 'VRipper'
|
||||
filename: 'vripper-linux-portable-${{ ${{ github.event.inputs.release }} }}.zip'
|
||||
filename: 'vripper-linux-portable-${{ inputs.release }}.zip'
|
||||
|
||||
- if: matrix.os == 'windows-latest'
|
||||
name: Zip Windows portable
|
||||
@@ -136,7 +135,7 @@ jobs:
|
||||
type: 'zip'
|
||||
directory: 'jpackage/dist'
|
||||
path: 'VRipper'
|
||||
filename: 'vripper-windows-portable-${{ ${{ github.event.inputs.release }} }}.zip'
|
||||
filename: 'vripper-windows-portable-${{ inputs.release }}.zip'
|
||||
|
||||
- if: matrix.os == 'macos-latest'
|
||||
name: Zip macOS(arm64) portable
|
||||
@@ -145,7 +144,7 @@ jobs:
|
||||
type: 'zip'
|
||||
directory: 'jpackage/dist'
|
||||
path: 'VRipper.app'
|
||||
filename: 'vripper-macos-portable-${{ ${{ github.event.inputs.release }} }}.arm64.zip'
|
||||
filename: 'vripper-macos-portable-${{ inputs.release }}.arm64.zip'
|
||||
|
||||
- if: matrix.os == 'macos-13'
|
||||
name: Zip macOS(x86_64) portable
|
||||
@@ -154,40 +153,40 @@ jobs:
|
||||
type: 'zip'
|
||||
directory: 'jpackage/dist'
|
||||
path: 'VRipper.app'
|
||||
filename: 'vripper-macos-portable-${{ ${{ github.event.inputs.release }} }}.x86_64.zip'
|
||||
filename: 'vripper-macos-portable-${{ inputs.release }}.x86_64.zip'
|
||||
|
||||
- if: matrix.os == 'ubuntu-latest'
|
||||
name: Release packages for Linux
|
||||
uses: softprops/action-gh-release@v1
|
||||
with:
|
||||
files: |
|
||||
jpackage/dist/vripper-linux-${{ ${{ github.event.inputs.release }} }}.x86_64.rpm
|
||||
jpackage/dist/vripper-linux-${{ ${{ github.event.inputs.release }} }}_amd64.deb
|
||||
jpackage/dist/vripper-linux-portable-${{ ${{ github.event.inputs.release }} }}.zip
|
||||
jpackage/dist/vripper-linux-${{ inputs.release }}.x86_64.rpm
|
||||
jpackage/dist/vripper-linux-${{ inputs.release }}_amd64.deb
|
||||
jpackage/dist/vripper-linux-portable-${{ inputs.release }}.zip
|
||||
|
||||
- if: matrix.os == 'windows-latest'
|
||||
name: Release packages for Windows
|
||||
uses: softprops/action-gh-release@v1
|
||||
with:
|
||||
files: |
|
||||
jpackage/dist/vripper-windows-installer-${{ ${{ github.event.inputs.release }} }}.msi
|
||||
jpackage/dist/vripper-windows-installer-${{ ${{ github.event.inputs.release }} }}.exe
|
||||
jpackage/dist/vripper-windows-portable-${{ ${{ github.event.inputs.release }} }}.zip
|
||||
jpackage/dist/vripper-windows-installer-${{ inputs.release }}.msi
|
||||
jpackage/dist/vripper-windows-installer-${{ inputs.release }}.exe
|
||||
jpackage/dist/vripper-windows-portable-${{ inputs.release }}.zip
|
||||
|
||||
- if: matrix.os == 'macos-latest'
|
||||
name: Release packages for macOS(arm64)
|
||||
uses: softprops/action-gh-release@v1
|
||||
with:
|
||||
files: |
|
||||
jpackage/dist/vripper-macos-${{ ${{ github.event.inputs.release }} }}.arm64.pkg
|
||||
jpackage/dist/vripper-macos-${{ ${{ github.event.inputs.release }} }}.arm64.dmg
|
||||
jpackage/dist/vripper-macos-portable-${{ ${{ github.event.inputs.release }} }}.arm64.zip
|
||||
jpackage/dist/vripper-macos-${{ inputs.release }}.arm64.pkg
|
||||
jpackage/dist/vripper-macos-${{ inputs.release }}.arm64.dmg
|
||||
jpackage/dist/vripper-macos-portable-${{ inputs.release }}.arm64.zip
|
||||
|
||||
- if: matrix.os == 'macos-13'
|
||||
name: Release packages for macOS(x86_64)
|
||||
uses: softprops/action-gh-release@v1
|
||||
with:
|
||||
files: |
|
||||
jpackage/dist/vripper-macos-${{ ${{ github.event.inputs.release }} }}.x86_64.pkg
|
||||
jpackage/dist/vripper-macos-${{ ${{ github.event.inputs.release }} }}.x86_64.dmg
|
||||
jpackage/dist/vripper-macos-portable-${{ ${{ github.event.inputs.release }} }}.x86_64.zip
|
||||
jpackage/dist/vripper-macos-${{ inputs.release }}.x86_64.pkg
|
||||
jpackage/dist/vripper-macos-${{ inputs.release }}.x86_64.dmg
|
||||
jpackage/dist/vripper-macos-portable-${{ inputs.release }}.x86_64.zip
|
||||
|
||||
@@ -8,7 +8,7 @@ jobs:
|
||||
build:
|
||||
strategy:
|
||||
matrix:
|
||||
os: [ ubuntu-latest, windows-latest, macos-13, macos-latest ]
|
||||
os: [ ubuntu-latest, windows-latest, macos-15-intel, macos-latest ]
|
||||
runs-on: ${{ matrix.os }}
|
||||
permissions:
|
||||
contents: write
|
||||
@@ -105,8 +105,8 @@ jobs:
|
||||
jpackage --app-version ${{ github.event.release.tag_name }} "@jpackage.cfg" "@jpackage-macos.cfg" --resource-dir resources --type dmg
|
||||
mv dist/VRipper-${{ github.event.release.tag_name }}.pkg dist/vripper-macos-${{ github.event.release.tag_name }}.arm64.pkg
|
||||
mv dist/VRipper-${{ github.event.release.tag_name }}.dmg dist/vripper-macos-${{ github.event.release.tag_name }}.arm64.dmg
|
||||
|
||||
- if: matrix.os == 'macos-13'
|
||||
|
||||
- if: matrix.os == 'macos-15-intel'
|
||||
name: Package for macOS(x86_64)
|
||||
run: |
|
||||
cd jpackage
|
||||
@@ -142,8 +142,8 @@ jobs:
|
||||
directory: 'jpackage/dist'
|
||||
path: 'VRipper.app'
|
||||
filename: 'vripper-macos-portable-${{ github.event.release.tag_name }}.arm64.zip'
|
||||
|
||||
- if: matrix.os == 'macos-13'
|
||||
|
||||
- if: matrix.os == 'macos-15-intel'
|
||||
name: Zip macOS(x86_64) portable
|
||||
uses: thedoctor0/zip-release@0.7.1
|
||||
with:
|
||||
@@ -179,7 +179,7 @@ jobs:
|
||||
jpackage/dist/vripper-macos-${{ github.event.release.tag_name }}.arm64.dmg
|
||||
jpackage/dist/vripper-macos-portable-${{ github.event.release.tag_name }}.arm64.zip
|
||||
|
||||
- if: matrix.os == 'macos-13'
|
||||
- if: matrix.os == 'macos-15-intel'
|
||||
name: Release packages for macOS(x86_64)
|
||||
uses: softprops/action-gh-release@v1
|
||||
with:
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
FROM eclipse-temurin:25-jre
|
||||
FROM azul/zulu-openjdk:25-latest
|
||||
WORKDIR /opt/vripper-web
|
||||
ENTRYPOINT ["java", "-jar", "vripper-web.jar"]
|
||||
ADD vripper-web.jar /opt/vripper-web/vripper-web.jar
|
||||
|
||||
@@ -15,8 +15,8 @@
|
||||
<maven.compiler.source>${java.version}</maven.compiler.source>
|
||||
<maven.compiler.target>${java.version}</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<revision>6.6.0</revision>
|
||||
<app-version>6.6.0-alpha</app-version>
|
||||
<revision>6.6.4</revision>
|
||||
<app-version>6.6.4</app-version>
|
||||
<kotlin.version>2.2.20</kotlin.version>
|
||||
<slf4j.version>2.0.16</slf4j.version>
|
||||
<logback.version>1.5.12</logback.version>
|
||||
|
||||
@@ -31,8 +31,10 @@ class AddLinksFragment : Fragment("Add thread links") {
|
||||
action {
|
||||
coroutineScope.launch {
|
||||
postController.scan(textAreaProperty.value)
|
||||
runLater {
|
||||
close()
|
||||
}
|
||||
}
|
||||
close()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,13 +13,11 @@ import me.vripper.gui.components.views.AppView
|
||||
import me.vripper.gui.components.views.LoadingView
|
||||
import me.vripper.gui.controller.WidgetsController
|
||||
import me.vripper.gui.event.GuiEventBus
|
||||
import me.vripper.gui.services.GrpcEndpointService
|
||||
import tornadofx.*
|
||||
|
||||
class SessionFragment : Fragment("Change Session") {
|
||||
|
||||
private val widgetsController: WidgetsController by inject()
|
||||
private val grpcEndpointService: GrpcEndpointService by di("remoteAppEndpointService")
|
||||
private val toggleGroup = ToggleGroup()
|
||||
override val root = VBox().apply {
|
||||
alignment = Pos.CENTER
|
||||
@@ -65,6 +63,9 @@ class SessionFragment : Fragment("Change Session") {
|
||||
addClass(Styles.ACCENT)
|
||||
isDefaultButton = true
|
||||
action {
|
||||
runBlocking {
|
||||
GuiEventBus.publishEvent(GuiEventBus.ChangingSession)
|
||||
}
|
||||
val selectedToggle = toggleGroup.selectedToggle
|
||||
runLater {
|
||||
find<AppView>().replaceWith(find<LoadingView>())
|
||||
@@ -82,7 +83,6 @@ class SessionFragment : Fragment("Change Session") {
|
||||
else -> VripperGuiApplication.APP_INSTANCE.stop()
|
||||
}
|
||||
runBlocking {
|
||||
GuiEventBus.publishEvent(GuiEventBus.ChangingSession)
|
||||
GuiEventBus.publishEvent(GuiEventBus.ApplicationInitialized(emptyList()))
|
||||
}
|
||||
close()
|
||||
|
||||
@@ -2,13 +2,10 @@ package me.vripper.gui.components.views
|
||||
|
||||
import atlantafx.base.theme.*
|
||||
import javafx.application.Application.setUserAgentStylesheet
|
||||
import kotlinx.coroutines.runBlocking
|
||||
import me.vripper.gui.controller.MainController
|
||||
import me.vripper.gui.controller.WidgetsController
|
||||
import me.vripper.gui.event.GuiEventBus
|
||||
import tornadofx.View
|
||||
import tornadofx.onChange
|
||||
import tornadofx.runLater
|
||||
import tornadofx.vbox
|
||||
|
||||
class AppView : View() {
|
||||
@@ -63,17 +60,5 @@ class AppView : View() {
|
||||
else -> setUserAgentStylesheet(CupertinoLight().userAgentStylesheet)
|
||||
}
|
||||
}
|
||||
|
||||
runLater {
|
||||
if (widgetsController.currentSettings.localSession) {
|
||||
runBlocking {
|
||||
GuiEventBus.publishEvent(GuiEventBus.LocalSession)
|
||||
}
|
||||
} else {
|
||||
runBlocking {
|
||||
GuiEventBus.publishEvent(GuiEventBus.RemoteSession)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6,11 +6,8 @@ import javafx.scene.effect.DropShadow
|
||||
import javafx.scene.input.KeyCode
|
||||
import javafx.scene.input.KeyCodeCombination
|
||||
import javafx.scene.input.KeyCombination
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.SupervisorJob
|
||||
import kotlinx.coroutines.*
|
||||
import kotlinx.coroutines.flow.filterIsInstance
|
||||
import kotlinx.coroutines.launch
|
||||
import me.vripper.gui.VripperGuiApplication
|
||||
import me.vripper.gui.components.fragments.SessionFragment
|
||||
import me.vripper.gui.controller.WidgetsController
|
||||
@@ -42,32 +39,35 @@ class LoadingView : View("VRipper") {
|
||||
message.set("")
|
||||
AppManager.stop()
|
||||
grpcEndpointService.disconnect()
|
||||
if (widgetsController.currentSettings.localSession) {
|
||||
AppEndpointManager.set(GuiEventBus.LocalSession)
|
||||
GuiEventBus.publishEvent(GuiEventBus.LocalSession)
|
||||
AppManager.start()
|
||||
} else {
|
||||
AppEndpointManager.set(GuiEventBus.RemoteSession)
|
||||
GuiEventBus.publishEvent(GuiEventBus.RemoteSession)
|
||||
if (!widgetsController.currentSettings.localSession) {
|
||||
grpcEndpointService.connect(
|
||||
widgetsController.currentSettings.remoteSessionModel.host,
|
||||
widgetsController.currentSettings.remoteSessionModel.port,
|
||||
widgetsController.currentSettings.remoteSessionModel.passcode,
|
||||
)
|
||||
|
||||
val check = grpcEndpointService.versionCheck()
|
||||
if (check == null) {
|
||||
message.set("Unable to connect to ${widgetsController.currentSettings.remoteSessionModel.host}:${widgetsController.currentSettings.remoteSessionModel.port}")
|
||||
return@collect
|
||||
} else if (!check) {
|
||||
println("Version Mismatch")
|
||||
message.set("Version Mismatch, client must be >= 6.6.0")
|
||||
return@collect
|
||||
}
|
||||
}
|
||||
runLater {
|
||||
val sessionType = if (widgetsController.currentSettings.localSession) {
|
||||
AppManager.start()
|
||||
GuiEventBus.LocalSession
|
||||
} else {
|
||||
GuiEventBus.RemoteSession
|
||||
}
|
||||
AppEndpointManager.set(sessionType)
|
||||
replaceWith(find<AppView>())
|
||||
runBlocking {
|
||||
GuiEventBus.publishEvent(sessionType)
|
||||
}
|
||||
}
|
||||
|
||||
if (it.args.isNotEmpty()) {
|
||||
Watcher.notify(it.args[0])
|
||||
}
|
||||
@@ -107,9 +107,4 @@ class LoadingView : View("VRipper") {
|
||||
effect = DropShadow()
|
||||
}
|
||||
}
|
||||
|
||||
// override fun onUndock() {
|
||||
// println("Undowking")
|
||||
// coroutineScope.cancel()
|
||||
// }
|
||||
}
|
||||
@@ -153,39 +153,9 @@ class LogTableView : View() {
|
||||
tableView.placeholder = Label("Loading")
|
||||
tableView.sortOrder.add(tableView.columns.first { it.id == "time" })
|
||||
|
||||
|
||||
coroutineScope.launch {
|
||||
launch {
|
||||
GuiEventBus.events.collect {
|
||||
when (it) {
|
||||
GuiEventBus.LocalSession, GuiEventBus.RemoteSession -> {
|
||||
while (isActive) {
|
||||
val result = runCatching { logController.getMaxEventLog() }
|
||||
if (result.isSuccess) {
|
||||
maxLogEvent = result.getOrNull()!!
|
||||
break
|
||||
}
|
||||
}
|
||||
while (isActive) {
|
||||
val result = runCatching { logController.initLogger() }
|
||||
if (result.isSuccess) {
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
GuiEventBus.ChangingSession -> runLater {
|
||||
items.clear()
|
||||
tableView.placeholder = Label("Loading")
|
||||
}
|
||||
|
||||
else -> {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
launch {
|
||||
logController.newLogs.collect {
|
||||
logController.newLogs.let { flow ->
|
||||
coroutineScope.launch {
|
||||
flow.collect {
|
||||
runLater {
|
||||
items.sortWith(Comparator.comparing { it.sequence })
|
||||
while (items.isNotEmpty() && (items.size >= maxLogEvent)) {
|
||||
@@ -196,13 +166,44 @@ class LogTableView : View() {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
launch {
|
||||
logController.updateSettings.collect {
|
||||
logController.updateSettings.let { flow ->
|
||||
coroutineScope.launch {
|
||||
flow.collect {
|
||||
maxLogEvent = it.systemSettings.maxEventLog
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
coroutineScope.launch {
|
||||
GuiEventBus.events.collect {
|
||||
when (it) {
|
||||
GuiEventBus.LocalSession, GuiEventBus.RemoteSession -> {
|
||||
while (isActive) {
|
||||
val result = runCatching { logController.getMaxEventLog() }
|
||||
if (result.isSuccess) {
|
||||
maxLogEvent = result.getOrNull()!!
|
||||
break
|
||||
}
|
||||
}
|
||||
while (isActive) {
|
||||
val result = runCatching { logController.initLogger() }
|
||||
if (result.isSuccess) {
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
GuiEventBus.ChangingSession -> runLater {
|
||||
items.clear()
|
||||
tableView.placeholder = Label("Loading")
|
||||
}
|
||||
|
||||
else -> {}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun openLog(item: LogModel) {
|
||||
|
||||
@@ -269,13 +269,15 @@ class MenuBarView : View() {
|
||||
}
|
||||
}
|
||||
downloadActiveProperty.bind(running.greaterThan(0))
|
||||
|
||||
coroutineScope.launch {
|
||||
actionBarController.onQueueStateUpdate.collect {
|
||||
runLater {
|
||||
running.set(it.running)
|
||||
actionBarController.onQueueStateUpdate.let { flow ->
|
||||
coroutineScope.launch {
|
||||
flow.collect {
|
||||
runLater {
|
||||
running.set(it.running)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -127,32 +127,37 @@ class PostInfoView : View() {
|
||||
}
|
||||
}
|
||||
}
|
||||
coroutineScope.launch {
|
||||
postController.updatePostsFlow.filter {
|
||||
it.id == postModel.id
|
||||
}.collect { post ->
|
||||
runLater {
|
||||
postModel.status = post.status.stringValue.lowercase().replaceFirstChar { it.uppercase() }
|
||||
postModel.progressCount = postController.progressCount(
|
||||
post.total, post.done, post.downloaded
|
||||
)
|
||||
postModel.done = post.done
|
||||
postModel.progress = postController.progress(
|
||||
post.total, post.done
|
||||
)
|
||||
postModel.path = post.getDownloadFolder()
|
||||
postModel.folderName = post.folderName
|
||||
|
||||
postController.updatePostsFlow.let { flow ->
|
||||
coroutineScope.launch {
|
||||
flow.filter {
|
||||
it.id == postModel.id
|
||||
}.collect { post ->
|
||||
runLater {
|
||||
postModel.status = post.status.stringValue.lowercase().replaceFirstChar { it.uppercase() }
|
||||
postModel.progressCount = postController.progressCount(
|
||||
post.total, post.done, post.downloaded
|
||||
)
|
||||
postModel.done = post.done
|
||||
postModel.progress = postController.progress(
|
||||
post.total, post.done
|
||||
)
|
||||
postModel.path = post.getDownloadFolder()
|
||||
postModel.folderName = post.folderName
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
coroutineScope.launch {
|
||||
postController.updateMetadataFlow.filter {
|
||||
it.postIdRef == postModel.id
|
||||
}.collect {
|
||||
runLater {
|
||||
postModel.altTitles = FXCollections.observableArrayList(it.data.resolvedNames)
|
||||
postModel.postedBy = it.data.postedBy
|
||||
postController.updateMetadataFlow.let { flow ->
|
||||
coroutineScope.launch {
|
||||
flow.filter {
|
||||
it.postIdRef == postModel.id
|
||||
}.collect {
|
||||
runLater {
|
||||
postModel.altTitles = FXCollections.observableArrayList(it.data.resolvedNames)
|
||||
postModel.postedBy = it.data.postedBy
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,7 +14,6 @@ import javafx.scene.input.MouseButton
|
||||
import javafx.util.Callback
|
||||
import kotlinx.coroutines.*
|
||||
import kotlinx.coroutines.flow.debounce
|
||||
import kotlinx.coroutines.flow.toList
|
||||
import kotlinx.coroutines.javafx.asFlow
|
||||
import me.vripper.gui.components.Shared
|
||||
import me.vripper.gui.components.cells.PreviewTableCell
|
||||
@@ -51,12 +50,10 @@ class PostsTableView : View() {
|
||||
|
||||
init {
|
||||
items.filterWhen(Shared.searchInput) { query, item ->
|
||||
item.title.contains(query, ignoreCase = true)
|
||||
|| item.vgPostId.toString().contains(query)
|
||||
|| item.vgThreadId.toString().contains(query)
|
||||
|| item.hosts.contains(query, ignoreCase = true)
|
||||
|| item.status.contains(query, ignoreCase = true)
|
||||
|| item.path.contains(query, ignoreCase = true)
|
||||
item.title.contains(query, ignoreCase = true) || item.vgPostId.toString()
|
||||
.contains(query) || item.vgThreadId.toString().contains(query) || item.hosts.contains(
|
||||
query, ignoreCase = true
|
||||
) || item.status.contains(query, ignoreCase = true) || item.path.contains(query, ignoreCase = true)
|
||||
}
|
||||
|
||||
with(root) {
|
||||
@@ -237,8 +234,7 @@ class PostsTableView : View() {
|
||||
preview.cleanup()
|
||||
if (cell.tableRow.item != null && cell.tableRow.item.previewList.isNotEmpty()) {
|
||||
preview.display(
|
||||
cell.tableRow.item.vgThreadId,
|
||||
cell.tableRow.item.previewList
|
||||
cell.tableRow.item.vgThreadId, cell.tableRow.item.previewList
|
||||
)
|
||||
preview.previewPopup.apply {
|
||||
x = mouseEvent.screenX + 20
|
||||
@@ -406,33 +402,9 @@ class PostsTableView : View() {
|
||||
tableView.prefHeightProperty().bind(root.heightProperty())
|
||||
tableView.placeholder = Label("Loading")
|
||||
|
||||
coroutineScope.launch {
|
||||
launch {
|
||||
GuiEventBus.events.collect {
|
||||
when (it) {
|
||||
GuiEventBus.LocalSession, GuiEventBus.RemoteSession -> {
|
||||
val postModelList = postController.findAllPosts().toList()
|
||||
val queueState = postController.getQueueState()
|
||||
runLater {
|
||||
items.addAll(postModelList)
|
||||
tableView.sort()
|
||||
tableView.placeholder = Label("No content in table")
|
||||
updateQueueState(queueState)
|
||||
}
|
||||
}
|
||||
|
||||
GuiEventBus.ChangingSession -> runLater {
|
||||
tableView.placeholder = Label("Loading")
|
||||
items.clear()
|
||||
}
|
||||
|
||||
else -> {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
launch {
|
||||
postController.updateMetadataFlow.collect { metadataEntity ->
|
||||
postController.updateMetadataFlow.let { flow ->
|
||||
coroutineScope.launch {
|
||||
flow.collect { metadataEntity ->
|
||||
runLater {
|
||||
val postModel = items.find { it.id == metadataEntity.postIdRef } ?: return@runLater
|
||||
|
||||
@@ -441,18 +413,22 @@ class PostsTableView : View() {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
launch {
|
||||
postController.deletedPostsFlow.collect {
|
||||
postController.deletedPostsFlow.let { flow ->
|
||||
coroutineScope.launch {
|
||||
flow.collect {
|
||||
runLater {
|
||||
items.items.removeIf { p -> p.id == it }
|
||||
tableView.sort()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
launch {
|
||||
postController.updatePostsFlow.collect { post ->
|
||||
postController.updatePostsFlow.let { flow ->
|
||||
coroutineScope.launch {
|
||||
flow.collect { post ->
|
||||
runLater {
|
||||
val postModel = items.find { it.id == post.id } ?: return@runLater
|
||||
|
||||
@@ -469,15 +445,19 @@ class PostsTableView : View() {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
launch {
|
||||
postController.queueStateUpdate.collect { queueState ->
|
||||
updateQueueState(queueState)
|
||||
postController.queueStateUpdate.let { flow ->
|
||||
coroutineScope.launch {
|
||||
flow.collect {
|
||||
updateQueueState(it)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
launch {
|
||||
postController.newPostsFlow.collect {
|
||||
postController.newPostsFlow.let { flow ->
|
||||
coroutineScope.launch {
|
||||
flow.collect {
|
||||
runLater {
|
||||
items.addAll(it)
|
||||
tableView.sort()
|
||||
@@ -485,6 +465,30 @@ class PostsTableView : View() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
coroutineScope.launch {
|
||||
GuiEventBus.events.collect {
|
||||
when (it) {
|
||||
GuiEventBus.LocalSession, GuiEventBus.RemoteSession -> {
|
||||
val postModelList = postController.findAllPosts()
|
||||
val queueState = postController.getQueueState()
|
||||
runLater {
|
||||
items.addAll(postModelList)
|
||||
tableView.sort()
|
||||
tableView.placeholder = Label("No content in table")
|
||||
updateQueueState(queueState)
|
||||
}
|
||||
}
|
||||
|
||||
GuiEventBus.ChangingSession -> runLater {
|
||||
tableView.placeholder = Label("Loading")
|
||||
items.clear()
|
||||
}
|
||||
|
||||
else -> {}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun updateQueueState(queueState: QueueState) {
|
||||
|
||||
@@ -46,43 +46,53 @@ class StatusBarView : View("Status bar") {
|
||||
}
|
||||
}
|
||||
|
||||
coroutineScope.launch {
|
||||
statusBarController.vgUserUpdate.collect {
|
||||
runLater {
|
||||
loggedUser.set(it)
|
||||
statusBarController.vgUserUpdate.let { flow ->
|
||||
coroutineScope.launch {
|
||||
flow.collect {
|
||||
runLater {
|
||||
loggedUser.set(it)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
coroutineScope.launch {
|
||||
statusBarController.tasksRunning.collect {
|
||||
runLater {
|
||||
tasksRunning.set(it)
|
||||
statusBarController.tasksRunning.let { flow ->
|
||||
coroutineScope.launch {
|
||||
flow.collect {
|
||||
runLater {
|
||||
tasksRunning.set(it)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
coroutineScope.launch {
|
||||
statusBarController.downloadSpeed.collect {
|
||||
runLater {
|
||||
downloadSpeed.set(it.speed.formatSI())
|
||||
statusBarController.downloadSpeed.let { flow ->
|
||||
coroutineScope.launch {
|
||||
flow.collect {
|
||||
runLater {
|
||||
downloadSpeed.set(it.speed.formatSI())
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
coroutineScope.launch {
|
||||
statusBarController.queueStateUpdate.collect {
|
||||
runLater {
|
||||
running.set(it.running)
|
||||
pending.set(it.remaining)
|
||||
statusBarController.queueStateUpdate.let { flow ->
|
||||
coroutineScope.launch {
|
||||
flow.collect {
|
||||
runLater {
|
||||
running.set(it.running)
|
||||
pending.set(it.remaining)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
coroutineScope.launch {
|
||||
statusBarController.errorCountUpdate.collect {
|
||||
runLater {
|
||||
error.set(it.count)
|
||||
statusBarController.errorCountUpdate.let { flow ->
|
||||
coroutineScope.launch {
|
||||
flow.collect {
|
||||
runLater {
|
||||
error.set(it.count)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,7 +11,6 @@ import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.SupervisorJob
|
||||
import kotlinx.coroutines.flow.debounce
|
||||
import kotlinx.coroutines.flow.toList
|
||||
import kotlinx.coroutines.javafx.asFlow
|
||||
import kotlinx.coroutines.launch
|
||||
import me.vripper.gui.components.fragments.ThreadSelectionTableFragment
|
||||
@@ -156,40 +155,19 @@ class ThreadTableView : View() {
|
||||
tableView.prefHeightProperty().bind(root.heightProperty())
|
||||
tableView.placeholder = Label("Loading")
|
||||
|
||||
|
||||
coroutineScope.launch {
|
||||
launch {
|
||||
GuiEventBus.events.collect {
|
||||
when (it) {
|
||||
GuiEventBus.LocalSession, GuiEventBus.RemoteSession -> {
|
||||
val list = threadController.findAll().toList()
|
||||
runLater {
|
||||
items.clear()
|
||||
items.addAll(list)
|
||||
tableView.placeholder = Label("No content in table")
|
||||
}
|
||||
}
|
||||
|
||||
GuiEventBus.ChangingSession -> runLater {
|
||||
tableView.placeholder = Label("Loading")
|
||||
items.clear()
|
||||
}
|
||||
|
||||
else -> {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
launch {
|
||||
threadController.newThread.collect {
|
||||
threadController.newThread.let { flow ->
|
||||
coroutineScope.launch {
|
||||
flow.collect {
|
||||
runLater {
|
||||
items.add(it)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
launch {
|
||||
threadController.updateThread.collect { thread ->
|
||||
threadController.updateThread.let { flow ->
|
||||
coroutineScope.launch {
|
||||
flow.collect { thread ->
|
||||
runLater {
|
||||
val threadModel = items.find { it.threadId == thread.threadId } ?: return@runLater
|
||||
threadModel.total = thread.total
|
||||
@@ -197,23 +175,49 @@ class ThreadTableView : View() {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
launch {
|
||||
threadController.deleteThread.collect { threadId ->
|
||||
threadController.deleteThread.let { flow ->
|
||||
coroutineScope.launch {
|
||||
flow.collect { threadId ->
|
||||
runLater {
|
||||
tableView.items.removeIf { it.threadId == threadId }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
launch {
|
||||
threadController.clearThreads.collect {
|
||||
threadController.clearThreads.let {
|
||||
coroutineScope.launch {
|
||||
it.collect {
|
||||
runLater {
|
||||
tableView.items.clear()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
coroutineScope.launch {
|
||||
GuiEventBus.events.collect {
|
||||
when (it) {
|
||||
GuiEventBus.LocalSession, GuiEventBus.RemoteSession -> {
|
||||
val list = threadController.findAll()
|
||||
runLater {
|
||||
items.clear()
|
||||
items.addAll(list)
|
||||
tableView.placeholder = Label("No content in table")
|
||||
}
|
||||
}
|
||||
|
||||
GuiEventBus.ChangingSession -> runLater {
|
||||
tableView.placeholder = Label("Loading")
|
||||
items.clear()
|
||||
}
|
||||
|
||||
else -> {}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun isCurrentTab(): Boolean = mainView.root.selectionModel.selectedItem.id == "thread-tab"
|
||||
|
||||
@@ -1,13 +1,11 @@
|
||||
package me.vripper.gui.controller
|
||||
|
||||
import kotlinx.coroutines.flow.Flow
|
||||
import kotlinx.coroutines.flow.map
|
||||
import me.vripper.gui.model.PostModel
|
||||
import me.vripper.gui.utils.AppEndpointManager.currentAppEndpointService
|
||||
import me.vripper.gui.utils.AppEndpointManager.localAppEndpointService
|
||||
import me.vripper.gui.utils.AppEndpointManager.remoteAppEndpointService
|
||||
import me.vripper.gui.utils.ChannelFlowBuilder
|
||||
import me.vripper.gui.utils.ChannelFlowBuilder.toFlow
|
||||
import me.vripper.model.Post
|
||||
import me.vripper.model.QueueState
|
||||
import me.vripper.services.download.MovePosition
|
||||
@@ -85,8 +83,8 @@ class PostController : Controller() {
|
||||
return runCatching { mapper(currentAppEndpointService().findPost(postEntityId)) }.getOrNull()
|
||||
}
|
||||
|
||||
fun findAllPosts(): Flow<PostModel> {
|
||||
return toFlow { currentAppEndpointService().findAllPosts().map(::mapper) }
|
||||
suspend fun findAllPosts(): List<PostModel> {
|
||||
return currentAppEndpointService().findAllPosts().map(::mapper)
|
||||
}
|
||||
|
||||
suspend fun getQueueState(): QueueState {
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package me.vripper.gui.controller
|
||||
|
||||
import kotlinx.coroutines.flow.Flow
|
||||
import kotlinx.coroutines.flow.map
|
||||
import me.vripper.entities.ThreadEntity
|
||||
import me.vripper.gui.model.ThreadModel
|
||||
@@ -9,7 +8,6 @@ import me.vripper.gui.utils.AppEndpointManager.currentAppEndpointService
|
||||
import me.vripper.gui.utils.AppEndpointManager.localAppEndpointService
|
||||
import me.vripper.gui.utils.AppEndpointManager.remoteAppEndpointService
|
||||
import me.vripper.gui.utils.ChannelFlowBuilder
|
||||
import me.vripper.gui.utils.ChannelFlowBuilder.toFlow
|
||||
import me.vripper.model.ThreadPostId
|
||||
import org.koin.core.component.KoinComponent
|
||||
import tornadofx.Controller
|
||||
@@ -40,8 +38,8 @@ class ThreadController : KoinComponent, Controller() {
|
||||
remoteAppEndpointService::onClearThreads,
|
||||
)
|
||||
|
||||
fun findAll(): Flow<ThreadModel> {
|
||||
return toFlow { currentAppEndpointService().findAllThreads().map(::threadModelMapper) }
|
||||
suspend fun findAll(): List<ThreadModel> {
|
||||
return currentAppEndpointService().findAllThreads().map(::threadModelMapper)
|
||||
}
|
||||
|
||||
private fun threadModelMapper(it: ThreadEntity): ThreadModel {
|
||||
|
||||
@@ -44,10 +44,4 @@ object ChannelFlowBuilder {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun <T> toFlow(source: suspend () -> List<T>): Flow<T> {
|
||||
return channelFlow {
|
||||
source().forEach { if (isActive) send(it) }
|
||||
}.retryWhen { _, _ -> delay(1000); true }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,11 +15,12 @@ object ClipboardManager : KoinComponent {
|
||||
private var coroutineScope = CoroutineScope(SupervisorJob() + Dispatchers.IO)
|
||||
private var pollJob: Job? = null
|
||||
private var settingsUpdateJob: Job? = null
|
||||
private val systemClipboard = Clipboard.getSystemClipboard()
|
||||
|
||||
fun init() {
|
||||
coroutineScope.launch {
|
||||
GuiEventBus.events.collect {
|
||||
when (it) {
|
||||
GuiEventBus.events.collect { event ->
|
||||
when (event) {
|
||||
GuiEventBus.LocalSession, GuiEventBus.RemoteSession -> {
|
||||
logger.info("Clipboard manager initialized")
|
||||
while (isActive) {
|
||||
@@ -53,9 +54,8 @@ object ClipboardManager : KoinComponent {
|
||||
var value: String? = null
|
||||
while (isActive) {
|
||||
runLater {
|
||||
val clipboard = Clipboard.getSystemClipboard()
|
||||
if (clipboard.hasString()) {
|
||||
value = clipboard.string
|
||||
if (systemClipboard.hasString()) {
|
||||
value = systemClipboard.string
|
||||
}
|
||||
}
|
||||
if (!value.isNullOrBlank() && value != current) {
|
||||
|
||||
@@ -56,12 +56,6 @@ object PreviewCacheManager : KoinComponent {
|
||||
init {
|
||||
coroutineScope.launch {
|
||||
while (isActive) {
|
||||
// println("Cache state check")
|
||||
// println("Cache entries = ${entries.size}")
|
||||
// println("Cache entries limit = $MAX_ENTRIES")
|
||||
// println("Cache size = ${cacheSize.get().formatSI()}")
|
||||
// println("Cache size LIMIT = ${THRESHOLD.formatSI()}")
|
||||
|
||||
val entriesDelta = entries.size - MAX_ENTRIES
|
||||
if (entriesDelta > 0) {
|
||||
val deleted = mutableListOf<Entry>()
|
||||
@@ -85,8 +79,6 @@ object PreviewCacheManager : KoinComponent {
|
||||
cacheSize.addAndGet(element.size * -1L)
|
||||
} while (cacheSize.get() - THRESHOLD > 0)
|
||||
}
|
||||
|
||||
// println("Cache state check completed")
|
||||
delay(30_000)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user