mirror of
https://github.com/gorhill/uBlock.git
synced 2024-11-10 01:02:08 +01:00
spin-off filter lists into their own dedicated project
This commit is contained in:
parent
baed91e111
commit
d286eff4ba
2 changed files with 64 additions and 12 deletions
|
@ -1,7 +1,7 @@
|
|||
/*******************************************************************************
|
||||
|
||||
uBlock - a browser extension to block requests.
|
||||
Copyright (C) 2014-2015 Raymond Hill
|
||||
uBlock Origin - a browser extension to block requests.
|
||||
Copyright (C) 2014-2016 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
|
||||
|
@ -19,7 +19,7 @@
|
|||
Home: https://github.com/gorhill/uBlock
|
||||
*/
|
||||
|
||||
/* global vAPI, µBlock, YaMD5 */
|
||||
/* global YaMD5 */
|
||||
|
||||
/*******************************************************************************
|
||||
|
||||
|
@ -53,6 +53,7 @@ var oneDay = 24 * oneHour;
|
|||
/******************************************************************************/
|
||||
|
||||
var projectRepositoryRoot = µBlock.projectServerRoot;
|
||||
var assetsRepositoryRoot = 'https://raw.githubusercontent.com/uBlockOrigin/uAssets/master/';
|
||||
var nullFunc = function() {};
|
||||
var reIsExternalPath = /^(file|ftps?|https?|resource):\/\//;
|
||||
var reIsUserPath = /^assets\/user\//;
|
||||
|
@ -289,6 +290,32 @@ var cachedAssetsManager = (function() {
|
|||
|
||||
/******************************************************************************/
|
||||
|
||||
var toRepoURL = function(path) {
|
||||
if ( path.startsWith('assets/ublock/filter-lists.json') ) {
|
||||
return projectRepositoryRoot + path;
|
||||
}
|
||||
|
||||
if ( path.startsWith('assets/thirdparties/') ) {
|
||||
return path.replace(
|
||||
/^assets\/thirdparties\//,
|
||||
assetsRepositoryRoot + 'thirdparties/'
|
||||
);
|
||||
}
|
||||
|
||||
if ( path.startsWith('assets/ublock/') ) {
|
||||
return path.replace(
|
||||
/^assets\/ublock\//,
|
||||
assetsRepositoryRoot + 'filters/'
|
||||
);
|
||||
}
|
||||
|
||||
// At this point, `path` is assumed to point to a resource specific to
|
||||
// this project.
|
||||
return projectRepositoryRoot + path;
|
||||
};
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
var getTextFileFromURL = function(url, onLoad, onError) {
|
||||
// console.log('µBlock.assets/getTextFileFromURL("%s"):', url);
|
||||
|
||||
|
@ -620,7 +647,7 @@ var readRepoFile = function(path, callback) {
|
|||
callback(details);
|
||||
};
|
||||
|
||||
var repositoryURL = projectRepositoryRoot + path;
|
||||
var repositoryURL = toRepoURL(path);
|
||||
|
||||
var onRepoFileLoaded = function() {
|
||||
//console.log('µBlock> readRepoFile("%s") / onRepoFileLoaded()', path);
|
||||
|
@ -637,9 +664,9 @@ var readRepoFile = function(path, callback) {
|
|||
reportBack('', 'Error');
|
||||
};
|
||||
|
||||
// 'ublock=...' is to skip browser cache
|
||||
// '_=...' is to skip browser cache
|
||||
getTextFileFromURL(
|
||||
repositoryURL + '?ublock=' + Date.now(),
|
||||
repositoryURL + '?_=' + Date.now(),
|
||||
onRepoFileLoaded,
|
||||
onRepoFileError
|
||||
);
|
||||
|
@ -696,8 +723,8 @@ var readRepoCopyAsset = function(path, callback) {
|
|||
getTextFileFromURL(vAPI.getURL(details.path), onInstallFileLoaded, onInstallFileError);
|
||||
};
|
||||
|
||||
var repositoryURL = projectRepositoryRoot + path;
|
||||
var repositoryURLSkipCache = repositoryURL + '?ublock=' + Date.now();
|
||||
var repositoryURL = toRepoURL(path);
|
||||
var repositoryURLSkipCache = repositoryURL + '?_=' + Date.now();
|
||||
|
||||
var onRepoFileLoaded = function() {
|
||||
if ( stringIsNotEmpty(this.responseText) === false ) {
|
||||
|
@ -844,7 +871,7 @@ var readRepoOnlyAsset = function(path, callback) {
|
|||
getTextFileFromURL(vAPI.getURL(path), onInstallFileLoaded, onInstallFileError);
|
||||
};
|
||||
|
||||
var repositoryURL = projectRepositoryRoot + path + '?ublock=' + Date.now();
|
||||
var repositoryURL = toRepoURL(path + '?_=' + Date.now());
|
||||
|
||||
var onRepoFileLoaded = function() {
|
||||
if ( typeof this.responseText !== 'string' ) {
|
||||
|
|
|
@ -3,10 +3,35 @@
|
|||
# This script assumes a linux environment
|
||||
|
||||
echo "*** uBlock: generating checksums.txt file..."
|
||||
|
||||
truncate -s 0 assets/checksums.txt
|
||||
LIST="$(find assets/ublock assets/thirdparties -type f)"
|
||||
for ENTRY in $LIST; do
|
||||
echo `md5sum $ENTRY` >> assets/checksums.txt
|
||||
|
||||
echo `md5sum assets/ublock/filter-lists.json` >> assets/checksums.txt
|
||||
|
||||
filters=(
|
||||
'../uAssets/filters/badware.txt'
|
||||
'../uAssets/filters/experimental.txt'
|
||||
'../uAssets/filters/filters.txt'
|
||||
'../uAssets/filters/privacy.txt'
|
||||
'../uAssets/filters/resources.txt'
|
||||
'../uAssets/filters/unbreak.txt'
|
||||
)
|
||||
for repoPath in "${filters[@]}"; do
|
||||
echo `md5sum $repoPath` | sed 's/\.\.\/uAssets\/filters/assets\/ublock/' >> assets/checksums.txt
|
||||
done
|
||||
|
||||
thirdparties=(
|
||||
'../uAssets/thirdparties/easylist-downloads.adblockplus.org/easylist.txt'
|
||||
'../uAssets/thirdparties/easylist-downloads.adblockplus.org/easyprivacy.txt'
|
||||
'../uAssets/thirdparties/mirror1.malwaredomains.com/files/justdomains'
|
||||
'../uAssets/thirdparties/pgl.yoyo.org/as/serverlist'
|
||||
'../uAssets/thirdparties/publicsuffix.org/list/effective_tld_names.dat'
|
||||
'../uAssets/thirdparties/www.malwaredomainlist.com/hostslist/hosts.txt'
|
||||
)
|
||||
for repoPath in "${thirdparties[@]}"; do
|
||||
echo `md5sum $repoPath` | sed 's/\.\.\/uAssets\/thirdparties/assets\/thirdparties/' >> assets/checksums.txt
|
||||
done
|
||||
|
||||
echo "*** uBlock: checksums updated."
|
||||
|
||||
git status assets/
|
||||
|
|
Loading…
Reference in a new issue