Skip to content

Commit c312ea0

Browse files
committed
refactor: only support full URLs
There is no need to support relative paths as the existing customer will have a custom dashboard that is hosted on a different hostname than the Coder deployment. The part related to relative URL paths is now removed in order to simplify the code.
1 parent d7b3766 commit c312ea0

File tree

5 files changed

+8
-15
lines changed

5 files changed

+8
-15
lines changed

README.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -362,9 +362,8 @@ storage paths. The options can be configured from the plugin's main Workspaces p
362362

363363
- `lastDeploymentURL` the last Coder deployment URL that Coder Toolbox successfully authenticated to.
364364

365-
- `workspaceCreatePath` specifies the dashboard page’s relative path (to `lastDeploymentURL`) or full URL where users
366-
can create new workspaces. Helpful for customers that have their own in-house dashboards. Defaults to `/templates` if
367-
missing.
365+
- `workspaceCreateUrl` specifies the dashboard page full URL where users can create new workspaces.
366+
Helpful for customers that have their own in-house dashboards. Defaults to the Coder deployment templates page.
368367

369368
### TLS settings
370369

src/main/kotlin/com/coder/toolbox/CoderRemoteProvider.kt

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -224,13 +224,7 @@ class CoderRemoteProvider(
224224
override val additionalPluginActions: StateFlow<List<ActionDescription>> = MutableStateFlow(
225225
listOf(
226226
Action(context, "Create workspace") {
227-
val wsCreatePath = context.settingsStore.workspaceCreatePath
228-
val url = if (wsCreatePath.startsWith("http://") || wsCreatePath.startsWith("https://")) {
229-
wsCreatePath
230-
} else {
231-
client?.url?.withPath(wsCreatePath).toString()
232-
}
233-
227+
val url = context.settingsStore.workspaceCreateUrl ?: client?.url?.withPath("/templates").toString()
234228
context.desktop.browse(url) {
235229
context.ui.showErrorInfoPopup(it)
236230
}

src/main/kotlin/com/coder/toolbox/settings/ReadOnlyCoderSettings.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,9 +138,9 @@ interface ReadOnlyCoderSettings {
138138
val sshConfigOptions: String?
139139

140140
/**
141-
* A relative path or full URL to the dashboard page used for creating workspaces.
141+
* A custom full URL to the dashboard page used for creating workspaces.
142142
*/
143-
val workspaceCreatePath: String
143+
val workspaceCreateUrl: String?
144144

145145
/**
146146
* The path where network information for SSH hosts are stored

src/main/kotlin/com/coder/toolbox/store/CoderSettingsStore.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,8 @@ class CoderSettingsStore(
8080
.normalize()
8181
.toString()
8282

83-
override val workspaceCreatePath: String
84-
get() = store[WORKSPACE_CREATE_PATH] ?: "/templates"
83+
override val workspaceCreateUrl: String?
84+
get() = store[WORKSPACE_CREATE_URL]
8585

8686
/**
8787
* Where the specified deployment should put its data.

src/main/kotlin/com/coder/toolbox/store/StoreKeys.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ internal const val SSH_CONFIG_OPTIONS = "sshConfigOptions"
4646

4747
internal const val NETWORK_INFO_DIR = "networkInfoDir"
4848

49-
internal const val WORKSPACE_CREATE_PATH = "workspaceCreatePath"
49+
internal const val WORKSPACE_CREATE_URL = "workspaceCreateUrl"
5050

5151
internal const val SSH_AUTO_CONNECT_PREFIX = "ssh_auto_connect_"
5252

0 commit comments

Comments
 (0)