Skip to content

Commit 38e3e2b

Browse files
committed
fix: user agent did not have a proper version
- use plugin's version
1 parent 90d199c commit 38e3e2b

File tree

2 files changed

+18
-4
lines changed

2 files changed

+18
-4
lines changed

src/main/kotlin/com/coder/toolbox/util/LinkHandler.kt

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package com.coder.toolbox.util
22

33
import com.coder.toolbox.cli.ensureCLI
44
import com.coder.toolbox.models.WorkspaceAndAgentStatus
5+
import com.coder.toolbox.plugin.PluginManager
56
import com.coder.toolbox.sdk.CoderRestClient
67
import com.coder.toolbox.sdk.ex.APIResponseException
78
import com.coder.toolbox.sdk.v2.models.Workspace
@@ -146,8 +147,14 @@ open class LinkHandler(
146147
}
147148
// The http client Toolbox gives us is already set up with the
148149
// proxy config, so we do net need to explicitly add it.
149-
// TODO: How to get the plugin version?
150-
val client = CoderRestClient(deploymentURL.toURL(), token?.first, settings, proxyValues = null, "production", httpClient)
150+
val client = CoderRestClient(
151+
deploymentURL.toURL(),
152+
token?.first,
153+
settings,
154+
proxyValues = null,
155+
PluginManager.pluginInfo.version,
156+
httpClient
157+
)
151158
return try {
152159
client.authenticate()
153160
client

src/main/kotlin/com/coder/toolbox/views/ConnectPage.kt

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package com.coder.toolbox.views
22

33
import com.coder.toolbox.cli.CoderCLIManager
44
import com.coder.toolbox.cli.ensureCLI
5+
import com.coder.toolbox.plugin.PluginManager
56
import com.coder.toolbox.sdk.CoderRestClient
67
import com.coder.toolbox.settings.CoderSettings
78
import com.coder.toolbox.util.humanizeConnectionError
@@ -83,8 +84,14 @@ class ConnectPage(
8384
try {
8485
// The http client Toolbox gives us is already set up with the
8586
// proxy config, so we do net need to explicitly add it.
86-
// TODO: How to get the plugin version?
87-
val client = CoderRestClient(url, token, settings, proxyValues = null, "production", httpClient)
87+
val client = CoderRestClient(
88+
url,
89+
token,
90+
settings,
91+
proxyValues = null,
92+
PluginManager.pluginInfo.version,
93+
httpClient
94+
)
8895
client.authenticate()
8996
updateStatus("Checking Coder binary...", error = null)
9097
val cli = ensureCLI(client.url, client.buildVersion, settings) { status ->

0 commit comments

Comments
 (0)