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(DST, ">$dst") || die("Cannot open $dst");
while(<SRC>) {
s/%tld_rx%/$rx/g;
s/%tld_ex%/$ex/g;
s/(_tldRx:\s*\/\(.*?\))\S*?(\$\/)/$1$rx$2/g;
s/(_tldEx:\s*\/\(.*?\))\S*?(\$\/)/$1$ex$2/g;
print DST;
print;
}

View File

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