Adding time to log for debugging
This commit is contained in:
parent
e48e449c03
commit
35cf69cd73
8
app.js
8
app.js
|
@ -33,16 +33,18 @@ function checkForRedirect () {
|
||||||
}
|
}
|
||||||
|
|
||||||
function isThisARedirect (res) {
|
function isThisARedirect (res) {
|
||||||
|
var currentDate = new Date();
|
||||||
if (res.statusCode == 301 || res.statusCode == 302) {
|
if (res.statusCode == 301 || res.statusCode == 302) {
|
||||||
console.log("Redirect? HOW SUSPICIOUS.");
|
console.log(currentDate.toTimeString()+": Redirect? HOW SUSPICIOUS.");
|
||||||
redirecting(res);
|
redirecting(res);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
console.log("No redirect, nothing to see here...");
|
console.log(currentDate.toTimeString()+": No redirect, nothing to see here...");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function redirecting (res) {
|
function redirecting (res) {
|
||||||
|
var currentDate = new Date();
|
||||||
var _url = url.parse(res.headers.location);
|
var _url = url.parse(res.headers.location);
|
||||||
|
|
||||||
console.log("Scrape: "+res.headers.location);
|
console.log("Scrape: "+res.headers.location);
|
||||||
|
@ -51,7 +53,7 @@ function redirecting (res) {
|
||||||
var found = false;
|
var found = false;
|
||||||
for (var k in hotspots) {
|
for (var k in hotspots) {
|
||||||
if (!found && hotspots[k].check($)) {
|
if (!found && hotspots[k].check($)) {
|
||||||
console.log(k.toUpperCase()+" WANTS YOU TO LOG IN");
|
console.log(currentDate.toTimeString()+": "+k.toUpperCase()+" WANTS YOU TO LOG IN");
|
||||||
connectToNetwork(hotspots[k].credentials, mergeObjects(_url, hotspots[k].postOptions));
|
connectToNetwork(hotspots[k].credentials, mergeObjects(_url, hotspots[k].postOptions));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user