krlvm/BeautySearch

Re-implement online search

McBaumwolle opened this issue ยท 30 comments

If you install BeautySearch, it automatically disables web search.
image
I think it was intentionally added, but it shouldn't, many people including me use it.

krlvm commented

TL;DR: BeautySearch is incompatible with Bing Online Search.

BeautySearch is built on the fact that Windows Search UI is actually web-based application.
When you install BS, it writes a line to the HTML file of the Search web-app, forcing it to load the BeautySearch script, so we don't need to keep the Installer executable file in memory.

The file we write data to is stored in the Windows folder, but when the Bing Search is enabled, the Search app loads the web-app from Bing instead of the local one every time you open it, so we can't modify it.
The only way to force the Search app use the local web-app is to disable Bing Search, so BS is incompatible with online search.

Okay, thanks for the info.

krlvm commented

Thanks for the idea, I figured out how to re-implement the web search, even how to add a custom search provider instead of Bing (Google, etc.)

Any updates on this?

Thanks for the idea, I figured out how to re-implement the web search, even how to add a custom search provider instead of Bing (Google, etc.)

krlvm commented

Any updates on this?

Thanks for the idea, I figured out how to re-implement the web search, even how to add a custom search provider instead of Bing (Google, etc.)

I managed to display search results in the Search Window, but I still need to do some research to figure out how to force open the links in an external browser.

Any updates on this?

Thanks for the idea, I figured out how to re-implement the web search, even how to add a custom search provider instead of Bing (Google, etc.)

I managed to display search results in the Search Window, but I still need to do some research to figure out how to force open the links in an external browser.

I am thrilled for this! Currently, only the missing online search is keeping me from installing your software. Keep up the good work!

Any updates on this?

Thanks for the idea, I figured out how to re-implement the web search, even how to add a custom search provider instead of Bing (Google, etc.)

I managed to display search results in the Search Window, but I still need to do some research to figure out how to force open the links in an external browser.

very excited to hear this! I like having search results in the start search but I hate how bing has no dark mode so for the time being I'm using duckduckgo and would absolutely love to see it integrated into the system search menu

Are there any new updates on this or is this feature not possible?

Thanks for the idea, I figured out how to re-implement the web search, even how to add a custom search provider instead of Bing (Google, etc.)

krlvm commented

Finally took the time and was able to do some additional reverse engineering - I found a way to call the function that opens a given URL, so I hope to release a new version with Google search support within a few days, depending on time.

It will also support opening some webpages inside the Search Window.
Unfortunately, some websites including Google (but I've managed to bypass it) doesn't allow embedding them in iframe, so I'm thinking on bringing an optional component, that'll render the websites instead of the Search App.

On screenshot: Google Search -> a Wikipedia page embedded in the Search Window.
image

krlvm commented

I've published a beta version with some limitations.

I've published a beta version with some limitations.

I have tried it out. The embedded window does not fit the search section and the "search the web" button (which seems to disappear when no local results are found) has to be clicked on for online results. Hope there is a fix

krlvm commented

The embedded window does not fit the search section

Can you provide a screenshot, please?

The embedded window does not fit the search section

Can you provide a screenshot, please?

image

not loading
SharedScreenshot

krlvm commented

@senolfndk Try to restart the Installer and Install it again, if it still not work, you can manually take ownership before installation: #11 (comment)

SOI7 commented

Any news on this?

krlvm commented

It appears that the WebView which is embedded in Search is configured to disallow loading web pages from local network even when checknetisolation is configured, while it is needed to run a local web server which will add CORS header to Google's responses, because it will not load otherwise.
I have an idea of implementing a proxy server instead of the web server and proxy only Search App requests through it with NDIS, but it is a more complex solution.

SOI7 commented

It appears that the WebView which is embedded in Search is configured to disallow loading web pages from local network even when checknetisolation is configured, while it is needed to run a local web server which will add CORS header to Google's responses, because it will not load otherwise. I have an idea of implementing a proxy server instead of the web server and proxy only Search App requests through it with NDIS, but it is a more complex solution.

Does this affect only Google, or web engines in general? I wouldn't mind having at least Bing tbh

krlvm commented

It appears that the WebView which is embedded in Search is configured to disallow loading web pages from local network even when checknetisolation is configured, while it is needed to run a local web server which will add CORS header to Google's responses, because it will not load otherwise. I have an idea of implementing a proxy server instead of the web server and proxy only Search App requests through it with NDIS, but it is a more complex solution.

Does this affect only Google, or web engines in general? I wouldn't mind having at least Bing tbh

IIRC Bing loads correctly

IIRC Bing loads correctly

Would you consider enabling Bing search in the main release if that portion is ready while you are working on other custom search engines? The beta release is a bit outdated at this point.

krlvm commented

IIRC Bing loads correctly

Would you consider enabling Bing search in the main release if that portion is ready while you are working on other custom search engines? The beta release is a bit outdated at this point.

Unfortunately, looks like this is no longer possible starting with build 1904X.1618+

SOI7 commented

IIRC Bing loads correctly

Would you consider enabling Bing search in the main release if that portion is ready while you are working on other custom search engines? The beta release is a bit outdated at this point.

Unfortunately, looks like this is no longer possible starting with build 1904X.1618+

I guess because of the new Search Highlights feature

krlvm commented

IIRC Bing loads correctly

Would you consider enabling Bing search in the main release if that portion is ready while you are working on other custom search engines? The beta release is a bit outdated at this point.

Unfortunately, looks like this is no longer possible starting with build 1904X.1618+

I guess because of the new Search Highlights feature

Actually, the native Bing search could be re-enabled in older versions by editing the code of the bundle's JavaScript files, but this no longer works - for some reason, network requests don't pass.
Maybe this can be solved after more thorough inspection of the scripts, but they were written in React, which makes it difficult to read without source mappings.

Neato, I was recommended this repo by github. I have a solution currently that hooks into MS Edge instead of the Start Menu but I'd love to direct traffic your way if you get this working within the Start Menu itself.

krlvm commented

Neato, I was recommended this repo by github. I have a solution currently that hooks into MS Edge instead of the Start Menu but I'd love to direct traffic your way if you get this working within the Start Menu itself.

This is unlikely to help - the Search Window still uses the deprecated EdgeHTML WebView, including on the latest Insider builds of Windows 11.

The Search Application simply adds an iframe to the document that loads a mini version of Bing search, the main feature of which is the allow CORS header when sending special data in the request.

The address of the WebView itself cannot be changed, and attempts to load the iframe from Google have failed due to CORS. The only thing that can be loaded there is a special version of Google search for iframe embedding, which allows CORS, but it does not fit into this small panel, because without setting cookies or changing the User-Agent, the mobile version cannot be loaded. Other search engines, again, due to CORS, cannot be embedded in an iframe.

A good solution would be to raise a local web server that proxies requests and modifies CORS headers, but it also does not load in the iframe, because firstly, UWP security rules block WebView access to local addresses until you explicitly allow this through PowerShell (this possible to do), and secondly, the WebView itself refuses to load local addresses or addresses on the local network until the appropriate prohibition is disabled in the WebView settings in the XAML or the UI Search App code.

Changing the hosts is also useless, since all these addresses resolve to 127.0.0.1 anyway, but it would be possible to perform a trick using a proxy server that would combine a CORS proxy when requesting a specific address, which is inconvenient, since it will force you to proxy in general, all traffic, or it could be done by writing a driver for the Windows Filtering Platform or using WinDivert, which is too unreasonably tricky for this.

Maybe in a future version I'll just add a web search button to the list of results, but here is also a problem - due to CORS, I can't get the query completion list from search engines, which again loses to the standard Bing Search.

It is also important to note that when search in Bing is enabled, that is, not disabled in the registry, all your even unfinished search queries come to Microsoft on the Bing servers in conjunction with your Microsoft account, even if you are looking for some local file and in general don't want to search the web, regardless of your privacy settings.

Have you considered registering a URI and having the javascript call that URI for web search? This would allow you to access local addresses as the application registered for that URI will be handling the request, not UWP.

krlvm commented

Have you considered registering a URI and having the javascript call that URI for web search? This would allow you to access local addresses as the application registered for that URI will be handling the request, not UWP.

The Search App internal API accessible from JavaScript part provide a way to launch any executable file or URL, so it is possible to launch the default browser (not Microsoft Edge) without problems:

bsController.launchUri('https://github.com/');

There's also a very simple way of getting the search box input, but there's a problem which is not too simple to solve: we need to to inject a button to the search results - it should execute the code above, but it is pretty complicated to do since the Search UI is written with React.

I Have Experience With React And Would Love to contribute to this project!

well i do believe the project is open to PRs, despite the lack of a contributing.md file.

updates?