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

Several wallpapers not working due to CORS issue in loading file URL resources while using MS Edge Engine #1160

Closed
schrodingerNeko101 opened this issue Apr 2, 2022 · 5 comments
Labels
bug Something isn't working

Comments

@schrodingerNeko101
Copy link

Describe the bug
Several of the default wallpapers such as "Rain v2", "Ripples" are unable to load and will either just show a blank screen or partially function without any images. This only happens while using MS Edge Webview Engine. Further digging deeper into this got me that the requests for resources such as images are blocked by CORS policy.

To Reproduce
Steps to reproduce the behavior:

  1. Set the Web Browser engine to "MS Edge".
  2. Try opening "Rain v2" in preview.
  3. Open web inspector using keyboard shortcut and go to console. You will see the requests from file URL to another file URL being blocked.

Expected behavior
Simply the wallpapers should work in any engine as they are intended to.

Screenshots/Video
Here are screenshots detailing the evident case while loading "Rain v2":
1 Wallpaper issue

2 CORS

Desktop (please complete the following information):

  • OS: Windows 10 2004
  • Wallpaper "Rain v2" and "Ripples" preinstalled within the app.

Additional context
Possible Solution:
Maybe this issue could be bypassed by setting edge://flags but I don't want to make a highly OS coupled browser vulnerable. While searching for other solutions I found this StackOverflow Answer. We just need to allow file resource access grant so we can use the flag "--allow-file-access-from-files" as mentioned in comment by mbassett on the first answer and use the rest of the suggestion in 1st answer. I guess by writing var op = new CoreWebView2EnvironmentOptions("--allow-file-access-from-files"); and setting it as a parameter to the line 86 of the file lively/src/Lively/Lively.PlayerWebView2/MainWindow.xaml.cs might fix this.

Log file (Important)
Log file attached here:
lively_log_20220402_150750.zip

@schrodingerNeko101 schrodingerNeko101 added the bug Something isn't working label Apr 2, 2022
@rocksdanister
Copy link
Owner

rocksdanister commented Apr 2, 2022

This is known issue, Edge webview player is still under development and not primary browser:
https://github.com/rocksdanister/lively/wiki/Web-Guide-I-:-Cef

--allow-file-access-from-files is not used due to security reasons.

In CefSharp custom schemehandler is used for fetching resources; schemehandler is not supported by WebView2 yet:
MicrosoftEdge/WebView2Feedback#1825

SetVirtualHostNameToFolderMapping is an option but that involes also modifying the html files:

//webView.CoreWebView2.SetVirtualHostNameToFolderMapping("lively_test", Path.GetDirectoryName(htmlPath), CoreWebView2HostResourceAccessKind.Allow);

Another option is to start a localhost server but that seemed like too much - starting a new server for each wallpapers.

For now waiting for WebView2 to support custom schemehandler.

There are also other concerns with using WebView2 - the method I use to pause browser rendering is not official and this is not thoroughly tested in WebView2 yet (especially since webview shares resources(?) with other apps.)

@roxxel
Copy link

roxxel commented Apr 2, 2022

Possible solution is to implement CORS proxy server in lively and run it locally then

@roxxel
Copy link

roxxel commented Apr 19, 2022

@rocksdanister hey, can u assign me for this issue? I'll fix it

@roxxel
Copy link

roxxel commented Apr 19, 2022

Another option is to start a localhost server but that seemed like too much - starting a new server for each wallpapers.

There's lightweight http server like Watson

@rocksdanister

This comment was marked as outdated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants