From e14f84d1bbf642ab95c05330dc05cb4b953083ea Mon Sep 17 00:00:00 2001 From: rift <117926989+Riftriot@users.noreply.github.com> Date: Wed, 27 Dec 2023 17:14:12 -0600 Subject: [PATCH] Search engines --- src/locales/en.json | 4 ++++ src/locales/es.json | 4 ++++ src/locales/ja.json | 4 ++++ src/pages/ProxyFrame.tsx | 4 +++- src/pages/Settings/Proxy.tsx | 17 ++++++++++++++++- 5 files changed, 31 insertions(+), 2 deletions(-) diff --git a/src/locales/en.json b/src/locales/en.json index 9c9a303..3bfcddf 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -47,6 +47,10 @@ "cloaking": { "title": "Cloaking", "subtitle": "Choose how your tab looks" + }, + "search": { + "title": "Search Engine", + "subtitle": "Choose your search engine" } }, "titles": { diff --git a/src/locales/es.json b/src/locales/es.json index 06d50f8..41b28b6 100644 --- a/src/locales/es.json +++ b/src/locales/es.json @@ -47,6 +47,10 @@ "cloaking": { "title": "Encubrimiento", "subtitle": "Elige cómo se ve tu pestaña" + }, + "search": { + "title": "Motor de búsqueda", + "subtitle": "Elija su motor de búsqueda para Nebula." } }, "titles": { diff --git a/src/locales/ja.json b/src/locales/ja.json index a342b69..5d59edf 100644 --- a/src/locales/ja.json +++ b/src/locales/ja.json @@ -47,6 +47,10 @@ "cloaking": { "title": "クローキング", "subtitle": "タブの見た目を選択する" + }, + "search": { + "title": "検索エンジン", + "subtitle": "ネビュラの検索エンジンを選択してください" } }, "titles": { diff --git a/src/pages/ProxyFrame.tsx b/src/pages/ProxyFrame.tsx index 2b8d3b6..6dd0a8c 100644 --- a/src/pages/ProxyFrame.tsx +++ b/src/pages/ProxyFrame.tsx @@ -20,12 +20,14 @@ export function ProxyFrame(props: { url: string }) { // pass the URL encoded with encodeURIcomponent const localProxy = localStorage.getItem("proxy") || "automatic"; const proxyMode = localStorage.getItem("proxyMode") || "embed"; + const searchEngine = + localStorage.getItem("searchEngine") || "https://google.com/search?q=%s"; const [ProxiedUrl, setProxiedUrl] = useState(undefined); let decodedUrl = decodeURIComponent(props.url); //attempt to convert to a valid url - decodedUrl = searchUtil(decodedUrl, "https://google.com/search?q=%s"); + decodedUrl = searchUtil(decodedUrl, searchEngine); let proxyRef; diff --git a/src/pages/Settings/Proxy.tsx b/src/pages/Settings/Proxy.tsx index 155d7d6..82ae735 100644 --- a/src/pages/Settings/Proxy.tsx +++ b/src/pages/Settings/Proxy.tsx @@ -19,6 +19,12 @@ const Proxy = ({ id, active }) => { { id: "aboutblank", label: t("settings.proxymodes.aboutblank") } ]; + const searchEngines = [ + { id: "https://google.com/search?q=%s", label: "Google" }, + { id: "https://bing.com/search?q=%s", label: "Bing" }, + { id: "https://duckduckgo.com/?q=%s", label: "DuckDuckGo" } + ]; + return ( { >
{t("settings.proxy.title")}
@@ -46,6 +52,15 @@ const Proxy = ({ id, active }) => { refresh={false} />
+
+
{t("settings.search.title")}
+
{t("settings.search.subtitle")}
+ +
);