Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

refactor: remove unused logic in URI handler#204

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
fioan89 merged 1 commit intomainfromrefactor-remove-unused-code-in-uri-handling
Oct 3, 2025
Merged
Changes fromall 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
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -2,9 +2,7 @@ package com.coder.toolbox.util

import com.coder.toolbox.CoderToolboxContext
import com.coder.toolbox.cli.CoderCLIManager
import com.coder.toolbox.cli.ensureCLI
import com.coder.toolbox.models.WorkspaceAndAgentStatus
import com.coder.toolbox.plugin.PluginManager
import com.coder.toolbox.sdk.CoderRestClient
import com.coder.toolbox.sdk.v2.models.Workspace
import com.coder.toolbox.sdk.v2.models.WorkspaceAgent
Expand DownExpand Up@@ -154,29 +152,6 @@ open class CoderProtocolHandler(
return workspace
}

private suspend fun buildRestClient(deploymentURL: String, token: String?): CoderRestClient? {
try {
return authenticate(deploymentURL, token)
} catch (ex: Exception) {
context.logAndShowError(CAN_T_HANDLE_URI_TITLE, humanizeConnectionError(deploymentURL.toURL(), true, ex))
return null
}
}

/**
* Returns an authenticated Coder CLI.
*/
private suspend fun authenticate(deploymentURL: String, token: String?): CoderRestClient {
val client = CoderRestClient(
context,
deploymentURL.toURL(),
token,
PluginManager.pluginInfo.version
)
client.initializeSession()
return client
}

private suspend fun List<Workspace>.matchName(workspaceName: String, deploymentURL: String): Workspace? {
val workspace = this.firstOrNull { it.name == workspaceName }
if (workspace == null) {
Expand DownExpand Up@@ -326,29 +301,6 @@ open class CoderProtocolHandler(
return true
}

private suspend fun configureCli(
deploymentURL: String,
restClient: CoderRestClient,
progressReporter: (String) -> Unit
): CoderCLIManager {
val cli = ensureCLI(
context,
deploymentURL.toURL(),
restClient.buildInfo().version,
progressReporter
)

// We only need to log in if we are using token-based auth.
if (restClient.token != null) {
context.logger.info("Authenticating Coder CLI...")
cli.login(restClient.token)
}

context.logger.info("Configuring Coder CLI...")
cli.configSsh(restClient.workspacesByAgents())
return cli
}

private fun launchIde(
environmentId: String,
productCode: String,
Expand Down
Loading

[8]ページ先頭

©2009-2025 Movatter.jp