From 6e8edfaf0302d0ae1376de7fbf0cbaab128333a3 Mon Sep 17 00:00:00 2001 From: Elbert Alias <77259+AliasIO@users.noreply.github.com> Date: Wed, 16 Nov 2022 09:51:05 +1100 Subject: [PATCH] Fix Magento detection; --- src/drivers/webextension/js/driver.js | 15 +++++++++------ src/technologies/m.json | 5 +++-- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/src/drivers/webextension/js/driver.js b/src/drivers/webextension/js/driver.js index c2782fa94..db1fc8205 100644 --- a/src/drivers/webextension/js/driver.js +++ b/src/drivers/webextension/js/driver.js @@ -46,8 +46,6 @@ function isSimilarUrl(a, b) { } const Driver = { - lastPing: Date.now(), - /** * Initialise driver */ @@ -853,7 +851,7 @@ const Driver = { ) if (!response.ok) { - Driver.error(new Error(response.statusText)) + Driver.log(`getRobots: ${response.statusText} (${hostname})`) resolve('') } @@ -978,7 +976,14 @@ const Driver = { const count = Object.keys(urls).length - if (count && (count >= 25 || Driver.lastPing < Date.now() - expiry)) { + const lastPing = await getOption('lastPing', Date.now()) + + if ( + count && + (count >= 25 || (count >= 5 && lastPing < Date.now() - expiry)) + ) { + await setOption('lastPing', Date.now()) + try { await Driver.post('https://api.wappalyzer.com/v2/ping/', { version: chrome.runtime.getManifest().version, @@ -992,8 +997,6 @@ const Driver = { Object.keys(Driver.cache.hostnames).forEach((hostname) => { Driver.cache.hostnames[hostname].hits = 0 }) - - Driver.lastPing = Date.now() } if (Driver.cache.ads.length > 25) { diff --git a/src/technologies/m.json b/src/technologies/m.json index d1ac98eb2..4397242ca 100644 --- a/src/technologies/m.json +++ b/src/technologies/m.json @@ -306,7 +306,8 @@ "oss": true, "scriptSrc": [ "js/mage", - "skin/frontend/(?:default|(enterprise))\\;version:\\1?Enterprise:Community", + "skin/frontend/(?:default|(enterprise))\\;version:\\1?1 (Enterprise):1 (Community)", + "skin/frontend/\\;confidence:50\\;version:\\1", "static/_requirejs\\;confidence:50\\;version:2" ], "website": "https://magento.com" @@ -3146,4 +3147,4 @@ ], "website": "https://code.google.com/p/modwsgi" } -} \ No newline at end of file +}