Skip to content
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

Web view on Windows #178

Closed
1 of 6 tasks
RuiNtD opened this issue Mar 25, 2023 · 15 comments
Closed
1 of 6 tasks

Web view on Windows #178

RuiNtD opened this issue Mar 25, 2023 · 15 comments

Comments

@RuiNtD
Copy link

RuiNtD commented Mar 25, 2023

Relevant components

  • Standalone tray application (based on Qt Widgets)
  • Plasmoid/applet for Plasma desktop
  • Dolphin integration
  • Command line tool (syncthingctl)
  • Integrated Syncthing instance (libsyncthing)
  • Backend libraries

Is your feature request specific to a certain platform/environment? Please specify.
Windows

Is your feature request related to a problem? Please describe.
It would be nice to be able to access the web UI on Windows without opening my browser.

Describe the solution you'd like
Web view support on Windows

Describe alternatives you've considered
🤔

Additional context
Add any other context or screenshots about the feature request here.

@Martchus
Copy link
Owner

Martchus commented Mar 25, 2023

This should already work. Note that binaries provided by myself on GitHub don't have the web UI enabled because I am reluctant to ship a web browser.

Any third party is welcome to provide such builds. I will nevertheless close the issue for now as it is nothing I will work on. If someone likes to work on it, one can still leave a comment and I'll reopen the issue.

@Martchus
Copy link
Owner

Martchus commented Mar 25, 2023

Note that if Qt WebView gains support for using Windows' native web rendering facilities I will implement support for utilizing it and enable it in my Windows build. However, to my knowledge this is not possible yet.

@RuiNtD
Copy link
Author

RuiNtD commented Mar 26, 2023

Any chance an option could be added instead to open the web UI in Chrome / Edge app mode?

msedge -app="http://localhost:8384"

@Martchus
Copy link
Owner

I haven't had that idea yet. That's something that would be easy to implement, one just has to do it. Maybe it is even possible to pass auth credentials this way.

Maybe I'll do it at some point so I'll reopen the issue.

@Martchus Martchus reopened this Mar 26, 2023
@Martchus
Copy link
Owner

Martchus commented Mar 26, 2023

I've just tried /c/Program\ Files\ \(x86\)/Microsoft/Edge/Application/msedge --app="http://localhost:8384" and it looks really good. Definitely better than shipping a complete browser stack (as it was required for Qt WebEngine). It will still be a bit of work to implement:

  • The path of Edge needs to be located dynamically. Supposedly one can read it somewhere from the registry and fall back to some common location.
  • The process should preferrably be be tracked so when one opens Syncthing when it is already open the existing window is simply focused.
  • Passing auth credentials is a nice feature provided by the built-in web view. It would be great it could be passed to Edge as well. Unfortunately it doesn't seem to support passing credentials via the URL.
  • Another feature of the built-in web view is validation of the self-signed certificate if TLS is enabled. Supposedly this is not possible but one could at least specify --allow-insecure-localhost to be able to at least access the page (without validation).

Alternatively, one could also try to use https://learn.microsoft.com/en-us/microsoft-edge/webview2 directly, even though Qt doesn't support it. According to https://learn.microsoft.com/en-us/microsoft-edge/webview2/concepts/overview-features-apis?tabs=dotnetcsharp there are APIs to deal with authentication.

@RuiNtD
Copy link
Author

RuiNtD commented Mar 26, 2023

The path of Edge needs to be located dynamically. Supposedly one can read it somewhere from the registry and fall back to some common location.

I mean, considering it's pre-installed on Windows 10 and 11, install location should be consistent. Even then, the executable could be made customizable, since the same flags should work on any Chromium based browser.

@RuiNtD
Copy link
Author

RuiNtD commented Mar 27, 2023

I also found this reference online for registry values that point to MS Edge:

Source: https://www.tenforums.com/browsers-email/178354-edge-executable-file-location-registry.html

I feel like HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\msedge.exe would be the most reliable registry value to check for MS Edge. You could also fall back to chrome.exe if Edge has been (forcefully) uninstalled, which can be located in registry with a similar key.

@Martchus
Copy link
Owner

I've created a first commit (58b8a4e) to support this feature in general. At this point it just tries to locate chromium in path but you can override the executable via SYNCTHINGWIDGETS_CHROMIUM_BASED_BROWSER. I've only tested it under GNU/Linux with Chromium itself so far but it should work under Windows as well if you set the mentioned environment variable to the path of Edge.

The next step would be a better automatic detection and the possibility to override the command-line from the UI.

@Martchus
Copy link
Owner

Tested it on Windows with SYNCTHINGWIDGETS_CHROMIUM_BASED_BROWSER=C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe for my system and it works just fine.

Just for the sake of it, I've also tested whether the web view using Qt WebEngine works and it works as well. However, it was really slow. For instance the animations of Syncthing's UI were not fluent at all. Maybe it is because I've been using a debug build of Qt (the official MSVC build).

@Martchus
Copy link
Owner

With 033cd21 the automatic detection should be good enough. Being able to select a binary manually is still missing.

Note sure whether I'll look also into the other ideas mentioned in #178 (comment) as they are more effort to implement and maybe not even possible besides focusing an already opened window.

@RuiNtD
Copy link
Author

RuiNtD commented Mar 28, 2023

BTW, it might be a good idea to add brave.exe to the list. c:

@Martchus
Copy link
Owner

Martchus commented Mar 31, 2023

I've been adding a way to configure a custom command via the UI.

One could also add Vivaldi. However, I would actually add none of them because this also needs testing - and I'm not willing to regularly test a bunch of browsers. I've been adding Edge to the list because it should be installed by default on Windows and I've added Chromium/Chrome to the list because it is very likely installed on Windows and GNU/Linux. Those two should suffice. If one wants to use a different browser this is now easily possible and the extra configuration step makes it also clear that one leaves the realm of supported configurations.

I think that's as good as it gets for this feature for now.

@RuiNtD
Copy link
Author

RuiNtD commented Apr 5, 2023

Trying out Web View on 1.4.0, and it doesn't save the setting across restarts.

@Martchus
Copy link
Owner

Martchus commented Apr 5, 2023

Right, I can reproduce the problem. I suspect it only happens with builds where built-in web view support is disabled as I have tested this actually a lot with builds with built-in web view support enabled.

@Martchus Martchus reopened this Apr 5, 2023
@Martchus
Copy link
Owner

Martchus commented Apr 7, 2023

Fixed in 1.4.1.

@Martchus Martchus closed this as completed Apr 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants