ESLint fixes

main
Elbert Alias 6 years ago
parent eca77528d6
commit e59ac69979

@ -51,7 +51,7 @@
"https://www.alphaecommerce.gr/*" "https://www.alphaecommerce.gr/*"
], ],
"js": [ "js": [
"lib/js/iframe.js" "js/lib/iframe.js"
], ],
"run_at": "document_start", "run_at": "document_start",
"all_frames": true "all_frames": true

@ -69,10 +69,11 @@ function addDetected(app, pattern, type, value, key) {
function resolveExcludes(apps, detected) { function resolveExcludes(apps, detected) {
const excludes = []; const excludes = [];
const detectedApps = Object.assign({}, apps, detected);
// Exclude app in detected apps only // Exclude app in detected apps only
Object.keys(Object.assign({}, apps, detected)).forEach((appName) => { Object.keys(detectedApps).forEach((appName) => {
const app = apps[appName]; const app = detectedApps[appName];
if (app.props.excludes) { if (app.props.excludes) {
asArray(app.props.excludes).forEach((excluded) => { asArray(app.props.excludes).forEach((excluded) => {
@ -106,7 +107,7 @@ class Application {
getConfidence() { getConfidence() {
let total = 0; let total = 0;
Object.values(this.confidence).forEach((id) => { Object.keys(this.confidence).forEach((id) => {
total += this.confidence[id]; total += this.confidence[id];
}); });
@ -556,14 +557,26 @@ class Wappalyzer {
const patterns = this.parsePatterns(app.props.meta); const patterns = this.parsePatterns(app.props.meta);
const promises = []; const promises = [];
if (!app.props.meta) {
return Promise.resolve();
}
let matches; let matches;
while (patterns && (matches = regex.exec(html))) { do {
patterns.forEach((meta) => { matches = regex.exec(html);
if (!matches) {
break;
}
const [match] = matches;
Object.keys(patterns).forEach((meta) => {
const r = new RegExp(`(?:name|property)=["']${meta}["']`, 'i'); const r = new RegExp(`(?:name|property)=["']${meta}["']`, 'i');
if (r.test(matches[0])) { if (r.test(match)) {
const content = matches[0].match(/content=("|')([^"']+)("|')/i); const content = match.match(/content=("|')([^"']+)("|')/i);
promises.push(asyncForEach(patterns[meta], (pattern) => { promises.push(asyncForEach(patterns[meta], (pattern) => {
if (content && content.length === 4 && pattern.regex.test(content[2])) { if (content && content.length === 4 && pattern.regex.test(content[2])) {
@ -572,9 +585,9 @@ class Wappalyzer {
})); }));
} }
}); });
} } while (matches);
return promises ? Promise.all(promises) : Promise.resolve(); return Promise.all(promises);
} }
/** /**