From f4173c6617a46085e24e520b775142a986daa31b Mon Sep 17 00:00:00 2001 From: viphan007 Date: Mon, 4 Nov 2024 09:47:51 +0700 Subject: [PATCH] fix: update default search engine to google search --- src/components/Autocomplete/index.js | 2 +- src/util/browser.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/Autocomplete/index.js b/src/components/Autocomplete/index.js index 1713a6f..116d32b 100644 --- a/src/components/Autocomplete/index.js +++ b/src/components/Autocomplete/index.js @@ -29,7 +29,7 @@ export default class Autocomplete extends Component { handleSubmit = (event) => { event.preventDefault(); this.trackEventSearchUsed(); - const searchEngine = window.__mmSearchEngine || 'DuckDuckGo'; + const searchEngine = window.__mmSearchEngine; const sanitizedInput = onUrlSubmit(this.state.value, searchEngine); window.location.href = sanitizedInput; } diff --git a/src/util/browser.js b/src/util/browser.js index 3989e41..635631c 100644 --- a/src/util/browser.js +++ b/src/util/browser.js @@ -10,7 +10,7 @@ import URL from 'url-parse'; * @param {string} defaultProtocol - Protocol string to append to URLs that have none * @returns {string} - String corresponding to sanitized input depending if it's a search or url */ -export default function onUrlSubmit(input, searchEngine = 'DuckDuckGo', defaultProtocol = 'https://') { +export default function onUrlSubmit(input, searchEngine, defaultProtocol = 'https://') { //Check if it's a url or a keyword const res = input.match(/^(?:http(s)?:\/\/)?[\w.-]+(?:\.[\w.-]+)+[\w\-._~:/?#[\]@!&',;=.+]+$/g); if (res === null) {