-
Notifications
You must be signed in to change notification settings - Fork 315
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add ElectronContextBridgeProvider #2914
feat: add ElectronContextBridgeProvider #2914
Conversation
@microsoft-github-policy-service agree |
This is excellent stuff and much needed, so thank you @trulysinclair What do you think of bumping to a recent version of Electron? |
Thank you, and the only usage of Electron is |
EDIT: Never mind, the issue was the Content Security Policy not allowing MGT to fetch the necessary URLs. Easily fixed. |
@trulysinclair thanks for this PR! It's amazing to see this, I am sure our Electron devs will be very thankful for this great change! It may take some time because of the Holiday season to process, but this is not forgotten! I added the related bug to out v4 milestone that will land in early 2024, so not only this will be fixed, but it will be part of a great major release! I'll let the engineers review and comment on the PR, but I'm excited for this scenario! Thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is great stuff!
Thank you so much for providing this improvement @trulysinclair
Thank you! I'm glad I could contribute to this awesome toolkit! |
Hey @trulysinclair are you able to help out with a sample app on this? I've been trying to get this running and keep running into issues with electron that I'm sure a developer experienced with electron would solve quickly, but I'm not that person and would greatly appreciate the help on this one. |
@gavinbarron absolutely, I've been using it in production I can extract what works for a sample app |
@trulysinclair Thank you, perhaps we could PR it to replace the existing https://github.com/pnp/mgt-samples/tree/main/samples/app/electron-app |
@gavinbarron Would you prefer a second one, that way both with and without |
That would be fantastic! Although part of me thinks we should be guiding folks towards the more secure and preferred ContextBridge approach |
That's a good point, I'll rewrite the existing unsafe example |
Closes #2618
PR Type
Description of the changes
This PR adds the
ElectronContextBridgeProvider
which adds support for Electron applications that use the isolated context and preload scripts. Developers using this provider MUST follow the steps included in the README to set up acontextBridge
that correctly implements theIContextBridgeImpl
interface. I've opted to pass the defined contextBridge object to the provider so that the developer is able to freely name the context bridge api without being forced to use "main" or "electronApi", etc.PR checklist
yarn build
) and changes have been tested in at least two supported browsers (Edge + non-Chromium based browser)yarn setLicense
)Other information