Updated referralMarketing pattern to match rule pattern

This commit is contained in:
Kevin R 2021-01-13 16:32:57 +01:00
parent 9ba19a9eb3
commit 4f6241842f
No known key found for this signature in database
GPG Key ID: 97471F65F14A4C66

View File

@ -1,20 +1,20 @@
/* /*
* ClearURLs * ClearURLs
* Copyright (c) 2017-2020 Kevin Röbert * Copyright (c) 2017-2021 Kevin Röbert
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by * it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details. * GNU Lesser General Public License for more details.
* *
* You should have received a copy of the GNU Lesser General Public License * You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
/*jshint esversion: 6 */ /*jshint esversion: 6 */
/* /*
@ -52,7 +52,7 @@ function removeFieldsFormURL(provider, pureUrl, quiet = false, request = null) {
"changes": false, "changes": false,
"url": url, "url": url,
"cancel": false "cancel": false
}; }
} }
/* /*
@ -93,12 +93,12 @@ function removeFieldsFormURL(provider, pureUrl, quiet = false, request = null) {
pushToLog(pureUrl, url, translate('log_redirect')); pushToLog(pureUrl, url, translate('log_redirect'));
increaseGlobalURLCounter(1); increaseGlobalURLCounter(1);
increaseBadged(false, request) increaseBadged(false, request)
}; }
return { return {
"redirect": true, "redirect": true,
"url": url "url": url
}; }
} }
if (existsFields(url)) { if (existsFields(url)) {
@ -157,7 +157,7 @@ function removeFieldsFormURL(provider, pureUrl, quiet = false, request = null) {
"changes": changes, "changes": changes,
"url": url, "url": url,
"cancel": cancel "cancel": cancel
}; }
} }
function start() { function start() {
@ -255,7 +255,7 @@ function start() {
return { return {
hash: (await response.text()).trim(), hash: (await response.text()).trim(),
status: response.status status: response.status
}; }
}); });
response.then(result => { response.then(result => {
@ -290,7 +290,7 @@ function start() {
data: (await response.clone().text()).trim(), data: (await response.clone().text()).trim(),
hash: await sha256((await response.text()).trim()), hash: await sha256((await response.text()).trim()),
status: response.status status: response.status
}; }
}) })
response.then(result => { response.then(result => {
@ -468,7 +468,7 @@ function start() {
* @param {boolean} isActive Is this rule active? * @param {boolean} isActive Is this rule active?
*/ */
this.addReferralMarketing = function (rule, isActive = true) { this.addReferralMarketing = function (rule, isActive = true) {
rule = "([\\/\\?#]|(&|&amp;))+(" + rule + "=[^\\/\\?&]*)"; rule = "([\\/\\?#]|(&|&amp;))+(" + rule + "=[^&]*)";
this.applyRule(enabled_referralMarketing, disabled_referralMarketing, rule, isActive); this.applyRule(enabled_referralMarketing, disabled_referralMarketing, rule, isActive);
}; };
@ -478,7 +478,7 @@ function start() {
* and replace old with new exception. * and replace old with new exception.
* *
* @param {String} exception RegExp as string * @param {String} exception RegExp as string
* @param {Boolean} isActive Is this exception acitve? * @param {Boolean} isActive Is this exception active?
*/ */
this.addException = function (exception, isActive = true) { this.addException = function (exception, isActive = true) {
if (isActive) { if (isActive) {