From 323dafd7bd5affa73ce7589fc6e1f443437259e9 Mon Sep 17 00:00:00 2001 From: Elbert Alias <77259+AliasIO@users.noreply.github.com> Date: Mon, 27 Apr 2020 14:52:05 +1000 Subject: [PATCH] Fix technology links in bookmarklet driver --- src/drivers/bookmarklet/driver.js | 43 +++++++++++++------------------ src/drivers/npm/package.json | 2 +- 2 files changed, 19 insertions(+), 26 deletions(-) diff --git a/src/drivers/bookmarklet/driver.js b/src/drivers/bookmarklet/driver.js index 361862657..fdddff2c5 100644 --- a/src/drivers/bookmarklet/driver.js +++ b/src/drivers/bookmarklet/driver.js @@ -1,9 +1,7 @@ -/** - * Bookmarklet driver - */ - -/** global: wappalyzer */ -/** global: XMLHttpRequest */ +/* eslint-env browser */ +/* eslint-disable func-names, no-unused-expressions, no-restricted-globals */ +/* eslint-disable no-restricted-syntax, no-continue */ +/* global wappalyzer */ (function () { wappalyzer.driver.document = document; @@ -16,6 +14,7 @@ * Log messages to console */ wappalyzer.driver.log = (message, source, type) => { + // eslint-disable-next-line no-console console.log(`[wappalyzer ${type}]`, `[${source}]`, message); }; @@ -51,14 +50,14 @@ if (xhr.readyState === 4 && xhr.status) { const headers = xhr.getAllResponseHeaders().split('\n'); - if (headers.length > 0 && headers[0] != '') { + if (headers.length > 0 && headers[0]) { wappalyzer.log(`responseHeaders: ${xhr.getAllResponseHeaders()}`, 'driver'); const responseHeaders = {}; headers.forEach((line) => { - let name, - value; + let name; + let value; if (line) { name = line.substring(0, line.indexOf(': ')); @@ -81,6 +80,10 @@ xhr.send(); } + function slugify(string) { + return string.toLowerCase().replace(/[^a-z0-9-]/g, '-').replace(/--+/g, '-').replace(/(?:^-|-$)/, ''); + } + /** * Display apps */ @@ -103,12 +106,13 @@ continue; } - let version = detected[app].version, - confidence = detected[app].confidence; + const { version, confidence } = detected[app]; + + category = wappalyzer.categories[wappalyzer.apps[app].cats[0]].name; html += `