mirror of https://github.com/gorhill/uBlock.git
Revert "Make the nodejs package load a serialized version of the PSL"
This reverts commit 46c6ff8708
.
This commit is contained in:
parent
46c6ff8708
commit
c6d275674d
|
@ -25,6 +25,7 @@
|
||||||
|
|
||||||
import { createRequire } from 'module';
|
import { createRequire } from 'module';
|
||||||
|
|
||||||
|
import './lib/punycode.js';
|
||||||
import './lib/publicsuffixlist/publicsuffixlist.js';
|
import './lib/publicsuffixlist/publicsuffixlist.js';
|
||||||
|
|
||||||
import globals from './js/globals.js';
|
import globals from './js/globals.js';
|
||||||
|
@ -97,10 +98,16 @@ async function enableWASM() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
function pslInit() {
|
function pslInit(raw) {
|
||||||
const require = createRequire(import.meta.url); // jshint ignore:line
|
if ( typeof raw !== 'string' || raw.trim() === '' ) {
|
||||||
const json = require('./data/publicsuffixlist.json');
|
const require = createRequire(import.meta.url); // jshint ignore:line
|
||||||
globals.publicSuffixList.fromSelfie(json);
|
raw = require('./data/effective_tld_names.json');
|
||||||
|
if ( typeof raw !== 'string' || raw.trim() === '' ) {
|
||||||
|
console.error('Unable to populate public suffix list');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
globals.publicSuffixList.parse(raw, globals.punycode.toASCII);
|
||||||
return globals.publicSuffixList;
|
return globals.publicSuffixList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -39,13 +39,13 @@ UASSETS=submodules/uAssets
|
||||||
# https://github.com/uBlockOrigin/uBlock-issues/issues/1664#issuecomment-888332409
|
# https://github.com/uBlockOrigin/uBlock-issues/issues/1664#issuecomment-888332409
|
||||||
THIRDPARTY=$UASSETS/thirdparties/publicsuffix.org
|
THIRDPARTY=$UASSETS/thirdparties/publicsuffix.org
|
||||||
mkdir -p $DES/data
|
mkdir -p $DES/data
|
||||||
|
node -pe "JSON.stringify(fs.readFileSync('$THIRDPARTY/list/effective_tld_names.dat', 'utf8'))" \
|
||||||
|
> $DES/data/effective_tld_names.json
|
||||||
THIRDPARTY=$UASSETS/thirdparties/easylist-downloads.adblockplus.org
|
THIRDPARTY=$UASSETS/thirdparties/easylist-downloads.adblockplus.org
|
||||||
node -pe "JSON.stringify(fs.readFileSync('$THIRDPARTY/easylist.txt', 'utf8'))" \
|
node -pe "JSON.stringify(fs.readFileSync('$THIRDPARTY/easylist.txt', 'utf8'))" \
|
||||||
> $DES/data/easylist.json
|
> $DES/data/easylist.json
|
||||||
node -pe "JSON.stringify(fs.readFileSync('$THIRDPARTY/easyprivacy.txt', 'utf8'))" \
|
node -pe "JSON.stringify(fs.readFileSync('$THIRDPARTY/easyprivacy.txt', 'utf8'))" \
|
||||||
> $DES/data/easyprivacy.json
|
> $DES/data/easyprivacy.json
|
||||||
# https://github.com/cliqz-oss/adblocker/pull/2091#issuecomment-890545926
|
|
||||||
node ./tools/make-psl.json.js
|
|
||||||
|
|
||||||
cp platform/nodejs/*.js $DES/
|
cp platform/nodejs/*.js $DES/
|
||||||
cp platform/nodejs/*.json $DES/
|
cp platform/nodejs/*.json $DES/
|
||||||
|
|
|
@ -1,40 +0,0 @@
|
||||||
/*******************************************************************************
|
|
||||||
|
|
||||||
uBlock Origin - a browser extension to block requests.
|
|
||||||
Copyright (C) 2014-present Raymond Hill
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU General Public License as published by
|
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with this program. If not, see {http://www.gnu.org/licenses/}.
|
|
||||||
|
|
||||||
Home: https://github.com/gorhill/uBlock
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* globals process, require */
|
|
||||||
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
const fs = require('fs');
|
|
||||||
const raw = fs.readFileSync('./submodules/uAssets/thirdparties/publicsuffix.org/list/effective_tld_names.dat', 'utf8');
|
|
||||||
const punycode = require('../src/lib/punycode.js');
|
|
||||||
const psl = require('../src/lib/publicsuffixlist/publicsuffixlist.js');
|
|
||||||
|
|
||||||
if ( typeof raw !== 'string' || raw.trim() === '' ) {
|
|
||||||
return process.exit('Unable to populate public suffix list');
|
|
||||||
}
|
|
||||||
|
|
||||||
psl.parse(raw, punycode.toASCII);
|
|
||||||
|
|
||||||
fs.writeFileSync(
|
|
||||||
'./dist/build/uBlock0.nodejs/data/publicsuffixlist.json',
|
|
||||||
JSON.stringify(psl.toSelfie())
|
|
||||||
);
|
|
Loading…
Reference in New Issue