Fix French language, clear robots.txt cache regularly

main
Elbert Alias 8 years ago
parent 5d5c9e3aca
commit f61697c9f4

@ -1,4 +1,4 @@
{
{
"github": { "message": "Forker Wappalyzer sur GitHub!" },
"noAppsDetected": { "message": "Pas d'applications détectées." },
"nothingToDo": { "message": "Rien à faire ici." },
@ -36,7 +36,7 @@
"categoryName24": { "message": "Editeur WYSIWYG" },
"categoryName25": { "message": "Graphismes JavaScript" },
"categoryName26": { "message": "Framework pour mobiles" },
"categoryName27": { "message": "Language de programmation" },
"categoryName27": { "message": "Langage de programmation" },
"categoryName28": { "message": "Système d'exploitation" },
"categoryName29": { "message": "Moteur de recherche" },
"categoryName30": { "message": "Web Mail" },

@ -61,7 +61,7 @@ function openTab(args) {
function post(url, body) {
fetch(url, {
method: 'POST',
body
body: JSON.stringify(body)
})
.then(response => {
wappalyzer.log('POST ' + url + ': ' + response.status, 'driver');
@ -306,12 +306,19 @@ wappalyzer.driver.getRobotsTxt = (host, secure = false) => {
/**
* Anonymously track detected applications for research purposes
*/
wappalyzer.driver.ping = (ping, adCache) => {
wappalyzer.driver.ping = (hostnameCache, adCache) => {
getOption('tracking', true)
.then(tracking => {
if ( tracking ) {
post('http://ping.wappalyzer.com/v2/', ping);
post('https://ad.wappalyzer.com/log/wp/', adCache);
if ( Object.keys(hostnameCache).length ) {
post('http://ping.wappalyzer.com/v2/', hostnameCache);
}
if ( adCache.length ) {
post('https://ad.wappalyzer.com/log/wp/', adCache);
}
setOption('robotsTxtCache', {});
}
});
};

@ -165,6 +165,18 @@ wappalyzer.parseRobotsTxt = robotsTxt => {
return disallow;
}
/**
*
*/
wappalyzer.ping() {
if ( Object.keys(hostnameCache).length >= 50 || adCache.length >= 50 ) {
wappalyzer.driver.ping(hostnameCache, adCache);
hostnameCache = {};
adCache = [];
}
}
/**
* Enclose string in array
*/
@ -287,6 +299,8 @@ function resolveImplies(apps, url) {
* Cache detected applications
*/
function cacheDetectedApps(apps, url) {
wappalyzer.driver.ping instanceof Function || return;
Object.keys(apps).forEach(appName => {
var app = apps[appName];
@ -297,15 +311,15 @@ function cacheDetectedApps(apps, url) {
detected[url][appName].confidence[id] = app.confidence[id];
});
})
wappalyzer.ping();
}
/**
* Track detected applications
*/
function trackDetectedApps(apps, url, hostname, html) {
if ( !( wappalyzer.driver.ping instanceof Function ) ) {
return;
}
wappalyzer.driver.ping instanceof Function || return;
Object.keys(apps).forEach(appName => {
var app = apps[appName];
@ -347,12 +361,7 @@ function trackDetectedApps(apps, url, hostname, html) {
}
}
if ( Object.keys(hostnameCache).length >= 50 || adCache.length >= 50 ) {
wappalyzer.driver.ping(hostnameCache, adCache);
hostnameCache = {};
adCache = [];
}
wappalyzer.ping();
}
/**