Clean from debug msgs

This commit is contained in:
Ilya Ig. Petrov 2017-11-01 13:57:09 +05:00
parent ec692851d4
commit 88a3810199

View File

@ -12,39 +12,22 @@
const ifIncontinence = 'if-incontinence'; const ifIncontinence = 'if-incontinence';
const modsKey = 'mods'; const modsKey = 'mods';
window.proxyHostToCredsList = { let proxyHostToCredsList = {};
// One host may be used several times with different creds.
/*
'blablabla:6110': [
{ username: 'foo', password: 'bar' },
{ username: 'foo1', password: 'bar' },
{ username: 'foo2', password: 'bar' },
{ username: 'foo3', password: 'bar' },
{ username: 'foo4', password: 'bar' },
{ username: 'foo5', password: 'bar' },
{ username: 'foo6', password: 'bar' },
],
*/
};
const ifAuthSupported = chrome.webRequest && chrome.webRequest.onAuthRequired && !window.apis.version.ifMini; const ifAuthSupported = chrome.webRequest && chrome.webRequest.onAuthRequired && !window.apis.version.ifMini;
if (ifAuthSupported) { if (ifAuthSupported) {
console.log('WebRequest is supported!');
const requestIdToTries = {}; const requestIdToTries = {};
chrome.webRequest.onAuthRequired.addListener( chrome.webRequest.onAuthRequired.addListener(
(details) => { (details) => {
console.log('AUTH REQUIRED.');
if (!details.isProxy) { if (!details.isProxy) {
console.log('Not from proxy.');
return {}; return {};
} }
const proxyHost = `${details.challenger.host}:${details.challenger.port}`; const proxyHost = `${details.challenger.host}:${details.challenger.port}`;
const credsList = proxyHostToCredsList[proxyHost]; const credsList = proxyHostToCredsList[proxyHost];
if (!credsList) { if (!credsList) {
console.log('Creds list is empty.');
return {}; // No creds found for this proxy. return {}; // No creds found for this proxy.
} }
const requestId = details.requestId; const requestId = details.requestId;
@ -53,7 +36,6 @@
return {}; // All creds for this proxy were tried already. return {}; // All creds for this proxy were tried already.
} }
requestIdToTries[requestId] = tries + 1; requestIdToTries[requestId] = tries + 1;
console.log('TRIES=', tries, 'for', requestId, 'CREDS', credsList[tries]);
return { return {
authCredentials: credsList[tries], authCredentials: credsList[tries],
}; };