Reduced noise from tld.js regular expressions generation.

This commit is contained in:
hackademix 2018-09-05 13:33:38 +02:00
parent 99a81a6f1f
commit 6ffe07f8f6
3 changed files with 12 additions and 8 deletions

1
.gitignore vendored
View File

@ -3,6 +3,7 @@
# build artifacts
xpi
*.xpi
*.bak
# dev env options
.eslintrc.json
# auto-generated files

View File

@ -45,7 +45,6 @@ sub generate {
s/(_tldRx:\s*\/\(.*?\)).*?(?=\$\/)/$1$rx/s;
s/(_tldEx:\s*\/\(.*?\)).*?(?=\$\/)/$1$ex/s;
print DST;
print;
}
close(SRC);
close(DST);

View File

@ -1,16 +1,19 @@
#!/bin/bash
BASE=$(dirname "$0")
TEMPLATE=tld_template.js
if [ -f "$1" ]; then
cp "$1" "$BASE/tld_template.js"
cp "$1" "$BASE/$TEMPLATE"
fi
pushd "$BASE"
pushd "$BASE" >/dev/null
fname=public_suffix_list.dat
nflag=""
if [ -f "$fname" ]; then
nflag="-z $fname"
cp "$fname" "$fname.bak"
fi
echo 'Updating TLDs...'
URL=https://publicsuffix.org/list/$fname
curl -O $nflag "$URL"
curl -sO $nflag "$URL"
if ! grep 'com' "$fname" >/dev/null; then
echo >&2 "$fname empty or corrupt!"
@ -18,4 +21,5 @@ if ! grep 'com' "$fname" >/dev/null; then
fi
./generate.pl
popd
[ -f "$fname.bak" ] && diff "$fname" "$fname.bak" && echo 'No new data from pubblic suffix list.'
popd >/dev/null