Skip to content

Commit 0916586

Browse files
committed
Replace Google Image Search with Google Lens because Google removed the old reverse search
Migration will be applied automatically for current users
1 parent 5cd55be commit 0916586

File tree

4 files changed

+22
-2
lines changed

4 files changed

+22
-2
lines changed

CHANGES.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changelog
22

3+
## 4.1.2
4+
5+
- Replace Google Image Search with Google Lens because Google removed the old reverse search. This will also apply to current users.
6+
37
## 4.1.1
48

59
- Add Content-Security-Policy for options page

source/default-options.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
{
99
"name": "Google",
1010
"icon": "icons/google.png",
11-
"url": "https://www.google.com/searchbyimage?image_url=%s",
11+
"url": "https://lens.google.com/uploadbyurl?url=%s",
1212
"selected": true
1313
},
1414
{

source/service-worker/service-worker-functions.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,21 @@ import { getMessage } from '../utils.js';
44
const PARENT_ID = 'Image-Reverse-Search';
55
const OPEN_ALL_ID = 'openAll';
66

7+
export const migrate = async (options) => {
8+
// v4.1.2: Use new Google Image Search URL
9+
for (const storageProvider of options.storageProviders) {
10+
if (
11+
storageProvider.url ===
12+
'https://www.google.com/searchbyimage?image_url=%s'
13+
) {
14+
storageProvider.url = 'https://lens.google.com/uploadbyurl?url=%s';
15+
}
16+
}
17+
18+
await chrome.storage.sync.set(options);
19+
return options;
20+
};
21+
722
export const setupContextMenu = ({
823
storageProviders,
924
showOpenAll,

source/service-worker/service-worker.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
import defaultOptions from '../default-options.json';
22
import {
3+
migrate,
34
onReverseSearch,
45
setupContextMenu,
56
} from './service-worker-functions.js';
67

78
chrome.runtime.onInstalled.addListener(() =>
8-
chrome.storage.sync.get(defaultOptions).then(setupContextMenu)
9+
chrome.storage.sync.get(defaultOptions).then(migrate).then(setupContextMenu)
910
);
1011

1112
chrome.contextMenus.onClicked.addListener(onReverseSearch);

0 commit comments

Comments
 (0)