From 817ddd51bfe9818564fbdd17a8d167e307d36f9c Mon Sep 17 00:00:00 2001 From: Tuxedo Takodachi Date: Sat, 18 Mar 2023 10:39:48 +0100 Subject: [PATCH] Port: Avoid breaking sauce settings of people with links to original Google Images and Google Lens, provided they didn't already update to v1.14.22.3. from 7295b21b73eb13ec53fdc61767ada341c2e13144 --- src/General/Settings.tsx | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/src/General/Settings.tsx b/src/General/Settings.tsx index 986e612bd..fe1e0ef4d 100644 --- a/src/General/Settings.tsx +++ b/src/General/Settings.tsx @@ -798,17 +798,12 @@ vp-replace set('archiveLists', data['archiveLists'].replace('https://nstepien.github.io/archives.json/archives.json', 'https://4chenz.github.io/archives.json/archives.json')); } } - if (compareString < '00001.00014.00022.00002') { - if (data['sauces']) { - set('sauces', data['sauces'].replace(/^#?\s*https:\/\/www\.google\.com\/searchbyimage\?image_url=%(IMG|T?URL)&safe=off(?=$|;)/mg, 'https://lens.google.com/uploadbyurl?url=%$1')); - } - } if (compareString < '00001.00014.00022.00003') { if (data['sauces']) { - set('sauces', data['sauces'].replace(/^#?\s*https:\/\/lens\.google\.com\/uploadbyurl\?url=%(IMG|T?URL)(?=$|;)/mg, 'https://www.google.com/searchbyimage?sbisrc=4chanx&image_url=%$1&safe=off')); - addSauces([ - '#https://lens.google.com/uploadbyurl?url=%IMG;text:lens' - ]); + set('sauces', data['sauces'].replace(/^#?\s*https:\/\/www\.google\.com\/searchbyimage\?image_url=%(IMG|T?URL)&safe=off(?=$|;)/mg, 'https://www.google.com/searchbyimage?sbisrc=4chanx&image_url=%$1&safe=off')); + if (compareString === '00001.00014.00022.00002' && !/\bsbisrc=/.test(data['sauces'])) { + set('sauces', data['sauces'].replace(/^#?\s*https:\/\/lens\.google\.com\/uploadbyurl\?url=%(IMG|T?URL)(?=$|;)/m, 'https://www.google.com/searchbyimage?sbisrc=4chanx&image_url=%$1&safe=off')); + } } } return changes;