Merge branch 'test-mr-93'

This commit is contained in:
Kevin R 2021-12-27 20:13:01 +01:00
commit 9c61d9d77a
No known key found for this signature in database
GPG Key ID: 97471F65F14A4C66

View File

@ -216,6 +216,12 @@ function start() {
for (let re = 0; re < redirections.length; re++) {
providers[p].addRedirection(redirections[re]);
}
let methods = data.providers[prvKeys[p]].getOrDefault('methods', []);
//Add HTTP methods list to provider
for (let re = 0; re < methods.length; re++) {
providers[p].addMethod(methods[re]);
}
}
}
@ -344,6 +350,7 @@ function start() {
let disabled_rawRules = {};
let enabled_referralMarketing = {};
let disabled_referralMarketing = {};
let methods = [];
if (_completeProvider) {
enabled_rules[".*"] = true;
@ -496,6 +503,28 @@ function start() {
}
};
/**
* Add a HTTP method to methods list.
*
* @param {String} method HTTP Method Name
*/
this.addMethod = function (method) {
if (methods.indexOf(method) === -1) {
methods.push(method);
}
}
/**
* Check the requests' method.
*
* @param {requestDetails} details Requests details
* @returns {boolean} should be filtered or not
*/
this.matchMethod = function (details) {
if (!methods.length) return true;
return methods.indexOf(details['method']) > -1;
}
/**
* Private helper method to check if the url
* an exception.
@ -570,7 +599,7 @@ function start() {
* Function which called from the webRequest to
* remove the tracking fields from the url.
*
* @param {webRequest} request webRequest-Object
* @param {requestDetails} request webRequest-Object
* @return {Array} redirectUrl or none
*/
function clearUrl(request) {
@ -598,6 +627,7 @@ function start() {
* Call for every provider the removeFieldsFormURL method.
*/
for (let i = 0; i < providers.length; i++) {
if (!providers[i].matchMethod(request)) continue;
if (providers[i].matchURL(request.url)) {
result = removeFieldsFormURL(providers[i], request.url, false, request);
}