Skip to content

refactor(web-client): introduce ConfigBuilder for a better connection API#749

Merged
Benoît Cortier (CBenoit) merged 3 commits into
masterfrom
remote-desktop-connection-refactor
Apr 15, 2025
Merged

refactor(web-client): introduce ConfigBuilder for a better connection API#749
Benoît Cortier (CBenoit) merged 3 commits into
masterfrom
remote-desktop-connection-refactor

Conversation

@RRRadicalEdward
Copy link
Copy Markdown
Collaborator

Refactored connect method

private connect(
username: string,
password: string,
destination: string,
proxyAddress: string,
serverDomain: string,
authToken: string,
desktopSize?: DesktopSize,
preConnectionBlob?: string,
kdc_proxy_url?: string,
use_display_control = false,
): Promise<NewSessionInfo> {

as discussed here - #722 (comment).

Follow-up to #722.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 14, 2025

Coverage Report 🤖 ⚙️

Past:
Total lines: 30423
Covered lines: 19501 (64.10%)

New:
Total lines: 30423
Covered lines: 19497 (64.09%)

Diff: -0.01%

[this comment will be updated automatically]

@RRRadicalEdward Alex Yusiuk (RRRadicalEdward) force-pushed the remote-desktop-connection-refactor branch from f7d0b44 to e5e21e2 Compare April 14, 2025 14:29
@RRRadicalEdward Alex Yusiuk (RRRadicalEdward) force-pushed the remote-desktop-connection-refactor branch from 456442d to e90fe67 Compare April 14, 2025 14:38
Copy link
Copy Markdown
Member

@CBenoit Benoît Cortier (CBenoit) left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

General review:

  • I like the new builder API.
  • It’s well documented, thank you!
  • But as for the extensions, it seems to me that we are basically back to something that is very close to the initial extension API proposal, but slightly worse because we can’t easily hide the string keys.

About my second point:

Here is what we have in this PR:

configBuilder
    .withExtension('DisplayControl', true)
    .withExtension('Pcb', pcb)
    .withExtension('KdcProxyUrl', kdc_proxy_url);

Here is what we would have using the Extension type defined in the initial proposal:

configBuilder
    .withExtension(displayControlExtension(true))
    .withExtension(pcbExtension(pcb))
    .withExtension(kdcProxyUrlExtension(kdc_proxy_url));

I’m open to dropping the Extension suffix from the helper functions above and aim for something like this:

configBuilder
    .withExtension(displayControl(true))
    .withExtension(preconnectionBlob(pcb))
    .withExtension(kdcProxyUrl(kdc_proxy_url));

In this second version, you can remove the Extension::init factory and associated interface.

The benefit is that it’s possible to remove the fragile string-based keys from the public API.
At this point, it’s also not necessary anymore to keep the serde-based dependencies that were previously introduced, and we can reduce the size of the resulting WASM module to what it used to be.

Requested follow ups:

  • Update the README.md file for iron-remote-desktop to document the changes.
  • Change the extension API to what was initially suggested as it seems to play better with the generic API exposed to the user.

@CBenoit Benoît Cortier (CBenoit) merged commit a82e280 into master Apr 15, 2025
10 checks passed
@CBenoit Benoît Cortier (CBenoit) deleted the remote-desktop-connection-refactor branch April 15, 2025 15:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants