feat: 🎸 preferred clients section on settings page (#3034)

* feat: 🎸 preferred clients section on settings page

* chore: 🤖 update mock ipc with new handlers

* refactor: 💡 moved windows rdp protocol to const

* refactor: 💡 moved rdp calls to app route

* test: 💍 fixed failings tests

* refactor: 💡 addressed comments

* fix: 🐛 fixed failing tests

* refactor: 💡 add mock rdp service calls to tests

* refactor: 💡 addressed comments

* test: 💍 add additional tests

* refactor: 💡 fixed test failure
This commit is contained in:
Priya Patel authored and Dharini committed 2025-11-19 14:22:06 -08:00
1 parent 9234dbae70
commit e55ea0b629
19 files changed
+487 -31

No files matched your search

+6 -2
View File
@@ -164,13 +164,17 @@ const createWindow = async (partition, closeWindowCB) => {
// Opens external links in the host default browser.
// We allow developer.hashicorp.com domain to open on an external window
// and releases.hashicorp.com domain to download the desktop app or
// link to the release page for the desktop app.
// link to the release page for the desktop app or
// apps.apple.com domain to open the app store page to download the Windows App or
// learn.microsoft.com domain to open the documentation for installing Remote Desktop Connection.
browserWindow.webContents.setWindowOpenHandler(({ url }) => {
if (
isLocalhost(url) ||
url.startsWith('https://developer.hashicorp.com/') ||
url.startsWith('https://releases.hashicorp.com/boundary-desktop/') ||
url.startsWith('https://support.hashicorp.com/hc/en-us')
url.startsWith('https://support.hashicorp.com/hc/en-us') ||
url.startsWith('https://learn.microsoft.com/') ||
url.startsWith('https://apps.apple.com/')
) {
shell.openExternal(url);
}
@@ -9,10 +9,15 @@ const which = require('which');
const { isMac, isWindows } = require('../helpers/platform.js');
const store = require('./electron-store-manager');
// RDP Clients
const RDP_CLIENT_NONE = 'none';
const RDP_CLIENT_WINDOWS_APP = 'windows-app';
const RDP_CLIENT_MSTSC = 'mstsc';
// RDP Client Configuration
const RDP_CLIENTS = [
{
value: 'mstsc',
value: RDP_CLIENT_MSTSC,
isAvailable: async () => {
if (!isWindows()) return false;
try {
@@ -24,7 +29,7 @@ const RDP_CLIENTS = [
},
},
{
value: 'windows-app',
value: RDP_CLIENT_WINDOWS_APP,
isAvailable: () => {
if (!isMac()) return false;
try {
@@ -50,7 +55,7 @@ const RDP_CLIENTS = [
},
},
{
value: 'none',
value: RDP_CLIENT_NONE,
isAvailable: () => true,
},
];
@@ -78,8 +83,10 @@ class RdpClientManager {
*/
async getBestDefaultRdpClient() {
const availableClients = await this.getAvailableRdpClients();
const bestClient = availableClients.find((client) => client !== 'none');
return bestClient ?? 'none';
const bestClient = availableClients.find(
(client) => client !== RDP_CLIENT_NONE,
);
return bestClient ?? RDP_CLIENT_NONE;
}
/**
@@ -103,7 +110,7 @@ class RdpClientManager {
*/
setPreferredRdpClient(preferredClient) {
if (!preferredClient) {
store.set('preferredRdpClient', 'none');
store.set('preferredRdpClient', RDP_CLIENT_NONE);
} else {
store.set('preferredRdpClient', preferredClient);
}