rocksdanister / lively

Free and open-source software that allows users to set animated desktop wallpapers and screensavers powered by WinUI 3.
https://rocksdanister.com/lively
GNU General Public License v3.0
14.62k stars 1.04k forks source link

New Feature: Customized UserAgent for WebPage #1452

Open yangzhongke opened 1 year ago

yangzhongke commented 1 year ago

When I tried to log in to my Google account on the web page, the following error showed: image

According to my research, the reason is that the default UserAgent of CEFSharp or WebView2 is considered unsafe by Google. This problem can be solved by customised UserAgent.

I'd like to contribute the code. I propose adding an editable Combobox for the "UserAgent" field.

rocksdanister commented 1 year ago

I don't think even changing UserAgent will allow login with CEF:

Starting in June 2019 Google will block logins from CEF based browsers to Google Services, this includes Gmail, Drive, Docs, see https://security.googleblog.com/2019/04/better-protection-against-man-in-middle.html?m=1 for further discussion see https://groups.google.com/a/chromium.org/d/msg/embedder-dev/STyM5ZNTHMM/POj1v_cqBgAJ

WebView2 did not work? https://github.com/rocksdanister/lively/wiki/Web-Player#webview2-microsoft-edge

yangzhongke commented 1 year ago

Thanks for your prompt reply. Without using UserAgent, how does Google tell if the webpage is running on CEF-based browser?

yangzhongke commented 1 year ago

It works with WebView2 with the fake UserAgent: image

rocksdanister commented 1 year ago

Oh alright.

For implementation I recommend adding custom configuration file support for now:

https://github.com/rocksdanister/lively/issues/706

This way many more properties can be added immediately without the overhead of UI implementation.

Add a new path for webplayer config json location: https://github.com/rocksdanister/lively/blob/core-separation/src/Lively/Lively.Common/Constants.cs

Then you can check if the file exists in webview player and load.

amaitland commented 1 year ago

I don't think even changing UserAgent will allow login with CEF:

You have to be a little careful in which useragent you choose, generally should work from all reports. Use a Firefox useragent and you may get optimised code that won't run in chromium.