ReplaceGoogleSearch: improve search engine selection (#2620)

Co-authored-by: vee <vendicated@riseup.net>
This commit is contained in:
Oliver Anderson 2024-06-26 04:57:18 -06:00 committed by GitHub
parent d61a930b99
commit 32c2128c5b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -13,13 +13,12 @@ import { Flex, Menu } from "@webpack/common";
const DefaultEngines = { const DefaultEngines = {
Google: "https://www.google.com/search?q=", Google: "https://www.google.com/search?q=",
DuckDuckGo: "https://duckduckgo.com/", DuckDuckGo: "https://duckduckgo.com/",
Brave: "https://search.brave.com/search?q=",
Bing: "https://www.bing.com/search?q=", Bing: "https://www.bing.com/search?q=",
Yahoo: "https://search.yahoo.com/search?p=", Yahoo: "https://search.yahoo.com/search?p=",
GitHub: "https://github.com/search?q=",
Kagi: "https://kagi.com/search?q=",
Yandex: "https://yandex.com/search/?text=", Yandex: "https://yandex.com/search/?text=",
AOL: "https://search.aol.com/aol/search?q=", GitHub: "https://github.com/search?q=",
Baidu: "https://www.baidu.com/s?wd=", Reddit: "https://www.reddit.com/search?q=",
Wikipedia: "https://wikipedia.org/w/index.php?search=", Wikipedia: "https://wikipedia.org/w/index.php?search=",
} as const; } as const;
@ -55,7 +54,7 @@ function makeSearchItem(src: string) {
key="search-text" key="search-text"
id="vc-search-text" id="vc-search-text"
> >
{Object.keys(Engines).map((engine, i) => { {Object.keys(Engines).map(engine => {
const key = "vc-search-content-" + engine; const key = "vc-search-content-" + engine;
return ( return (
<Menu.MenuItem <Menu.MenuItem
@ -70,7 +69,7 @@ function makeSearchItem(src: string) {
aria-hidden="true" aria-hidden="true"
height={16} height={16}
width={16} width={16}
src={`https://www.google.com/s2/favicons?domain=${Engines[engine]}`} src={`https://www.google.com/s2/favicons?domain=${Engines[engine]}&sz=64`}
/> />
{engine} {engine}
</Flex> </Flex>