From 53aec56d57b82bbb167062540bcee1d33120220e Mon Sep 17 00:00:00 2001 From: Elbert Alias <77259+AliasIO@users.noreply.github.com> Date: Fri, 7 Oct 2022 11:09:46 +1100 Subject: [PATCH] Prettify --- src/drivers/webextension/js/driver.js | 54 +++++++++++++++------------ src/drivers/webextension/js/popup.js | 7 ++-- src/drivers/webextension/js/utils.js | 29 +++++++++++++- src/technologies/a.json | 38 +++++++++---------- src/technologies/c.json | 4 +- src/technologies/f.json | 2 +- src/technologies/h.json | 38 +++++++++---------- src/technologies/k.json | 4 +- src/technologies/p.json | 42 ++++++++++----------- src/technologies/s.json | 48 ++++++++++++------------ src/technologies/t.json | 38 +++++++++---------- src/technologies/v.json | 2 +- 12 files changed, 169 insertions(+), 137 deletions(-) diff --git a/src/drivers/webextension/js/driver.js b/src/drivers/webextension/js/driver.js index e863ce8c6..9a426c192 100644 --- a/src/drivers/webextension/js/driver.js +++ b/src/drivers/webextension/js/driver.js @@ -10,7 +10,7 @@ const { resolve, getTechnology, } = Wappalyzer -const { agent, getOption, setOption, open, globEscape } = Utils +const { agent, promisify, getOption, setOption, open, globEscape } = Utils const expiry = 1000 * 60 * 60 * 24 @@ -93,7 +93,7 @@ const Driver = { chrome.tabs.onUpdated.addListener(async (id, { status, url }) => { if (status === 'complete') { - ;({ url } = await chrome.tabs.get(id)) + ;({ url } = await promisify(chrome.tabs, 'get', id)) } if (url) { @@ -335,7 +335,7 @@ const Driver = { }, async content(url, func, args) { - const [tab] = await chrome.tabs.query({ + const [tab] = await promisify(chrome.tabs, 'query', { url: globEscape(url), }) @@ -347,23 +347,29 @@ const Driver = { throw new Error(`Tab ${tab.id} not ready for sendMessage: ${tab.status}`) } - const response = await chrome.tabs.sendMessage(tab.id, { - source: 'driver.js', - func, - args: args ? (Array.isArray(args) ? args : [args]) : [], - }) - - if (chrome.runtime.lastError && func !== 'error') { - Driver.error( - new Error( - `${chrome.runtime.lastError.message}: Driver.${func}(${JSON.stringify( - args - )})` - ) + return new Promise((resolve, reject) => { + chrome.tabs.sendMessage( + tab.id, + { + source: 'driver.js', + func, + args: args ? (Array.isArray(args) ? args : [args]) : [], + }, + (response) => { + chrome.runtime.lastError + ? func === 'error' + ? resolve() + : Driver.error( + new Error( + `${ + chrome.runtime.lastError.message + }: Driver.${func}(${JSON.stringify(args)})` + ) + ) + : resolve(response) + } ) - } else { - return response - } + }) }, /** @@ -381,7 +387,7 @@ const Driver = { try { await new Promise((resolve) => setTimeout(resolve, 500)) - const [tab] = await chrome.tabs.query({ + const [tab] = await promisify(chrome.tabs, 'query', { url: globEscape(request.url), }) @@ -496,7 +502,7 @@ const Driver = { // ;( - await chrome.cookies.getAll({ + await promisify(chrome.cookies, 'getAll', { url, }) ).forEach( @@ -667,7 +673,7 @@ const Driver = { let tabs = [] try { - tabs = await chrome.tabs.query({ + tabs = await promisify(chrome.tabs, 'query', { url: globEscape(url), }) } catch (error) { @@ -728,7 +734,7 @@ const Driver = { let tabs = [] try { - tabs = await chrome.tabs.query({ + tabs = await promisify(chrome.tabs, 'query', { url: globEscape(url), }) } catch (error) { @@ -767,7 +773,7 @@ const Driver = { * Get the detected technologies for the current tab */ async getDetections() { - const tab = await chrome.tabs.query({ + const tab = await promisify(chrome.tabs, 'query', { active: true, currentWindow: true, }) diff --git a/src/drivers/webextension/js/popup.js b/src/drivers/webextension/js/popup.js index 6008db211..6ec9d4642 100644 --- a/src/drivers/webextension/js/popup.js +++ b/src/drivers/webextension/js/popup.js @@ -2,7 +2,8 @@ /* eslint-env browser */ /* globals chrome, Utils */ -const { agent, open, i18n, getOption, setOption, sendMessage } = Utils +const { agent, open, i18n, getOption, setOption, promisify, sendMessage } = + Utils const baseUrl = 'https://www.wappalyzer.com' const utm = '?utm_source=popup&utm_medium=extension&utm_campaign=wappalyzer' @@ -344,7 +345,7 @@ const Popup = { let url - const tabs = await chrome.tabs.query({ + const tabs = await promisify(chrome.tabs, 'query', { active: true, currentWindow: true, }) @@ -961,7 +962,7 @@ const Popup = { new Blob([csv.join('\n')], { type: 'text/csv;charset=utf-8' }) ) - const granted = await chrome.permissions.request({ + const granted = await promisify(chrome.permissions, 'request', { permissions: ['downloads'], }) diff --git a/src/drivers/webextension/js/utils.js b/src/drivers/webextension/js/utils.js index 0f3726b2a..97d1b865f 100644 --- a/src/drivers/webextension/js/utils.js +++ b/src/drivers/webextension/js/utils.js @@ -5,6 +5,13 @@ // Manifest v2 polyfill if (chrome.runtime.getManifest().manifest_version === 2) { chrome.action = chrome.browserAction + + chrome.storage.sync = { + get: (...args) => + new Promise((resolve) => chrome.storage.local.get(...args, resolve)), + set: (...args) => + new Promise((resolve) => chrome.storage.local.set(...args, resolve)), + } } // eslint-disable-next-line no-unused-vars @@ -15,6 +22,24 @@ const Utils = { ? 'safari' : 'chrome', + /** + * Use promises instead of callbacks + * @param {Object} context + * @param {String} method + * @param {...any} args + */ + promisify(context, method, ...args) { + return new Promise((resolve, reject) => { + context[method](...args, (...args) => { + if (chrome.runtime.lastError) { + return reject(chrome.runtime.lastError) + } + + resolve(...args) + }) + }) + }, + /** * Open a browser tab * @param {String} url @@ -31,7 +56,7 @@ const Utils = { */ async getOption(name, defaultValue = null) { try { - const option = await chrome.storage.local.get(name) + const option = await chrome.storage.sync.get(name) if (option[name] !== undefined) { return option[name] @@ -51,7 +76,7 @@ const Utils = { */ async setOption(name, value) { try { - await chrome.storage.local.set({ + await chrome.storage.sync.set({ [name]: value, }) } catch (error) { diff --git a/src/technologies/a.json b/src/technologies/a.json index de8156913..7d6764e60 100644 --- a/src/technologies/a.json +++ b/src/technologies/a.json @@ -91,6 +91,23 @@ "scriptSrc": "\\.ebis\\.ne\\.jp/", "website": "http://www.ebis.ne.jp" }, + "ADAPT": { + "cats": [ + 6 + ], + "description": "ADAPT is a subscription-based app that allows anyone to create video focused online store in minutes on their phone.", + "icon": "ADAPT.svg", + "meta": { + "image": "assets\\.adapt\\.ws/" + }, + "pricing": [ + "low", + "freemium", + "recurring" + ], + "saas": true, + "website": "https://adapt.ws" + }, "ADFOX": { "cats": [ 36 @@ -1116,23 +1133,6 @@ "scriptSrc": "c5\\.adalyser\\.com", "website": "https://adalyser.com/" }, - "ADAPT": { - "cats": [ - 6 - ], - "description": "ADAPT is a subscription-based app that allows anyone to create video focused online store in minutes on their phone.", - "icon": "ADAPT.svg", - "meta": { - "image": "assets\\.adapt\\.ws/" - }, - "saas": true, - "pricing": [ - "low", - "freemium", - "recurring" - ], - "website": "https://adapt.ws" - }, "Adcash": { "cats": [ 36 @@ -4308,20 +4308,20 @@ 106 ], "description": "Azoya helps international brands and retailers sell directly to Chinese consumers through cross-border ecommerce.", - "icon": "Azoya.svg", "excludes": "Magento", "headers": { "x-azoya-webisteid": "" }, + "icon": "Azoya.svg", "js": { "IMAGE_CDN_HOST": "\\.azoyacdn\\.com" }, - "saas": true, "pricing": [ "high", "recurring", "poa" ], + "saas": true, "website": "https://www.azoyagroup.com" }, "Azure": { diff --git a/src/technologies/c.json b/src/technologies/c.json index 2971031e9..b970800b5 100644 --- a/src/technologies/c.json +++ b/src/technologies/c.json @@ -2753,8 +2753,8 @@ "icon": "Convertri.svg", "js": { "CONVERTRI_CONSTANTS": "", - "convertriParameters": "", - "ConvertriAnalytics": "" + "ConvertriAnalytics": "", + "convertriParameters": "" }, "pricing": [ "low", diff --git a/src/technologies/f.json b/src/technologies/f.json index 9854cf14a..6b743cd2d 100644 --- a/src/technologies/f.json +++ b/src/technologies/f.json @@ -1877,10 +1877,10 @@ ], "description": "FurnitureDealer is the internet partner of more than 100 leading local full service brick and mortar furniture retailers.", "icon": "FurnitureDealer.png", - "scriptSrc": "\\.furnituredealer\\.net/", "pricing": [ "poa" ], + "scriptSrc": "\\.furnituredealer\\.net/", "website": "https://www.furnituredealer.net" }, "Fusion Ads": { diff --git a/src/technologies/h.json b/src/technologies/h.json index a16e78e2e..c2a16a40f 100644 --- a/src/technologies/h.json +++ b/src/technologies/h.json @@ -695,6 +695,22 @@ "scriptSrc": "\\.hextom\\.com/js/ultimatesalesboost\\.js", "website": "https://hextom.com/case_study/ultimate-sales-boost" }, + "Hi Platform": { + "cats": [ + 53 + ], + "description": "Hi Platform provider of an online customer relationship platform.", + "dom": "link[href*='.hiplatform.com']", + "icon": "Hi Platform.svg", + "pricing": [ + "mid", + "recurring", + "poa" + ], + "saas": true, + "scriptSrc": "\\.hiplatform\\.com/", + "website": "https://www.hiplatform.com" + }, "Hiawatha": { "cats": [ 22 @@ -777,22 +793,6 @@ }, "website": "http://hinzaco.com" }, - "Hi Platform": { - "cats": [ - 53 - ], - "description": "Hi Platform provider of an online customer relationship platform.", - "icon": "Hi Platform.svg", - "dom": "link[href*='.hiplatform.com']", - "saas": true, - "pricing": [ - "mid", - "recurring", - "poa" - ], - "scriptSrc": "\\.hiplatform\\.com/", - "website": "https://www.hiplatform.com" - }, "Hireology": { "cats": [ 101 @@ -1363,15 +1363,15 @@ 12 ], "description": "Hydrogen is a front-end web development framework used for building Shopify custom storefronts.", + "headers": { + "powered-by": "^Shopify-Hydrogen$" + }, "icon": "Hydrogen.svg", "implies": [ "Shopify", "React", "Vite" ], - "headers": { - "powered-by": "^Shopify-Hydrogen$" - }, "oss": true, "website": "https://hydrogen.shopify.dev" }, diff --git a/src/technologies/k.json b/src/technologies/k.json index 2e08d99d8..3180d12c1 100644 --- a/src/technologies/k.json +++ b/src/technologies/k.json @@ -396,11 +396,11 @@ ], "description": "Ketch is a data control platform that manages compliance with privacy regulations.", "icon": "Ketch.svg", - "saas": true, - "scriptSrc": "\\.ketchcdn\\.com/", "pricing": [ "poa" ], + "saas": true, + "scriptSrc": "\\.ketchcdn\\.com/", "website": "https://www.ketch.com" }, "Kevel": { diff --git a/src/technologies/p.json b/src/technologies/p.json index c01f2ca6d..ede8ba97a 100644 --- a/src/technologies/p.json +++ b/src/technologies/p.json @@ -1097,17 +1097,6 @@ "scriptSrc": "cdn\\.perzonalization\\.com", "website": "https://www.perzonalization.com/" }, - "petite-vue": { - "cats": [ - 19 - ], - "description": "petite-vue is an alternative distribution of Vue optimised for progressive enhancement.", - "icon": "vue.svg", - "oss": true, - "scripts": "/petite-vue@([\\d\\.]+)/\\;version:\\1", - "scriptSrc": "/petite-vue", - "website": "https://github.com/vuejs/petite-vue" - }, "Phabricator": { "cats": [ 13, @@ -2946,6 +2935,16 @@ "scriptSrc": "api\\.pushnami\\.com", "website": "https://pushnami.com" }, + "PyScript": { + "cats": [ + 19 + ], + "description": "PyScript is a python script that can be run in the browser using a mix of Python and standard HTML.", + "dom": "py-script", + "icon": "PyScript.svg", + "oss": true, + "website": "https://pyscript.net" + }, "Pygments": { "cats": [ 19 @@ -2969,16 +2968,6 @@ "implies": "Laravel", "website": "http://pyrocms.com" }, - "PyScript": { - "cats": [ - 19 - ], - "description": "PyScript is a python script that can be run in the browser using a mix of Python and standard HTML.", - "icon": "PyScript.svg", - "dom": "py-script", - "oss": true, - "website": "https://pyscript.net" - }, "Python": { "cats": [ 27 @@ -3042,6 +3031,17 @@ "scriptSrc": "/particles(?:\\.min)?\\.js", "website": "https://github.com/VincentGarreau/particles.js" }, + "petite-vue": { + "cats": [ + 19 + ], + "description": "petite-vue is an alternative distribution of Vue optimised for progressive enhancement.", + "icon": "vue.svg", + "oss": true, + "scriptSrc": "/petite-vue", + "scripts": "/petite-vue@([\\d\\.]+)/\\;version:\\1", + "website": "https://github.com/vuejs/petite-vue" + }, "phpAlbum": { "cats": [ 7 diff --git a/src/technologies/s.json b/src/technologies/s.json index f79500b2e..2d949ff03 100644 --- a/src/technologies/s.json +++ b/src/technologies/s.json @@ -180,20 +180,6 @@ "implies": "Joomla", "website": "http://www.sigsiu.net/sobi2.html" }, - "Spatie Support Bubble": { - "cats": [ - 52 - ], - "description": "Spatie Support Bubble is a non-intrusive support form.", - "icon": "Spatie.png", - "implies": [ - "Laravel", - "Tailwind CSS" - ], - "dom": "div.spatie-support-bubble", - "oss": true, - "website": "https://github.com/spatie/laravel-support-bubble" - }, "SPDY": { "cats": [ 19 @@ -1338,14 +1324,14 @@ "PHP", "Vue.js" ], + "js": { + "webpackChunkselldone": "" + }, "meta": { - "selldone-iframe": "", "selldone-capi": "", + "selldone-cdn-id": "", "selldone-cdn-images": "", - "selldone-cdn-id": "" - }, - "js": { - "webpackChunkselldone": "" + "selldone-iframe": "" }, "pricing": [ "payg" @@ -1904,22 +1890,22 @@ 1, 6 ], - "description": "Shift4Shop, formerly known as 3Dcart, is an ecommerce software provider for online businesses.", - "icon": "Shift4Shop.svg", "cookies": { "3dvisit": "" }, + "description": "Shift4Shop, formerly known as 3Dcart, is an ecommerce software provider for online businesses.", "headers": { "X-Powered-By": "3DCART" }, + "icon": "Shift4Shop.svg", "js": { "_3d_cart.subtotal": "" }, - "scriptSrc": "(?:twlh(?:track)?\\.asp|3d_upsell\\.js)", - "saas": true, "pricing": [ "payg" ], + "saas": true, + "scriptSrc": "(?:twlh(?:track)?\\.asp|3d_upsell\\.js)", "website": "https://www.shift4shop.com" }, "Shiny": { @@ -4269,6 +4255,20 @@ "icon": "SparkPost.svg", "website": "https://www.sparkpost.com/" }, + "Spatie Support Bubble": { + "cats": [ + 52 + ], + "description": "Spatie Support Bubble is a non-intrusive support form.", + "dom": "div.spatie-support-bubble", + "icon": "Spatie.png", + "implies": [ + "Laravel", + "Tailwind CSS" + ], + "oss": true, + "website": "https://github.com/spatie/laravel-support-bubble" + }, "Speed Kit": { "cats": [ 92 @@ -6129,4 +6129,4 @@ }, "website": "https://styled-components.com" } -} +} \ No newline at end of file diff --git a/src/technologies/t.json b/src/technologies/t.json index 81ee7f940..af8568e1a 100644 --- a/src/technologies/t.json +++ b/src/technologies/t.json @@ -828,11 +828,11 @@ ], "description": "Tern is a plug and play ecommerce app, built for Shopify, that offers merchants the ability to provide a seamless trade-in service.", "icon": "Tern.png", - "requires": "Shopify", - "scriptSrc": "live\\.tern-returns\\.eastsideapps\\.io/", "pricing": [ "payg" ], + "requires": "Shopify", + "scriptSrc": "live\\.tern-returns\\.eastsideapps\\.io/", "website": "https://www.tern.eco" }, "TerriaJS": { @@ -2344,23 +2344,6 @@ ], "website": "https://www.transunion.com/solution/truvalidate" }, - "TryNow": { - "cats": [ - 91 - ], - "description": "TryNow is an ecommerce platform designed to offer a try before you buy experience for shoppers.", - "icon": "TryNow.svg", - "js": { - "TryNowConfig": "", - "tryNowCheckout": "" - }, - "pricing": [ - "poa" - ], - "saas": true, - "scriptSrc": "\\.trynow\\.net/shopify/([\\d\\.]+)/\\;version:\\1", - "website": "https://www.trynow.io" - }, "True Fit": { "cats": [ 76 @@ -2521,6 +2504,23 @@ "saas": true, "website": "https://site.trustvox.com.br" }, + "TryNow": { + "cats": [ + 91 + ], + "description": "TryNow is an ecommerce platform designed to offer a try before you buy experience for shoppers.", + "icon": "TryNow.svg", + "js": { + "TryNowConfig": "", + "tryNowCheckout": "" + }, + "pricing": [ + "poa" + ], + "saas": true, + "scriptSrc": "\\.trynow\\.net/shopify/([\\d\\.]+)/\\;version:\\1", + "website": "https://www.trynow.io" + }, "Tumblr": { "cats": [ 11 diff --git a/src/technologies/v.json b/src/technologies/v.json index 6cb94e9bb..6e40d0942 100644 --- a/src/technologies/v.json +++ b/src/technologies/v.json @@ -1037,4 +1037,4 @@ }, "website": "http://vibecommerce.com.br" } -} +} \ No newline at end of file