diff --git a/src/assets/icons/engines/google.svg b/src/assets/icons/engines/google.svg deleted file mode 100755 index 2db64b3..0000000 --- a/src/assets/icons/engines/google.svg +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/assets/icons/engines/yahoo-dark.svg b/src/assets/icons/engines/yahoo-dark.svg deleted file mode 100755 index 3b878f3..0000000 --- a/src/assets/icons/engines/yahoo-dark.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/src/assets/icons/engines/yahoo.svg b/src/assets/icons/engines/yahoo.svg deleted file mode 100755 index b3ecd1c..0000000 --- a/src/assets/icons/engines/yahoo.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/src/assets/locales/en/messages-firefox.json b/src/assets/locales/en/messages-firefox.json index e3db82e..ee1fa26 100644 --- a/src/assets/locales/en/messages-firefox.json +++ b/src/assets/locales/en/messages-firefox.json @@ -1,9 +1,4 @@ { - "engineName_googleText": { - "message": "Google (Text-Only)", - "description": "Name of the search engine." - }, - "engineName_archiveIsAll": { "message": "Archive.is (All)", "description": "Name of the search engine." @@ -14,11 +9,6 @@ "description": "Name of the search engine." }, - "menuItemTitle_googleText": { - "message": "Google (Text-Only)", - "description": "Name of the search engine." - }, - "menuItemTitle_archiveIsAll": { "message": "Archive.is (All)", "description": "Name of the search engine." @@ -45,7 +35,7 @@ "placeholders": { "engine": { "content": "$1", - "example": "Google" + "example": "Wayback Machine" } } }, @@ -60,11 +50,6 @@ "description": "Title of the options section." }, - "optionTitle_googleText": { - "message": "Google Cache (Text-Only)", - "description": "Title of the option." - }, - "optionTitle_archiveOrgAll": { "message": "Wayback Machine (All)", "description": "Title of the option." diff --git a/src/assets/locales/en/messages-safari.json b/src/assets/locales/en/messages-safari.json index ef0f4f8..b1643a5 100644 --- a/src/assets/locales/en/messages-safari.json +++ b/src/assets/locales/en/messages-safari.json @@ -4,11 +4,6 @@ "description": "Description of the extension." }, - "engineName_googleText": { - "message": "Google (Text-Only)", - "description": "Name of the search engine." - }, - "engineName_archiveIsAll": { "message": "Archive.is (All)", "description": "Name of the search engine." @@ -19,11 +14,6 @@ "description": "Name of the search engine." }, - "menuItemTitle_googleText": { - "message": "Google (Text-Only)", - "description": "Title of the menu item." - }, - "menuItemTitle_archiveIsAll": { "message": "Archive.is (All)", "description": "Title of the menu item." @@ -50,7 +40,7 @@ "placeholders": { "engine": { "content": "$1", - "example": "Google" + "example": "Wayback Machine" } } }, @@ -65,11 +55,6 @@ "description": "Title of the options section." }, - "optionTitle_googleText": { - "message": "Google Cache (Text-Only)", - "description": "Title of the option." - }, - "optionTitle_archiveOrgAll": { "message": "Wayback Machine (All)", "description": "Title of the option." diff --git a/src/assets/locales/en/messages.json b/src/assets/locales/en/messages.json index e466257..cb5bfd1 100644 --- a/src/assets/locales/en/messages.json +++ b/src/assets/locales/en/messages.json @@ -5,20 +5,10 @@ }, "extensionDescription": { - "message": "View archived and cached versions of web pages on 10+ search engines, such as the Wayback Machine, Archive.is and Google.", + "message": "View archived and cached versions of web pages on 10+ search engines, such as the Wayback Machine and Archive.is.", "description": "Description of the extension." }, - "engineName_google": { - "message": "Google", - "description": "Name of the search engine." - }, - - "engineName_googleText": { - "message": "Google (text-only)", - "description": "Name of the search engine." - }, - "engineName_bing": { "message": "Bing", "description": "Name of the search engine." @@ -59,11 +49,6 @@ "description": "Name of the search engine." }, - "engineName_yahoo": { - "message": "Yahoo", - "description": "Name of the search engine." - }, - "engineName_permacc": { "message": "Perma.cc", "description": "Name of the search engine." @@ -95,21 +80,11 @@ "placeholders": { "engine": { "content": "$1", - "example": "Google" + "example": "Wayback Machine" } } }, - "menuItemTitle_google": { - "message": "Google", - "description": "Title of the menu item." - }, - - "menuItemTitle_googleText": { - "message": "Google (text-only)", - "description": "Title of the menu item." - }, - "menuItemTitle_bing": { "message": "Bing", "description": "Title of the menu item." @@ -150,11 +125,6 @@ "description": "Title of the menu item." }, - "menuItemTitle_yahoo": { - "message": "Yahoo", - "description": "Title of the menu item." - }, - "menuItemTitle_permacc": { "message": "Perma.cc", "description": "Title of the menu item." @@ -186,7 +156,7 @@ "placeholders": { "engine": { "content": "$1", - "example": "Google" + "example": "Wayback Machine" } } }, @@ -206,16 +176,6 @@ "description": "Description of the options section." }, - "optionTitle_google": { - "message": "Google Cache", - "description": "Title of the option." - }, - - "optionTitle_googleText": { - "message": "Google Cache (text-only)", - "description": "Title of the option." - }, - "optionTitle_bing": { "message": "Bing Cache", "description": "Title of the option." @@ -256,11 +216,6 @@ "description": "Title of the option." }, - "optionTitle_yahoo": { - "message": "Yahoo Cache", - "description": "Title of the option." - }, - "optionTitle_permacc": { "message": "Perma.cc", "description": "Title of the option." @@ -552,7 +507,7 @@ "placeholders": { "engine": { "content": "$1", - "example": "Google" + "example": "Wayback Machine" } } }, @@ -563,7 +518,7 @@ "placeholders": { "engine": { "content": "$1", - "example": "Google" + "example": "Wayback Machine" } } }, diff --git a/src/background/main.js b/src/background/main.js index b752e63..f748ca6 100644 --- a/src/background/main.js +++ b/src/background/main.js @@ -45,7 +45,6 @@ import { pageArchiveHosts, linkArchiveHosts, linkArchiveUrlRx, - chromeMobileUA, chromeDesktopUA } from 'utils/data'; import {targetEnv, mv3} from 'utils/config'; @@ -625,11 +624,7 @@ async function setTabUserAgent({tabId, tabUrl, userAgent, beaconToken} = {}) { async function getRequiredUserAgent(engine) { if (await isMobile()) { - // Google only works with a Chrome user agent on Firefox for Android, - // while other search engines may need a desktop user agent. - if (targetEnv === 'firefox' && ['google', 'googleText'].includes(engine)) { - return chromeMobileUA; - } else if (['yandex', 'bing', 'yahoo'].includes(engine)) { + if (['yandex', 'bing'].includes(engine)) { return chromeDesktopUA; } } @@ -653,14 +648,7 @@ async function openCurrentDoc({linkUrl} = {}) { for (const [engine, rx] of Object.entries(linkArchiveUrlRx)) { const match = linkUrl.match(rx); if (match) { - if (engine === 'google') { - const data = new URL(linkUrl).searchParams.get('q'); - if (data) { - docUrl = data.replace(/^cache.*?(https?:\/\/.*)$/, '$1').trim(); - } - } else { - docUrl = match[1].trim(); - } + docUrl = match[1].trim(); break; } diff --git a/src/engines/yahoo.js b/src/engines/yahoo.js deleted file mode 100644 index aaddef0..0000000 --- a/src/engines/yahoo.js +++ /dev/null @@ -1,43 +0,0 @@ -import {validateUrl} from 'utils/app'; -import {findNode, runOnce} from 'utils/common'; -import {initSearch, sendReceipt} from 'utils/engines'; - -const engine = 'yahoo'; - -async function search({session, search, doc, storageIds}) { - const button = await findNode( - '#results li div.options-toggle span.chevron-down', - {throwError: false} - ); - - if (button) { - button.click(); - - const node = await findNode( - '#results li a[href*="cc.bingj.com/cache"], #results li a[href*="cc.bingj.com%2fcache"]', - {throwError: false, timeout: 1000} - ); - - await sendReceipt(storageIds); - - if (node) { - const tabUrl = node.href; - - if (validateUrl(tabUrl)) { - window.location.href = tabUrl; - } - } - } else { - await sendReceipt(storageIds); - } -} - -function init() { - if (!window.location.hostname.startsWith('consent.')) { - initSearch(search, engine, taskId); - } -} - -if (runOnce('search')) { - init(); -} diff --git a/src/storage/config.json b/src/storage/config.json index 6860324..3458a1b 100755 --- a/src/storage/config.json +++ b/src/storage/config.json @@ -17,10 +17,9 @@ "20230715152710_add_ghostarchive", "20230718120215_add_webcite", "20240514170322_add_appversion", - "20240619180111_add_menuchangeevent" + "20240619180111_add_menuchangeevent", + "20240928183956_remove_search_engines" ], - "session": [ - "20240514122825_initial_version" - ] + "session": ["20240514122825_initial_version"] } } diff --git a/src/storage/revisions/local/20240928183956_remove_search_engines.js b/src/storage/revisions/local/20240928183956_remove_search_engines.js new file mode 100644 index 0000000..00b3a9a --- /dev/null +++ b/src/storage/revisions/local/20240928183956_remove_search_engines.js @@ -0,0 +1,30 @@ +const message = 'Remove search engines'; + +const revision = '20240928183956_remove_search_engines'; + +async function upgrade(context) { + const changes = {}; + const {engines, disabledEngines} = await browser.storage.local.get([ + 'engines', + 'disabledEngines' + ]); + + const removeEngines = ['google', 'googleText', 'yahoo']; + const enableEngines = []; + + if (context.install) { + enableEngines.push('ghostarchive', 'webcite'); + } + + changes.engines = engines.filter(function (item) { + return !removeEngines.includes(item); + }); + changes.disabledEngines = disabledEngines.filter(function (item) { + return !removeEngines.includes(item) && !enableEngines.includes(item); + }); + + changes.storageVersion = revision; + return browser.storage.local.set(changes); +} + +export {message, revision, upgrade}; diff --git a/src/tools/main.js b/src/tools/main.js index 3a7579c..9bff6fd 100644 --- a/src/tools/main.js +++ b/src/tools/main.js @@ -31,10 +31,6 @@ function main() { docUrl = document.querySelector( '#HEADER form[action*="/search/"] input[type=text]' )?.value; - } else if (engine === 'google') { - docUrl = document.querySelector( - '[id*="google-cache-hdr"] > div > span > a' - )?.href; } else if (engine === 'bing') { docUrl = document.querySelector( 'div.b_vPanel > div > strong > a[h*="ID=SERP"]' diff --git a/src/utils/data.js b/src/utils/data.js index 826372d..99d01c9 100755 --- a/src/utils/data.js +++ b/src/utils/data.js @@ -26,13 +26,6 @@ const engines = { archiveOrgAll: { target: 'https://web.archive.org/web/*/{url}' }, - google: { - target: 'https://webcache.googleusercontent.com/search?q=cache:{url}' - }, - googleText: { - target: - 'https://webcache.googleusercontent.com/search?strip=1&q=cache:{url}' - }, bing: { target: 'https://www.bing.com/search?q=url:{url}&go=Search&qs=bs&form=QBRE', isExec: true @@ -54,10 +47,6 @@ const engines = { target: 'https://megalodon.jp/?url={url}', isExec: true }, - yahoo: { - target: 'https://search.yahoo.com/search?p=url:{url}', - isExec: true - }, permacc: { target: searchUrl, isTaskId: true @@ -72,7 +61,6 @@ const engines = { }; const engineIconAlias = { - googleText: 'google', archiveOrgAll: 'archiveOrg', archiveIsAll: 'archiveIs' }; @@ -80,7 +68,6 @@ const engineIconAlias = { const engineIconVariants = { archiveOrg: ['dark'], archiveIs: ['dark'], - yahoo: ['dark'], webcite: ['dark'] }; @@ -128,7 +115,6 @@ const pageArchiveHosts = { 'archive.md', 'archiveiya74codqgiixo33q62qlrqtkgmcitqx5u2oeqnmn5bpcbiyd.onion' ], - google: ['webcache.googleusercontent.com'], bing: ['cc.bingj.com'], yandex: ['yandexwebcache.net'], permacc: ['perma.cc', 'rejouer.perma.cc'], @@ -149,7 +135,6 @@ const linkArchiveHosts = { 'archive.md', 'archiveiya74codqgiixo33q62qlrqtkgmcitqx5u2oeqnmn5bpcbiyd.onion' ], - google: ['webcache.googleusercontent.com'], permacc: ['rejouer.perma.cc'], megalodon: ['megalodon.jp'], ghostarchive: ['ghostarchive.org'] @@ -159,8 +144,6 @@ const linkArchiveUrlRx = { archiveOrg: /^https?:\/\/web\.archive\.org\/web\/[0-9]+\/(.*)/i, archiveIs: /^https?:\/\/(?:archive\.(?:is|today|ph|vn|fo|li|md)|archiveiya74codqgiixo33q62qlrqtkgmcitqx5u2oeqnmn5bpcbiyd.onion)\/o\/.*?\/(.*)/i, - google: - /^https?:\/\/webcache\.googleusercontent\.com\/search.*[?&]q=cache:.*$/i, permacc: /^https:\/\/rejouer\.perma\.cc\/(?:.*)\/mp_\/(.*)/i, megalodon: /https?:\/\/megalodon\.jp\/(?:\d+-)+\d+\/(.*)/i, ghostarchive: /^https:\/\/ghostarchive\.org\/(?:.*)\/mp_\/(.*)/i