|
|
@ -41,7 +41,7 @@ function getOption(name, defaultValue = null) {
|
|
|
|
* Set a value in localStorage
|
|
|
|
* Set a value in localStorage
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
function setOption(name, value) {
|
|
|
|
function setOption(name, value) {
|
|
|
|
var option = {};
|
|
|
|
const option = {};
|
|
|
|
|
|
|
|
|
|
|
|
option[name] = value;
|
|
|
|
option[name] = value;
|
|
|
|
|
|
|
|
|
|
|
@ -68,18 +68,12 @@ function post(url, body) {
|
|
|
|
method: 'POST',
|
|
|
|
method: 'POST',
|
|
|
|
body: JSON.stringify(body)
|
|
|
|
body: JSON.stringify(body)
|
|
|
|
})
|
|
|
|
})
|
|
|
|
.then(response => {
|
|
|
|
.then(response => wappalyzer.log(`POST ${url}: ${response.status}`, 'driver'))
|
|
|
|
wappalyzer.log('POST ' + url + ': ' + response.status, 'driver');
|
|
|
|
.catch(error => wappalyzer.log(`POST ${url}: ${error}`, 'driver', 'error'));
|
|
|
|
})
|
|
|
|
|
|
|
|
.catch(error => {
|
|
|
|
|
|
|
|
wappalyzer.log('POST ' + url + ': ' + error, 'driver', 'error');
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
fetch('../apps.json')
|
|
|
|
fetch('../apps.json')
|
|
|
|
.then(response => {
|
|
|
|
.then(response => response.json())
|
|
|
|
return response.json();
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
.then(json => {
|
|
|
|
.then(json => {
|
|
|
|
wappalyzer.apps = json.apps;
|
|
|
|
wappalyzer.apps = json.apps;
|
|
|
|
wappalyzer.categories = json.categories;
|
|
|
|
wappalyzer.categories = json.categories;
|
|
|
@ -90,12 +84,10 @@ fetch('../apps.json')
|
|
|
|
.map(categoryId => parseInt(categoryId, 10))
|
|
|
|
.map(categoryId => parseInt(categoryId, 10))
|
|
|
|
.sort((a, b) => wappalyzer.categories[a].priority - wappalyzer.categories[b].priority);
|
|
|
|
.sort((a, b) => wappalyzer.categories[a].priority - wappalyzer.categories[b].priority);
|
|
|
|
})
|
|
|
|
})
|
|
|
|
.catch(error => {
|
|
|
|
.catch(error => wappalyzer.log(`GET apps.json: ${error}`, 'driver', 'error'));
|
|
|
|
wappalyzer.log('GET apps.json: ' + error, 'driver', 'error');
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Version check
|
|
|
|
// Version check
|
|
|
|
var version = browser.runtime.getManifest().version;
|
|
|
|
let version = browser.runtime.getManifest().version;
|
|
|
|
|
|
|
|
|
|
|
|
getOption('version')
|
|
|
|
getOption('version')
|
|
|
|
.then(previousVersion => {
|
|
|
|
.then(previousVersion => {
|
|
|
@ -107,12 +99,10 @@ getOption('version')
|
|
|
|
getOption('upgradeMessage', true)
|
|
|
|
getOption('upgradeMessage', true)
|
|
|
|
.then(upgradeMessage => {
|
|
|
|
.then(upgradeMessage => {
|
|
|
|
if (upgradeMessage) {
|
|
|
|
if (upgradeMessage) {
|
|
|
|
/*
|
|
|
|
|
|
|
|
openTab({
|
|
|
|
openTab({
|
|
|
|
url: wappalyzer.config.websiteURL + 'upgraded?v' + version,
|
|
|
|
url: wappalyzer.config.websiteURL + 'upgraded?v' + version,
|
|
|
|
background: true
|
|
|
|
background: true
|
|
|
|
});
|
|
|
|
});
|
|
|
|
*/
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -123,6 +113,8 @@ getOption('version')
|
|
|
|
getOption('dynamicIcon', true);
|
|
|
|
getOption('dynamicIcon', true);
|
|
|
|
getOption('pinnedCategory');
|
|
|
|
getOption('pinnedCategory');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
getOption('hostnameCache', {}).then(hostnameCache => wappalyzer.hostnameCache = hostnameCache);
|
|
|
|
|
|
|
|
|
|
|
|
// Run content script on all tabs
|
|
|
|
// Run content script on all tabs
|
|
|
|
browser.tabs.query({ url: [ 'http://*/*', 'https://*/*' ] })
|
|
|
|
browser.tabs.query({ url: [ 'http://*/*', 'https://*/*' ] })
|
|
|
|
.then(tabs => {
|
|
|
|
.then(tabs => {
|
|
|
@ -170,8 +162,8 @@ browser.webRequest.onCompleted.addListener(request => {
|
|
|
|
wappalyzer.log('Message' + (message.source ? ' from ' + message.source : '') + ': ' + message.id, 'driver');
|
|
|
|
wappalyzer.log('Message' + (message.source ? ' from ' + message.source : '') + ': ' + message.id, 'driver');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
var url = wappalyzer.parseUrl(sender.tab ? sender.tab.url : '');
|
|
|
|
let url = wappalyzer.parseUrl(sender.tab ? sender.tab.url : '');
|
|
|
|
var response;
|
|
|
|
let response;
|
|
|
|
|
|
|
|
|
|
|
|
switch ( message.id ) {
|
|
|
|
switch ( message.id ) {
|
|
|
|
case 'log':
|
|
|
|
case 'log':
|
|
|
@ -186,6 +178,8 @@ browser.webRequest.onCompleted.addListener(request => {
|
|
|
|
case 'analyze':
|
|
|
|
case 'analyze':
|
|
|
|
wappalyzer.analyze(url, message.subject, { tab: sender.tab });
|
|
|
|
wappalyzer.analyze(url, message.subject, { tab: sender.tab });
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
setOption('hostnameCache', wappalyzer.hostnameCache);
|
|
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case 'ad_log':
|
|
|
|
case 'ad_log':
|
|
|
|
wappalyzer.cacheDetectedAds(message.subject);
|
|
|
|
wappalyzer.cacheDetectedAds(message.subject);
|
|
|
@ -225,14 +219,14 @@ wappalyzer.driver.document = document;
|
|
|
|
* Log messages to console
|
|
|
|
* Log messages to console
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
wappalyzer.driver.log = (message, source, type) => {
|
|
|
|
wappalyzer.driver.log = (message, source, type) => {
|
|
|
|
console.log('[wappalyzer ' + type + ']', '[' + source + ']', message);
|
|
|
|
console.log(`[wappalyzer ${type}]`, `[${source}]`, message);
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Display apps
|
|
|
|
* Display apps
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
wappalyzer.driver.displayApps = (detected, meta, context) => {
|
|
|
|
wappalyzer.driver.displayApps = (detected, meta, context) => {
|
|
|
|
var tab = context.tab;
|
|
|
|
let tab = context.tab;
|
|
|
|
|
|
|
|
|
|
|
|
if (tab === undefined) {
|
|
|
|
if (tab === undefined) {
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|