botguard interface fixes:
- stock site was updated to ignore entries in the pending data queue after a time - correctly process the 'c' response from the server - it's an array, not a single item (oops!)
This commit is contained in:
parent
2446060dad
commit
24f058bf4e
@ -77,7 +77,7 @@ iitc_bg.push_queue = function(group, data, key) {
|
|||||||
|
|
||||||
if (data == "dkxm" || botguard_instance) {
|
if (data == "dkxm" || botguard_instance) {
|
||||||
// NOTE: we pre-create empty per-group arrays on init
|
// NOTE: we pre-create empty per-group arrays on init
|
||||||
iitc_bg.data_queue[group].push( {data: data, key: key} );
|
iitc_bg.data_queue[group].push( {data: data, key: key, time: Date.now()} );
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -210,29 +210,37 @@ iitc_bg.dummy_botguard.prototype.invoke = function(callback) {
|
|||||||
iitc_bg.process_queue = function(group) {
|
iitc_bg.process_queue = function(group) {
|
||||||
//stock site
|
//stock site
|
||||||
//function zd(a, b) {
|
//function zd(a, b) {
|
||||||
//// a==this, b==group
|
////a==singleton, b==group
|
||||||
// if (a.lb[b] && 0 < a.lb[b].length) {
|
// if (a.lb[b]) for (; 0 < a.lb[b].length; ) {
|
||||||
// var c = a.lb[b].shift(), d = c.gf, c = "dkxm" == d ? new Sf : new a.qc[c.cb](d);
|
// var c = a.lb[b].shift(), d = c.gf, e = c.kh + 7195e3, f;
|
||||||
// a.ya[b] || (a.ya[b] = []);
|
// "dkxm" == d ? f = new Sf : x() < e && (f = new a.qc[c.cb](d));
|
||||||
// a.ya[b].push(c);
|
// if (f) {
|
||||||
|
// c = a;
|
||||||
|
// d = b;
|
||||||
|
// c.ya[d] || (c.ya[d] = []);
|
||||||
|
// c.ya[d].push(f);
|
||||||
|
// break;
|
||||||
|
// }
|
||||||
// }
|
// }
|
||||||
//}
|
//}
|
||||||
|
|
||||||
// processes an entry in the queue for the specified group
|
// processes an entry in the queue for the specified group
|
||||||
|
|
||||||
if (iitc_bg.data_queue[group] && iitc_bg.data_queue[group].length > 0) {
|
while (iitc_bg.data_queue[group] && iitc_bg.data_queue[group].length > 0) {
|
||||||
var item = iitc_bg.data_queue[group].shift();
|
var item = iitc_bg.data_queue[group].shift();
|
||||||
var obj = undefined;
|
var obj = undefined;
|
||||||
|
|
||||||
if (item.data == "dkxm") {
|
if (item.data == "dkxm") {
|
||||||
obj = new iitc_bg.dummy_botguard;
|
obj = new iitc_bg.dummy_botguard;
|
||||||
} else {
|
} else if (Date.now() < item.time + 7195000) {
|
||||||
|
|
||||||
obj = new iitc_bg.botguard[item.key](item.data);
|
obj = new iitc_bg.botguard[item.key](item.data);
|
||||||
}
|
}
|
||||||
|
|
||||||
// note: we pre-create empty per-group arrays on init
|
// note: we pre-create empty per-group arrays on init
|
||||||
|
if (obj) {
|
||||||
iitc_bg.instance_queue[group].push(obj);
|
iitc_bg.instance_queue[group].push(obj);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
@ -266,7 +274,10 @@ iitc_bg.process_response_params = function(method,data) {
|
|||||||
iitc_bg.process_key(data.b, data.a);
|
iitc_bg.process_key(data.b, data.a);
|
||||||
}
|
}
|
||||||
if (data.c && data.b) {
|
if (data.c && data.b) {
|
||||||
iitc_bg.push_queue(group, data.c, data.b);
|
//c is an ARRAY of entries to push. do them all
|
||||||
|
for (var i=0; i<data.c.length; i++) {
|
||||||
|
iitc_bg.push_queue(group, data.c[i], data.b);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (iitc_bg.instance_queue[group].length == 0) {
|
if (iitc_bg.instance_queue[group].length == 0) {
|
||||||
iitc_bg.process_queue(group);
|
iitc_bg.process_queue(group);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user