Skip to content

Add UI checkbox for url configuration #20231

Open
vididvidid wants to merge 2 commits into
microsoft:mainfrom
vididvidid:feature/url-ui-checkbox
Open

Add UI checkbox for url configuration #20231
vididvidid wants to merge 2 commits into
microsoft:mainfrom
vididvidid:feature/url-ui-checkbox

Conversation

@vididvidid
Copy link
Copy Markdown
Contributor

Summary of the Pull Request

This PR adds a checkbox to the unsafe URL warning dialog that allows users to easily trust a link. When a user checks the box and clicks "Open anyway", the URL scheme is automatically saved to the safeUriSchemes list in their settings.json.


References and Relevant Issues


Detailed Description of the Pull Request / Additional Comments

The backend for this feature was successfully added in #20207, but it lacked a user interface. This PR connects the UI to that backend logic.

Files Modified

TerminalPage.xaml

  • Added the checkbox inside the UriErrorDialog using a StackPanel.

TerminalPage.cpp

  • Added the logic to:
    • Extract the URI scheme.
    • Save it to _settings.GlobalSettings().SafeUriSchemes() if the checkbox is checked.

Resources.resw (en-US)

  • Added the translation string for the checkbox text.

A working video demonstrating the feature has been attached in the PR thread.

compress_by_compress10mb.mp4

Validation Steps Performed

  • Built and deployed the app locally.
  • Generated a vscode:// hyperlink in the terminal using an OSC 8 escape sequence.
  • Clicked the link, checked the new checkbox, and selected "Open anyway".
  • Verified that "vscode" was automatically written to the safeUriSchemes array in settings.json.
  • Clicked the vscode:// link a second time and verified that the warning dialog was completely bypassed.

PR Checklist


// Get the checkbox and make it visible for unsafe URL warnings only
const auto stackPanel = unopenedUriDialog.Content().as<StackPanel>();
const auto checkbox = stackPanel.Children().GetAt(1).as<CheckBox>();
Copy link
Copy Markdown
Contributor

@ltrzesniewski ltrzesniewski May 19, 2026

Choose a reason for hiding this comment

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

I never used WinUI (I know WPF though), but isn't there a way to retrieve the checkbox by name? GetAt(1) seems too fragile.

(I didn't look for it, sorry, I just took a quick look at the PR since I'm AFK)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thank you sir for the review. You are completely right, GetAt(1) is too fragile. I've updated the XAML and the cpp file to use the name directly now. Please let me know if there is anything else I should adjust.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Make URL safety configurable

2 participants