diff --git a/src/main/kotlin/suwayomi/tachidesk/launcher/LauncherViewModel.kt b/src/main/kotlin/suwayomi/tachidesk/launcher/LauncherViewModel.kt index 4b6ac4f..55dce6a 100644 --- a/src/main/kotlin/suwayomi/tachidesk/launcher/LauncherViewModel.kt +++ b/src/main/kotlin/suwayomi/tachidesk/launcher/LauncherViewModel.kt @@ -136,9 +136,9 @@ class LauncherViewModel { null, arrayOf( "Cancel", - "Continue" + "Continue", ), - 1 + 1, ) when (option) { 0 -> { diff --git a/src/main/kotlin/suwayomi/tachidesk/launcher/Main.kt b/src/main/kotlin/suwayomi/tachidesk/launcher/Main.kt index 70fc983..fd82c7c 100644 --- a/src/main/kotlin/suwayomi/tachidesk/launcher/Main.kt +++ b/src/main/kotlin/suwayomi/tachidesk/launcher/Main.kt @@ -59,9 +59,9 @@ suspend fun main(args: Array) { arrayOf( "Copy", "Reset", - "Close" + "Close", ), - 1 + 1, ) when (option) { 0 -> { @@ -168,6 +168,6 @@ fun setupTheme(vm: LauncherViewModel) { vm.theme.value = Base64.getEncoder().encodeToString(it.toByteArray()) } } - } + }, ) } diff --git a/src/main/kotlin/suwayomi/tachidesk/launcher/SwingDsl.kt b/src/main/kotlin/suwayomi/tachidesk/launcher/SwingDsl.kt index a51fa3d..17581c3 100644 --- a/src/main/kotlin/suwayomi/tachidesk/launcher/SwingDsl.kt +++ b/src/main/kotlin/suwayomi/tachidesk/launcher/SwingDsl.kt @@ -57,7 +57,7 @@ inline fun jframe( title: String? = null, graphicsConfiguration: GraphicsConfiguration? = null, isVisible: Boolean = true, - builder: JFrame.() -> Unit + builder: JFrame.() -> Unit, ): JFrame { return JFrame(title, graphicsConfiguration).apply { builder() @@ -71,7 +71,7 @@ inline fun jframe( inline fun jpanel( layoutManager: LayoutManager = FlowLayout(), isDoubleBuffered: Boolean = true, - builder: JPanel.() -> Unit + builder: JPanel.() -> Unit, ): JPanel { return JPanel(layoutManager, isDoubleBuffered).apply { builder() @@ -83,7 +83,7 @@ inline fun jpanel( inline fun jTabbedPane( tabPlacement: Int = JTabbedPane.TOP, tabLayoutPolicy: Int = JTabbedPane.WRAP_TAB_LAYOUT, - builder: JTabbedPane.() -> Unit + builder: JTabbedPane.() -> Unit, ): JTabbedPane { return JTabbedPane(tabPlacement, tabLayoutPolicy).apply { builder() @@ -152,7 +152,7 @@ inline fun jPasswordField(text: String? = null, columns: Int = 0, document: Docu inline fun jComboBox( items: Array? = null, model: ComboBoxModel? = null, - builder: JComboBox.() -> Unit + builder: JComboBox.() -> Unit, ): JComboBox { require(items != null || model != null) { "Both items and model were null" } return JComboBox(model ?: DefaultComboBoxModel(items)).apply { diff --git a/src/main/kotlin/suwayomi/tachidesk/launcher/config/ConfigManager.kt b/src/main/kotlin/suwayomi/tachidesk/launcher/config/ConfigManager.kt index 4a0c12b..da588c6 100644 --- a/src/main/kotlin/suwayomi/tachidesk/launcher/config/ConfigManager.kt +++ b/src/main/kotlin/suwayomi/tachidesk/launcher/config/ConfigManager.kt @@ -27,7 +27,7 @@ import kotlin.io.path.writeText class ConfigManager( private val tachideskServer: Path, - rootDir: String + rootDir: String, ) { private val userConfigFile = getServerConf(rootDir) @@ -107,7 +107,7 @@ class ConfigManager( fun resetConfig( tachideskServer: Path, - rootDir: String + rootDir: String, ) { val userConfigFile = getServerConf(rootDir) userConfigFile.createParentDirectories().writeText(getDefaultConfig(tachideskServer)) diff --git a/src/main/kotlin/suwayomi/tachidesk/launcher/config/ServerConfig.kt b/src/main/kotlin/suwayomi/tachidesk/launcher/config/ServerConfig.kt index a8adbe6..6870f21 100644 --- a/src/main/kotlin/suwayomi/tachidesk/launcher/config/ServerConfig.kt +++ b/src/main/kotlin/suwayomi/tachidesk/launcher/config/ServerConfig.kt @@ -18,7 +18,7 @@ import kotlin.reflect.KProperty class ServerConfig( private val scope: CoroutineScope, - private val configManager: ConfigManager + private val configManager: ConfigManager, ) { inner class OverrideConfigValue(private val configAdapter: ConfigAdapter) : ReadOnlyProperty> { diff --git a/src/main/kotlin/suwayomi/tachidesk/launcher/settings/Adapters.kt b/src/main/kotlin/suwayomi/tachidesk/launcher/settings/Adapters.kt index 6b1e565..c017c48 100644 --- a/src/main/kotlin/suwayomi/tachidesk/launcher/settings/Adapters.kt +++ b/src/main/kotlin/suwayomi/tachidesk/launcher/settings/Adapters.kt @@ -86,7 +86,7 @@ object StringOrNullAdapter : Adapter { class SerializableAdapter( private val serialize: (E) -> String, - private val deserialize: (String) -> E + private val deserialize: (String) -> E, ) : Adapter { override fun get(settings: ObservableSettings, key: String, default: E) = settings.getStringOrNull(key)?.let { deserialize(it) } ?: default diff --git a/src/main/kotlin/suwayomi/tachidesk/launcher/settings/LauncherPreference.kt b/src/main/kotlin/suwayomi/tachidesk/launcher/settings/LauncherPreference.kt index 5d8bb99..ad306b1 100644 --- a/src/main/kotlin/suwayomi/tachidesk/launcher/settings/LauncherPreference.kt +++ b/src/main/kotlin/suwayomi/tachidesk/launcher/settings/LauncherPreference.kt @@ -21,7 +21,7 @@ open class LauncherPreference( private val key: String, private val default: T, private val settings: ObservableSettings, - private val adapter: Adapter + private val adapter: Adapter, ) { fun get(): T { diff --git a/src/main/kotlin/suwayomi/tachidesk/launcher/settings/LauncherSettings.kt b/src/main/kotlin/suwayomi/tachidesk/launcher/settings/LauncherSettings.kt index 3204371..b7252d7 100644 --- a/src/main/kotlin/suwayomi/tachidesk/launcher/settings/LauncherSettings.kt +++ b/src/main/kotlin/suwayomi/tachidesk/launcher/settings/LauncherSettings.kt @@ -13,24 +13,24 @@ import java.util.prefs.Preferences class LauncherSettings { private val settings = PreferencesSettings( - Preferences.userRoot().node("suwayomi/launcher") + Preferences.userRoot().node("suwayomi/launcher"), ) enum class WebUIFlavor { WebUI, VUI, - Custom + Custom, } enum class WebUIInterface { Browser, - Electron + Electron, } enum class WebUIChannel { Stable, Preview, - Bundled + Bundled, } // Directories @@ -40,7 +40,7 @@ class LauncherSettings { "root", null, settings, - StringOrNullAdapter + StringOrNullAdapter, ) } @@ -50,7 +50,7 @@ class LauncherSettings { "theme", null, settings, - StringOrNullAdapter + StringOrNullAdapter, ) } diff --git a/src/main/kotlin/suwayomi/tachidesk/launcher/ui/Backup.kt b/src/main/kotlin/suwayomi/tachidesk/launcher/ui/Backup.kt index 8d4577d..56122a7 100644 --- a/src/main/kotlin/suwayomi/tachidesk/launcher/ui/Backup.kt +++ b/src/main/kotlin/suwayomi/tachidesk/launcher/ui/Backup.kt @@ -43,8 +43,8 @@ import kotlin.io.path.isWritable fun Backup(vm: LauncherViewModel, scope: CoroutineScope) = jpanel( MigLayout( - LC().alignX("center").alignY("center") - ) + LC().alignX("center").alignY("center"), + ), ) { jTextArea("Backups path") { isEditable = false @@ -56,7 +56,7 @@ fun Backup(vm: LauncherViewModel, scope: CoroutineScope) = jpanel( .combine( keyListener() .filterIsInstance() - .filter { it.event?.keyCode == KeyEvent.VK_ENTER } + .filter { it.event?.keyCode == KeyEvent.VK_ENTER }, ) { _, _ -> } .map { text?.trim() diff --git a/src/main/kotlin/suwayomi/tachidesk/launcher/ui/BasicAuth.kt b/src/main/kotlin/suwayomi/tachidesk/launcher/ui/BasicAuth.kt index f6d6ceb..fadd8eb 100644 --- a/src/main/kotlin/suwayomi/tachidesk/launcher/ui/BasicAuth.kt +++ b/src/main/kotlin/suwayomi/tachidesk/launcher/ui/BasicAuth.kt @@ -30,8 +30,8 @@ import suwayomi.tachidesk.launcher.keyListener fun BasicAuth(vm: LauncherViewModel, scope: CoroutineScope) = jpanel( MigLayout( - LC().alignX("center").alignY("center") - ) + LC().alignX("center").alignY("center"), + ), ) { jCheckBox("Basic Authentication", selected = vm.basicAuthEnabled.value) { // todo toolTipText = "" diff --git a/src/main/kotlin/suwayomi/tachidesk/launcher/ui/Cloudflare.kt b/src/main/kotlin/suwayomi/tachidesk/launcher/ui/Cloudflare.kt index 4e785aa..b81f845 100644 --- a/src/main/kotlin/suwayomi/tachidesk/launcher/ui/Cloudflare.kt +++ b/src/main/kotlin/suwayomi/tachidesk/launcher/ui/Cloudflare.kt @@ -34,8 +34,8 @@ import javax.swing.SpinnerNumberModel fun Cloudflare(vm: LauncherViewModel, scope: CoroutineScope) = jpanel( MigLayout( - LC().alignX("center").alignY("center") - ) + LC().alignX("center").alignY("center"), + ), ) { jCheckBox("Use FlareSolverr", selected = vm.flareSolverrEnabled.value) { toolTipText = "Use FlareSolverr instance to bypass Cloudflare." // todo improve diff --git a/src/main/kotlin/suwayomi/tachidesk/launcher/ui/Downloader.kt b/src/main/kotlin/suwayomi/tachidesk/launcher/ui/Downloader.kt index e5e38b1..09e0124 100644 --- a/src/main/kotlin/suwayomi/tachidesk/launcher/ui/Downloader.kt +++ b/src/main/kotlin/suwayomi/tachidesk/launcher/ui/Downloader.kt @@ -44,8 +44,8 @@ import kotlin.io.path.isWritable fun Downloader(vm: LauncherViewModel, scope: CoroutineScope) = jpanel( MigLayout( - LC().alignX("center").alignY("center") - ) + LC().alignX("center").alignY("center"), + ), ) { jCheckBox("Download as CBZ", selected = vm.downloadAsCbz.value) { toolTipText = "Download chapters as CBZ files." // todo improve @@ -66,7 +66,7 @@ fun Downloader(vm: LauncherViewModel, scope: CoroutineScope) = jpanel( .combine( keyListener() .filterIsInstance() - .filter { it.event?.keyCode == KeyEvent.VK_ENTER } + .filter { it.event?.keyCode == KeyEvent.VK_ENTER }, ) { _, _ -> } .map { text?.trim() diff --git a/src/main/kotlin/suwayomi/tachidesk/launcher/ui/Extension.kt b/src/main/kotlin/suwayomi/tachidesk/launcher/ui/Extension.kt index ffdef90..2b71fd4 100644 --- a/src/main/kotlin/suwayomi/tachidesk/launcher/ui/Extension.kt +++ b/src/main/kotlin/suwayomi/tachidesk/launcher/ui/Extension.kt @@ -39,8 +39,8 @@ private val repoMatchRegex = fun Extension(vm: LauncherViewModel, scope: CoroutineScope) = jpanel( MigLayout( - LC().alignX("center").alignY("center") - ) + LC().alignX("center").alignY("center"), + ), ) { jTextArea("Extension repos") { isEditable = false diff --git a/src/main/kotlin/suwayomi/tachidesk/launcher/ui/LocalSource.kt b/src/main/kotlin/suwayomi/tachidesk/launcher/ui/LocalSource.kt index 67fbfaa..c29efdd 100644 --- a/src/main/kotlin/suwayomi/tachidesk/launcher/ui/LocalSource.kt +++ b/src/main/kotlin/suwayomi/tachidesk/launcher/ui/LocalSource.kt @@ -40,8 +40,8 @@ import kotlin.io.path.isWritable fun LocalSource(vm: LauncherViewModel, scope: CoroutineScope) = jpanel( MigLayout( - LC().alignX("center").alignY("center") - ) + LC().alignX("center").alignY("center"), + ), ) { jTextArea("Local Source path") { isEditable = false @@ -53,7 +53,7 @@ fun LocalSource(vm: LauncherViewModel, scope: CoroutineScope) = jpanel( .combine( keyListener() .filterIsInstance() - .filter { it.event?.keyCode == KeyEvent.VK_ENTER } + .filter { it.event?.keyCode == KeyEvent.VK_ENTER }, ) { _, _ -> } .map { text?.trim() diff --git a/src/main/kotlin/suwayomi/tachidesk/launcher/ui/Misc.kt b/src/main/kotlin/suwayomi/tachidesk/launcher/ui/Misc.kt index 787a7f6..d0ca82e 100644 --- a/src/main/kotlin/suwayomi/tachidesk/launcher/ui/Misc.kt +++ b/src/main/kotlin/suwayomi/tachidesk/launcher/ui/Misc.kt @@ -24,8 +24,8 @@ import suwayomi.tachidesk.launcher.jpanel fun Misc(vm: LauncherViewModel, scope: CoroutineScope) = jpanel( MigLayout( - LC().alignX("center").alignY("center") - ) + LC().alignX("center").alignY("center"), + ), ) { jCheckBox("Debug logging", selected = vm.debug.value) { toolTipText = "Use this to toggle extra logging to the console window to help debug issues." // todo improve diff --git a/src/main/kotlin/suwayomi/tachidesk/launcher/ui/Requests.kt b/src/main/kotlin/suwayomi/tachidesk/launcher/ui/Requests.kt index e63168a..1d78593 100644 --- a/src/main/kotlin/suwayomi/tachidesk/launcher/ui/Requests.kt +++ b/src/main/kotlin/suwayomi/tachidesk/launcher/ui/Requests.kt @@ -26,8 +26,8 @@ import javax.swing.SpinnerNumberModel fun Requests(vm: LauncherViewModel, scope: CoroutineScope) = jpanel( MigLayout( - LC().alignX("center").alignY("center") - ) + LC().alignX("center").alignY("center"), + ), ) { jTextArea("Max Parallel Source Requests") { isEditable = false diff --git a/src/main/kotlin/suwayomi/tachidesk/launcher/ui/RootDir.kt b/src/main/kotlin/suwayomi/tachidesk/launcher/ui/RootDir.kt index 688b47a..5c6c64d 100644 --- a/src/main/kotlin/suwayomi/tachidesk/launcher/ui/RootDir.kt +++ b/src/main/kotlin/suwayomi/tachidesk/launcher/ui/RootDir.kt @@ -40,8 +40,8 @@ import kotlin.io.path.isWritable fun RootDir(vm: LauncherViewModel, scope: CoroutineScope) = jpanel( MigLayout( - LC().alignX("center").alignY("center") - ) + LC().alignX("center").alignY("center"), + ), ) { jTextArea("Root path") { isEditable = false @@ -53,7 +53,7 @@ fun RootDir(vm: LauncherViewModel, scope: CoroutineScope) = jpanel( .combine( keyListener() .filterIsInstance() - .filter { it.event?.keyCode == KeyEvent.VK_ENTER } + .filter { it.event?.keyCode == KeyEvent.VK_ENTER }, ) { _, _ -> } .map { text?.trim() diff --git a/src/main/kotlin/suwayomi/tachidesk/launcher/ui/ServerIpAndPortBindings.kt b/src/main/kotlin/suwayomi/tachidesk/launcher/ui/ServerIpAndPortBindings.kt index 379ae49..08e2c62 100644 --- a/src/main/kotlin/suwayomi/tachidesk/launcher/ui/ServerIpAndPortBindings.kt +++ b/src/main/kotlin/suwayomi/tachidesk/launcher/ui/ServerIpAndPortBindings.kt @@ -29,8 +29,8 @@ import javax.swing.SpinnerNumberModel fun ServerIpAndPortBindings(vm: LauncherViewModel, scope: CoroutineScope) = jpanel( MigLayout( - LC().alignX("center").alignY("center") - ) + LC().alignX("center").alignY("center"), + ), ) { /* TODO diff --git a/src/main/kotlin/suwayomi/tachidesk/launcher/ui/SocksProxy.kt b/src/main/kotlin/suwayomi/tachidesk/launcher/ui/SocksProxy.kt index 6724287..c82d4b4 100644 --- a/src/main/kotlin/suwayomi/tachidesk/launcher/ui/SocksProxy.kt +++ b/src/main/kotlin/suwayomi/tachidesk/launcher/ui/SocksProxy.kt @@ -33,8 +33,8 @@ import javax.swing.SpinnerNumberModel fun Socks5(vm: LauncherViewModel, scope: CoroutineScope) = jpanel( MigLayout( - LC().alignX("center").alignY("center") - ) + LC().alignX("center").alignY("center"), + ), ) { jCheckBox("Socks Proxy", selected = vm.socksProxyEnabled.value) { // todo toolTipText = "" diff --git a/src/main/kotlin/suwayomi/tachidesk/launcher/ui/Updater.kt b/src/main/kotlin/suwayomi/tachidesk/launcher/ui/Updater.kt index 2148202..2977a39 100644 --- a/src/main/kotlin/suwayomi/tachidesk/launcher/ui/Updater.kt +++ b/src/main/kotlin/suwayomi/tachidesk/launcher/ui/Updater.kt @@ -28,8 +28,8 @@ import javax.swing.SpinnerNumberModel fun Updater(vm: LauncherViewModel, scope: CoroutineScope) = jpanel( MigLayout( - LC().alignX("center").alignY("center") - ) + LC().alignX("center").alignY("center"), + ), ) { jCheckBox("Exclude unread chapters", selected = vm.excludeUnreadChapters.value) { // todo toolTipText = "" diff --git a/src/main/kotlin/suwayomi/tachidesk/launcher/ui/WebUI.kt b/src/main/kotlin/suwayomi/tachidesk/launcher/ui/WebUI.kt index c402fcb..69cfd52 100644 --- a/src/main/kotlin/suwayomi/tachidesk/launcher/ui/WebUI.kt +++ b/src/main/kotlin/suwayomi/tachidesk/launcher/ui/WebUI.kt @@ -37,8 +37,8 @@ import javax.swing.UIManager fun WebUI(vm: LauncherViewModel, scope: CoroutineScope) = jpanel( MigLayout( - LC().alignX("center").alignY("center") - ) + LC().alignX("center").alignY("center"), + ), ) { jCheckBox("WebUI", selected = vm.webUIEnabled.value) { // todo toolTipText = "" diff --git a/src/main/kotlin/suwayomi/tachidesk/launcher/util/PortUsage.kt b/src/main/kotlin/suwayomi/tachidesk/launcher/util/PortUsage.kt index 55b6ae4..438e769 100644 --- a/src/main/kotlin/suwayomi/tachidesk/launcher/util/PortUsage.kt +++ b/src/main/kotlin/suwayomi/tachidesk/launcher/util/PortUsage.kt @@ -17,7 +17,7 @@ import java.util.concurrent.TimeUnit suspend fun checkIfPortInUse( ip: String, - port: Int + port: Int, ): Boolean { val appIP = if (ip == "0.0.0.0") "127.0.0.1" else ip @@ -32,7 +32,7 @@ suspend fun checkIfPortInUse( Request.Builder() .get() .url("http://$appIP:$port/api/v1/settings/about/") - .build() + .build(), ).execute().body.string() } return true