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

Re-implement online search #1

Open
McBaumwolle opened this issue Aug 22, 2020 · 30 comments
Open

Re-implement online search #1

McBaumwolle opened this issue Aug 22, 2020 · 30 comments
Assignees
Labels
enhancement New feature or request question Further information is requested

Comments

@McBaumwolle
Copy link

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
Copy link
Owner

krlvm commented Aug 22, 2020

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.

@krlvm krlvm closed this as completed Aug 22, 2020
@krlvm krlvm added enhancement New feature or request question Further information is requested labels Aug 22, 2020
@McBaumwolle
Copy link
Author

Okay, thanks for the info.

@krlvm
Copy link
Owner

krlvm commented Aug 22, 2020

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 krlvm reopened this Aug 22, 2020
@krlvm krlvm changed the title BeautySearch disables web search Re-implement online search Aug 22, 2020
@astraelise
Copy link

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
Copy link
Owner

krlvm commented Sep 26, 2020

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.

@TillKnollmann
Copy link

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!

@KibSquib48
Copy link

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

@astraelise
Copy link

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 krlvm self-assigned this Mar 9, 2021
@krlvm
Copy link
Owner

krlvm commented Mar 9, 2021

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
Copy link
Owner

krlvm commented Mar 20, 2021

I've published a beta version with some limitations.

@astraelise
Copy link

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
Copy link
Owner

krlvm commented Mar 21, 2021

The embedded window does not fit the search section

Can you provide a screenshot, please?

@astraelise
Copy link

The embedded window does not fit the search section

Can you provide a screenshot, please?

image

@senolfndk

This comment has been minimized.

@krlvm

This comment has been minimized.

@SOI7
Copy link

SOI7 commented Feb 15, 2022

Any news on this?

@krlvm
Copy link
Owner

krlvm commented Feb 15, 2022

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
Copy link

SOI7 commented Feb 15, 2022

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
Copy link
Owner

krlvm commented Feb 15, 2022

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

@NicholasBottone
Copy link

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
Copy link
Owner

krlvm commented Apr 1, 2022

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
Copy link

SOI7 commented Apr 1, 2022

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
Copy link
Owner

krlvm commented Apr 1, 2022

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.

@rcmaehl
Copy link

rcmaehl commented May 17, 2022

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
Copy link
Owner

krlvm commented May 17, 2022

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.

@rcmaehl
Copy link

rcmaehl commented Jul 5, 2022

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
Copy link
Owner

krlvm commented Jul 5, 2022

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.

@TechLionDev
Copy link

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

@Poopooracoocoo
Copy link

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

@XPower7125

This comment was marked as spam.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request question Further information is requested
Projects
None yet
Development

No branches or pull requests