vweevers / win-detect-browsers

Fast and native browser detection on Windows.
MIT License
39 stars 15 forks source link

Edge Dev is not found #80

Open leumasme opened 1 year ago

leumasme commented 1 year ago

See Downstream Issue: https://github.com/httptoolkit/httptoolkit/issues/401

I have installed MS Edge Dev via winget. The application is present in the default install directory C:\Program Files (x86)\Microsoft\Edge Dev\Application and in the Start Menu C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Microsoft Edge Dev.lnk. The definition file for Edge does not mention edge dev at all. https://github.com/vweevers/win-detect-browsers/blob/8f5df151f1e495564058ab50b0894577a51ced0b/lib/browsers.js#L113-L121 The Paths for Edge and Edge Beta are defined, and this.startMenu(). https://github.com/vweevers/win-detect-browsers/blob/8f5df151f1e495564058ab50b0894577a51ced0b/lib/finder.js#L157-L165 This argument is not provided which, from what I see, would always result in an invalid registry path being checked (argument is stringified to "undefined"). The argument is not provided falls back to the binary name which doesnt work for Edge. Edge Dev would be present in the registry path that startMenu checks, if the check was working correctly. (Computer\HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Clients\StartMenuInternet\Microsoft Edge Dev\shell\open\command exists)

What needs to be done:

vweevers commented 1 year ago

startMenu works (in general) because of the || (startEntry = this.bin). Whether it works for Edge doesn't really matter if we can find Edge through other means.

PR is welcome to add the install path of Edge Dev. That should suffice.

leumasme commented 1 year ago

I'll make a PR. I'd like to also add channel detection for Edge. Sadly the edge binary does not actually have metadata that indicates that it is a beta. The fact that it's a beta/dev version seems to be mainly signaled by a msedge.VisualElementsManifest.xml file in the same folder as the binary. Is it okay to read this file in the post function of the detection and then check the channel via regex? One may argue that this is rather slow (with modern AV programs intercepting every new file open). The alternative is assuming that it's always installed in the default path and just getting the channel from that.