From b594a7cb1439e790d96bebff41909f2283777b70 Mon Sep 17 00:00:00 2001 From: Ethan Dickson Date: Thu, 8 May 2025 14:19:35 +1000 Subject: [PATCH 1/2] fix: handle missing workspace app `display_name` --- Coder-Desktop/Coder-Desktop/Views/VPN/WorkspaceAppIcon.swift | 5 +++-- Coder-Desktop/CoderSDK/Workspace.swift | 5 ++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Coder-Desktop/Coder-Desktop/Views/VPN/WorkspaceAppIcon.swift b/Coder-Desktop/Coder-Desktop/Views/VPN/WorkspaceAppIcon.swift index 8ac79c43..2eb45cc5 100644 --- a/Coder-Desktop/Coder-Desktop/Views/VPN/WorkspaceAppIcon.swift +++ b/Coder-Desktop/Coder-Desktop/Views/VPN/WorkspaceAppIcon.swift @@ -75,7 +75,8 @@ struct WorkspaceApp { sessionToken: String ) throws(WorkspaceAppError) { slug = original.slug - displayName = original.display_name + // Same behaviour as the web UI + displayName = original.display_name ?? original.slug guard original.external else { throw .isWebApp @@ -196,7 +197,7 @@ func vscodeDisplayApp(hostname: String, baseIconURL: URL, path: String? = nil) - } func vscodeInsidersDisplayApp(hostname: String, baseIconURL: URL, path: String? = nil) -> WorkspaceApp { - let icon = baseIconURL.appendingPathComponent("/icon/code.svg") + let icon = baseIconURL.appendingPathComponent("/icon/code-insiders.svg") return WorkspaceApp( slug: "-vscode-insiders", displayName: "VS Code Insiders Desktop", diff --git a/Coder-Desktop/CoderSDK/Workspace.swift b/Coder-Desktop/CoderSDK/Workspace.swift index e8f95df3..e70820da 100644 --- a/Coder-Desktop/CoderSDK/Workspace.swift +++ b/Coder-Desktop/CoderSDK/Workspace.swift @@ -56,11 +56,10 @@ public struct WorkspaceAgent: Codable, Identifiable, Sendable { public struct WorkspaceApp: Codable, Identifiable, Sendable { public let id: UUID - // Not `omitempty`, but `coderd` sends empty string if `command` is set - public var url: URL? + public var url: URL? // `omitempty` public let external: Bool public let slug: String - public let display_name: String + public let display_name: String? // `omitempty` public let command: String? // `omitempty` public let icon: URL? // `omitempty` public let subdomain: Bool From b87e2458108d1975bc1f109be27ae8ebb940c0b3 Mon Sep 17 00:00:00 2001 From: Ethan Dickson Date: Thu, 8 May 2025 14:29:54 +1000 Subject: [PATCH 2/2] fix tests --- Coder-Desktop/Coder-DesktopTests/WorkspaceAppTests.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Coder-Desktop/Coder-DesktopTests/WorkspaceAppTests.swift b/Coder-Desktop/Coder-DesktopTests/WorkspaceAppTests.swift index 816c5e04..d0aead16 100644 --- a/Coder-Desktop/Coder-DesktopTests/WorkspaceAppTests.swift +++ b/Coder-Desktop/Coder-DesktopTests/WorkspaceAppTests.swift @@ -137,7 +137,7 @@ struct WorkspaceAppTests { #expect(apps.count == 1) #expect(apps[0].slug == "-vscode-insiders") #expect(apps[0].displayName == "VS Code Insiders Desktop") - #expect(apps[0].icon?.absoluteString == "https://coder.example.com/icon/code.svg") + #expect(apps[0].icon?.absoluteString == "https://coder.example.com/icon/code-insiders.svg") #expect( apps[0].url.absoluteString == """ vscode-insiders://vscode-remote/ssh-remote+test-workspace.coder.test//home/user 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