1
0
mirror of https://github.com/kkapsner/CanvasBlocker synced 2024-12-22 12:50:36 +01:00

Added support for wildcards (*) in domains

Fixes #613
This commit is contained in:
kkapsner 2022-04-26 17:08:28 +02:00
parent cfb09075eb
commit 4bd0c0c96c
4 changed files with 16 additions and 5 deletions

View File

@ -29,9 +29,12 @@
})
.map(function(entry){
let regExp;
const domain = !!entry.match(/^[A-Za-z0-9_.-]+$/);
const domain = !!entry.match(/^[A-Za-z0-9_.*-]+$/);
if (domain){
regExp = new RegExp("(?:^|\\.)" + entry.replace(/([\\+*?[^\]$(){}=!|.])/g, "\\$1") + "\\.?$", "i");
regExp = new RegExp(
"(?:^|\\.)" + entry.replace(/([\\+?[^\]$(){}=!|.])/g, "\\$1").replace(/\*/g, ".+") + "\\.?$",
"i"
);
}
else {
try {

View File

@ -166,10 +166,10 @@
function initializeUrlSetting(urlSetting){
let regExp;
const domain = !!urlSetting.url.match(/^[A-Za-z0-9_.-]+$/);
const domain = !!urlSetting.url.match(/^[A-Za-z0-9_.*-]+$/);
if (domain){
regExp = new RegExp(
"(?:^|\\.)" + urlSetting.url.replace(/([\\+*?[^\]$(){}=!|.])/g, "\\$1") + "\\.?$",
"(?:^|\\.)" + urlSetting.url.replace(/([\\+?[^\]$(){}=!|.])/g, "\\$1").replace(/\*/g, ".+") + "\\.?$",
"i"
);
}

View File

@ -3,7 +3,7 @@ Version 1.9:
- update setting descriptions
new features:
-
- added support for wildcards (*) in domains
fixes:
- errors in URL regular expressions broke CB

View File

@ -225,6 +225,14 @@
{
"version": "1.9Alpha20220218",
"update_link": "https://canvasblocker.kkapsner.de/versions/canvasblocker_beta-1.9Alpha20220218-an+fx.xpi"
},
{
"version": "1.9Alpha20220424",
"update_link": "https://canvasblocker.kkapsner.de/versions/canvasblocker_beta-1.9Alpha20220424-an+fx.xpi"
},
{
"version": "1.9Alpha20220426",
"update_link": "https://canvasblocker.kkapsner.de/versions/canvasblocker_beta-1.9Alpha20220426-an+fx.xpi"
}
]
}