Ensure TLDs can be updated using up-to-date src/lib/tld.js as the template.

This commit is contained in:
hackademix 2018-08-18 04:14:55 +02:00
parent 8c8b959474
commit bbe443e724
4 changed files with 11 additions and 6 deletions

View File

@ -42,8 +42,8 @@ sub generate {
open(SRC, $src) || die("Cannot open $src"); open(SRC, $src) || die("Cannot open $src");
open(DST, ">$dst") || die("Cannot open $dst"); open(DST, ">$dst") || die("Cannot open $dst");
while(<SRC>) { while(<SRC>) {
s/%tld_rx%/$rx/g; s/(_tldRx:\s*\/\(.*?\))\S*?(\$\/)/$1$rx$2/g;
s/%tld_ex%/$ex/g; s/(_tldEx:\s*\/\(.*?\))\S*?(\$\/)/$1$ex$2/g;
print DST; print DST;
print; print;
} }

View File

@ -1,5 +1,8 @@
#!/bin/bash #!/bin/bash
BASE=$(dirname "$0") BASE=$(dirname "$0")
if [ -f "$1" ]; then
cp "$1" "$BASE/tld_template.js"
fi
pushd "$BASE" pushd "$BASE"
fname=public_suffix_list.dat fname=public_suffix_list.dat
nflag="" nflag=""

File diff suppressed because one or more lines are too long

View File

@ -23,7 +23,7 @@ XPI="$XPI_DIR/noscript-$VER"
LIB="$SRC/lib" LIB="$SRC/lib"
TLD="$BASE/TLD" TLD="$BASE/TLD"
if ! [ $(date -r "$LIB/tld.js" +'%Y%m%d') -ge $(date +'%Y%m%d') ] && "$TLD/generate.sh"; then if ! [ $(date -r "$LIB/tld.js" +'%Y%m%d') -ge $(date +'%Y%m%d') ] && "$TLD/generate.sh" "$LIB/tld.js"; then
cp -u "$TLD/tld.js" "$LIB" cp -u "$TLD/tld.js" "$LIB"
fi fi