mirror of
https://github.com/TermoraDev/termora.git
synced 2026-01-15 18:02:58 +08:00
fix: SSH timeout is always 30 seconds
This commit is contained in:
@@ -23,6 +23,7 @@ open class BasicTerminalOption() : JPanel(BorderLayout()), Option {
|
||||
var showCharsetComboBox: Boolean = false
|
||||
var showStartupCommandTextField: Boolean = false
|
||||
var showHeartbeatIntervalTextField: Boolean = false
|
||||
var showTimeoutTextField: Boolean = false
|
||||
var showEnvironmentTextArea: Boolean = false
|
||||
var showLoginScripts: Boolean = false
|
||||
var showBackspaceComboBox: Boolean = false
|
||||
@@ -34,6 +35,7 @@ open class BasicTerminalOption() : JPanel(BorderLayout()), Option {
|
||||
val charsetComboBox = JComboBox<String>()
|
||||
val startupCommandTextField = OutlineTextField()
|
||||
val heartbeatIntervalTextField = IntSpinner(60, minimum = 3, maximum = Int.MAX_VALUE)
|
||||
val timeoutTextField = IntSpinner(60, minimum = 10, maximum = Int.MAX_VALUE)
|
||||
val environmentTextArea = FixedLengthTextArea(2048)
|
||||
val loginScripts = mutableListOf<LoginScript>()
|
||||
val backspaceComboBox = JComboBox<Backspace>()
|
||||
@@ -173,7 +175,7 @@ open class BasicTerminalOption() : JPanel(BorderLayout()), Option {
|
||||
private fun getCenterComponent(): JComponent {
|
||||
val layout = FormLayout(
|
||||
"left:pref, $FORM_MARGIN, default:grow",
|
||||
"pref, $FORM_MARGIN, pref, $FORM_MARGIN, pref, $FORM_MARGIN, pref, $FORM_MARGIN, pref, $FORM_MARGIN, pref, $FORM_MARGIN, pref, $FORM_MARGIN, pref, $FORM_MARGIN, pref"
|
||||
"pref, $FORM_MARGIN, pref, $FORM_MARGIN, pref, $FORM_MARGIN, pref, $FORM_MARGIN, pref, $FORM_MARGIN, pref, $FORM_MARGIN, pref, $FORM_MARGIN, pref, $FORM_MARGIN, pref, $FORM_MARGIN, pref"
|
||||
)
|
||||
|
||||
val accountOwner = this.accountOwner
|
||||
@@ -210,6 +212,11 @@ open class BasicTerminalOption() : JPanel(BorderLayout()), Option {
|
||||
.add(characterAtATimeTextField).xy(3, rows).apply { rows += step }
|
||||
}
|
||||
|
||||
if (showTimeoutTextField) {
|
||||
builder.add("${I18n.getString("termora.new-host.terminal.timeout")}:").xy(1, rows)
|
||||
.add(timeoutTextField).xy(3, rows).apply { rows += step }
|
||||
}
|
||||
|
||||
if (showHeartbeatIntervalTextField) {
|
||||
builder.add("${I18n.getString("termora.new-host.terminal.heartbeat-interval")}:").xy(1, rows)
|
||||
.add(heartbeatIntervalTextField).xy(3, rows).apply { rows += step }
|
||||
@@ -220,14 +227,12 @@ open class BasicTerminalOption() : JPanel(BorderLayout()), Option {
|
||||
.add(startupCommandTextField).xy(3, rows).apply { rows += step }
|
||||
}
|
||||
|
||||
|
||||
if (showEnvironmentTextArea) {
|
||||
builder.add("${I18n.getString("termora.new-host.terminal.env")}:").xy(1, rows)
|
||||
.add(JScrollPane(environmentTextArea).apply { border = FlatTextBorder() }).xy(3, rows)
|
||||
.apply { rows += step }
|
||||
}
|
||||
|
||||
|
||||
return builder.build()
|
||||
}
|
||||
|
||||
|
||||
@@ -38,6 +38,7 @@ internal class SSHHostOptionsPane(private val accountOwner: AccountOwner) : Opti
|
||||
showEnvironmentTextArea = true
|
||||
showStartupCommandTextField = true
|
||||
showHeartbeatIntervalTextField = true
|
||||
showTimeoutTextField = true
|
||||
showHighlightSet = true
|
||||
accountOwner = this@SSHHostOptionsPane.accountOwner
|
||||
init()
|
||||
@@ -113,6 +114,7 @@ internal class SSHHostOptionsPane(private val accountOwner: AccountOwner) : Opti
|
||||
?: AltKeyModifier.EightBit.name),
|
||||
"keywordHighlightSetId" to ((terminalOption.highlightSetComboBox.selectedItem as? KeywordHighlight)?.id
|
||||
?: "-1"),
|
||||
"timeout" to (terminalOption.timeoutTextField.value ?: 60).toString()
|
||||
)
|
||||
)
|
||||
|
||||
@@ -163,6 +165,10 @@ internal class SSHHostOptionsPane(private val accountOwner: AccountOwner) : Opti
|
||||
.getOrNull() ?: AltKeyModifier.EightBit
|
||||
|
||||
|
||||
val timeout = host.options.extras["timeout"] ?: "60"
|
||||
terminalOption.timeoutTextField.value = timeout.toIntOrNull() ?: 60
|
||||
|
||||
|
||||
val keywordHighlightSetId = host.options.extras["keywordHighlightSetId"]
|
||||
for (i in 0 until terminalOption.highlightSetComboBox.itemCount) {
|
||||
val item = terminalOption.highlightSetComboBox.getItemAt(i)
|
||||
|
||||
@@ -88,7 +88,6 @@ object SshClients {
|
||||
|
||||
val HOST_KEY = AttributeRepository.AttributeKey<Host>()
|
||||
|
||||
private val timeout = Duration.ofSeconds(30)
|
||||
private val hostManager get() = HostManager.Companion.getInstance()
|
||||
private val log by lazy { LoggerFactory.getLogger(SshClients::class.java) }
|
||||
|
||||
@@ -101,6 +100,7 @@ object SshClients {
|
||||
session: ClientSession,
|
||||
): ChannelShell {
|
||||
|
||||
val timeout = Duration.ofSeconds(host.options.extras["timeout"]?.toLongOrNull() ?: 60)
|
||||
|
||||
val configuration = PtyChannelConfiguration()
|
||||
configuration.ptyColumns = size.cols
|
||||
@@ -136,6 +136,7 @@ object SshClients {
|
||||
command: String
|
||||
): Pair<Int, String> {
|
||||
|
||||
val timeout = Duration.ofSeconds(60)
|
||||
val baos = ByteArrayOutputStream()
|
||||
val channel = session.createExecChannel(command)
|
||||
channel.out = baos
|
||||
@@ -248,6 +249,7 @@ object SshClients {
|
||||
}
|
||||
}
|
||||
|
||||
val timeout = Duration.ofSeconds(host.options.extras["timeout"]?.toLongOrNull() ?: 60)
|
||||
val session = client.connect(entry).verify(timeout).session
|
||||
if (host.authentication.type == AuthenticationType.Password) {
|
||||
if (StringUtils.isNotBlank(host.authentication.password))
|
||||
|
||||
@@ -183,6 +183,7 @@ termora.new-host.terminal.encoding=Encoding
|
||||
termora.new-host.terminal.backspace=Backspace
|
||||
termora.new-host.terminal.character-mode=Character-at-a-time
|
||||
termora.new-host.terminal.heartbeat-interval=Heartbeat Interval
|
||||
termora.new-host.terminal.timeout=Timeout
|
||||
termora.new-host.terminal.startup-commands=Startup Command
|
||||
termora.new-host.terminal.alt-modifier=Alt modifier
|
||||
termora.new-host.terminal.alt-modifier.eight-bit=8-bit characters
|
||||
|
||||
@@ -163,6 +163,7 @@ termora.new-host.proxy=Прокси
|
||||
termora.new-host.terminal=${termora.settings.terminal}
|
||||
termora.new-host.terminal.encoding=Кодировка
|
||||
termora.new-host.terminal.heartbeat-interval=Интервал опроса
|
||||
termora.new-host.terminal.timeout=Тайм-аут
|
||||
termora.new-host.terminal.startup-commands=Команда запуска
|
||||
termora.new-host.terminal.env=переменные
|
||||
|
||||
|
||||
@@ -176,6 +176,7 @@ termora.new-host.terminal.encoding=编码
|
||||
termora.new-host.terminal.backspace=退格键
|
||||
termora.new-host.terminal.character-mode=单字符模式
|
||||
termora.new-host.terminal.heartbeat-interval=心跳间隔
|
||||
termora.new-host.terminal.timeout=超时时间
|
||||
termora.new-host.terminal.startup-commands=启动命令
|
||||
termora.new-host.terminal.alt-modifier=Alt 键修饰
|
||||
termora.new-host.terminal.alt-modifier.eight-bit=8 位字符
|
||||
|
||||
@@ -179,6 +179,7 @@ termora.new-host.terminal.alt-modifier=Alt 鍵修飾
|
||||
termora.new-host.terminal.alt-modifier.eight-bit=8 位元字符
|
||||
termora.new-host.terminal.alt-modifier.by-esc=ESC 鍵作為前綴
|
||||
termora.new-host.terminal.heartbeat-interval=心跳間隔
|
||||
termora.new-host.terminal.timeout=超時時間
|
||||
termora.new-host.terminal.env=環境
|
||||
termora.new-host.terminal.login-scripts=登入腳本
|
||||
termora.new-host.terminal.expect=預期
|
||||
|
||||
Reference in New Issue
Block a user