Skip to content

Native proxy settings#2827

Open
tim2zg wants to merge 17 commits intoelement-hq:developfrom
tim2zg:feat/native-proxy-settings
Open

Native proxy settings#2827
tim2zg wants to merge 17 commits intoelement-hq:developfrom
tim2zg:feat/native-proxy-settings

Conversation

@tim2zg
Copy link

@tim2zg tim2zg commented Feb 1, 2026

Description

This PR implements a native "Network Proxy" settings window, allowing users to configure their proxy connection directly within the application UI instead of relying on command-line arguments or environment variables.

Changes

  • Added a new Proxy Settings entry to the "View" menu.
  • Implemented a dedicated Electron window with a UI that matches the Element look and feel (including dark/light mode support).
  • Created a new module to handle applying proxy configurations to the Electron defaultSession.
  • Persisted proxy configuration using the existing Store.

Solution for Issue: #772

Checklist

  • Ensure your code works with manual testing.
  • New or updated public/exported symbols have accurate TSDoc documentation.
  • Linter and other CI checks pass.
  • I have licensed the changes to Element by completing the Contributor License Agreement (CLA)

tim2zg and others added 9 commits September 23, 2025 21:37
Co-authored-by: tim2zg <59140326+tim2zg@users.noreply.github.com>
…-e9fc06269a7b

Fix TypeScript error TS2345 in settings.ts: Add type assertion for desktopProxyConfig
- Added proxy authentication handling in the Electron main process.
- Introduced `getLastAppliedConfig` function to retrieve the last applied proxy configuration.
- Enhanced the proxy preload script to include a resize window feature.
- Updated the proxy window HTML to improve UI with a modern design and better accessibility.
- Implemented secure password storage for proxy credentials.
- Refactored proxy configuration handling to ensure proper validation and error handling.
- Improved the settings management for proxy configurations, including reading and writing to secure storage.
@tim2zg tim2zg requested a review from a team as a code owner February 1, 2026 10:33
@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
1 out of 2 committers have signed the CLA.

✅ tim2zg
❌ Copilot
You have signed the CLA already but the status is still pending? Let us recheck it.

@dosubot
Copy link

dosubot bot commented Feb 1, 2026

Related Documentation

No published documentation to review for changes on this repository.

Write your first living document

How did I do? Any feedback?  Join Discord

@github-actions github-actions bot added the Z-Community-PR Issue is solved by a community member's PR label Feb 1, 2026
@dosubot dosubot bot added the T-Enhancement label Feb 1, 2026
Copy link
Member

Choose a reason for hiding this comment

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

Can this be cts instead and be transpiled by typescript into the lib dir instead of avoiding typescript? I.e follow the path of the main preload script

Copy link
Author

Choose a reason for hiding this comment

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

Fair, done

Copy link
Member

@t3chguy t3chguy left a comment

Choose a reason for hiding this comment

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

This is exciting, but a few points

Additionally, looks like the autoUpdater won't respect these proxy settings which is problematic without a warning to the user

@@ -0,0 +1,378 @@
<!--
Copyright 2026 New Vector Ltd.
Copy link
Member

Choose a reason for hiding this comment

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

We are not New Vector anymore, this should be your copyright anyway

Copy link
Author

Choose a reason for hiding this comment

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

Done

@@ -0,0 +1,96 @@
/*
Copyright 2026 New Vector Ltd.
Copy link
Member

Choose a reason for hiding this comment

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

Ditto

src/proxy.ts Outdated
@@ -0,0 +1,154 @@
/*
Copyright 2026 New Vector Ltd.
Copy link
Member

Choose a reason for hiding this comment

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

Ditto

Copy link
Member

Choose a reason for hiding this comment

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

I think this will want to use Compound components for UI, so may need more complexity and likely to be within the main UI rather than entirely standalone. Needs design

Copy link
Author

Choose a reason for hiding this comment

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

Will need help with this

Comment on lines 179 to 194
<h1>Network Proxy</h1>

<div class="section">
<span class="section-title">Connection Mode</span>
<label class="radio-option"
><input type="radio" name="mode" id="proxy-mode-system" value="system" checked /> Use system proxy
settings</label
>
<label class="radio-option"
><input type="radio" name="mode" id="proxy-mode-direct" value="direct" /> No proxy (direct
connection)</label
>
<label class="radio-option"
><input type="radio" name="mode" id="proxy-mode-custom" value="custom" /> Manual configuration</label
>
</div>
Copy link
Member

Choose a reason for hiding this comment

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

Needs i18n

Copy link
Author

Choose a reason for hiding this comment

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

tried it but not sure if it's right

<input id="proxy-password" type="password" autocomplete="off" />
</div>
</div>
<div class="helper-text">Passwords are stored securely in the system keychain.</div>
Copy link
Member

Choose a reason for hiding this comment

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

I don't think this is true with safeStorage, a single random string is stored in system keychain and other secrets are encrypted symmetrically using it. Additionally the user may have no keychain where this message becauses confusing.

Copy link
Author

Choose a reason for hiding this comment

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

Changed it

@t3chguy t3chguy changed the title Feat/native proxy settings Native proxy settings Feb 2, 2026
@t3chguy
Copy link
Member

t3chguy commented Feb 2, 2026

I have licensed the changes to Element by completing the Contributor License Agreement (CLA)

You checked this box but the CLA does not appear to be signed.

Could you also include screenshots of what the UI you added looks like?

@tim2zg
Copy link
Author

tim2zg commented Feb 2, 2026

This is exciting, but a few points

Additionally, looks like the autoUpdater won't respect these proxy settings which is problematic without a warning to the user

Added a notice

@tim2zg
Copy link
Author

tim2zg commented Feb 2, 2026

I have licensed the changes to Element by completing the Contributor License Agreement (CLA)

You checked this box but the CLA does not appear to be signed.

Could you also include screenshots of what the UI you added looks like?

grafik

Also, the CLA is not okay because I tried using GitHub Copilot at the beginning and didn’t reset the history. GitHub now lists Copilot as a contributor.

@t3chguy t3chguy requested a review from a team February 2, 2026 18:27
@americanrefugee
Copy link

Hello, thanks for your contribution @tim2zg!

In order to integrate this feature into the product, the form you've proposed will need to be presented in a modal (rather than in a separate browser tab). Then there will be 2 places from which the user can access this modal: From the Welcome screen, and from Settings. Here are visuals to help illustrate:

  1. On the Sign in page, we would add a text link in the footer
1_Sign In Page
  1. Click the link to launch the modal. By default the modal would show just the 3 radio button options with the first selected. The "Save" button is disabled until a change is made.
2_Modal - Network proxy - Default
  1. If the last option is selected, then the form appears below. The "Cancel" and "Save" buttons should be sticky and the form scrolls behind until the end. Once the user has entered the minimum information, the "Save" button is enabled.
3_Modal - Network proxy - Manual configuration selected
  1. Once signed into the client, the user can go to Settings > Security & Privacy > Network proxy to manage this setting.
4_Settings_Security and Privacy_Network proxy

Ideally, please provide 1.) the modal and form contents and 2.) the settings section block.

As for UI components, use those provide by our Compound Design System at https://compound.element.io

Here's a quick cheat sheet:

@tim2zg
Copy link
Author

tim2zg commented Feb 5, 2026

Hey, thanks for the feedback. Would this then be added to the main element app repo or injected into it from the wrapper? And would I then need to open up a second pull request there?

Best regards

@t3chguy
Copy link
Member

t3chguy commented Feb 6, 2026

Yes the UI code would live in element-web & communicate over IPC, there's already a wrapper for settings to handle the IPC communication for you. In the future it may be possible to have the UI code live on the element-desktop side and be injected as a module but we aren't there yet. In the near future element-desktop will be re-merged into the element-web (mono)repo to make contributions like this easier.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

T-Enhancement Z-Community-PR Issue is solved by a community member's PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants