Skip to content

fix: remote ide no longer reconnects after plugin upgrade #167

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@
- URL validation is stricter in the connection screen and URI protocol handler
- support for verbose logging a sanitized version of the REST API request and responses

### Fixed

- remote IDE reconnects automatically after plugin upgrade

## 0.6.0 - 2025-07-25

### Changed
Expand Down
61 changes: 46 additions & 15 deletions src/main/kotlin/com/coder/toolbox/views/EnvironmentView.kt
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,51 @@ class EnvironmentView(
private val workspace: Workspace,
private val agent: WorkspaceAgent,
) : SshEnvironmentContentsView {
override suspend fun getConnectionInfo(): SshConnectionInfo = object : SshConnectionInfo {
/**
* The host name generated by the cli manager for this workspace.
*/
override val host: String = cli.getHostname(url, workspace, agent)

/**
* The port is ignored by the Coder proxy command.
*/
override val port: Int = 22

/**
* The username is ignored by the Coder proxy command.
*/
override val userName: String? = null
override suspend fun getConnectionInfo(): SshConnectionInfo = WorkspaceSshConnectionInfo(url, cli, workspace, agent)
}

private class WorkspaceSshConnectionInfo(
url: URL,
cli: CoderCLIManager,
private val workspace: Workspace,
private val agent: WorkspaceAgent,
) : SshConnectionInfo {
/**
* The host name generated by the cli manager for this workspace.
*/
override val host: String = cli.getHostname(url, workspace, agent)

/**
* The port is ignored by the Coder proxy command.
*/
override val port: Int = 22

/**
* The username is ignored by the Coder proxy command.
*/
override val userName: String? = null

override fun equals(other: Any?): Boolean {
if (this === other) return true
if (javaClass != other?.javaClass) return false

other as WorkspaceSshConnectionInfo

if (port != other.port) return false
if (workspace.name != other.workspace.name) return false
if (agent.name != other.agent.name) return false
if (host != other.host) return false

return true
}

override fun hashCode(): Int {
var result = port
result = 31 * result + workspace.name.hashCode()
result = 31 * result + agent.name.hashCode()
result = 31 * result + host.hashCode()
return result
}


}
Loading
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy