adblock2privoxy 2.0.2 → 2.1.0
raw patch · 7 files changed
+114/−100 lines, 7 filesdep ~MissingH
Dependency ranges changed: MissingH
Files
- adblock2privoxy.cabal +81/−81
- changelog +5/−0
- src/Main.hs +2/−2
- src/ProgramOptions.hs +8/−4
- src/Templates.hs +9/−4
- stack.yaml +4/−2
- templates/ab2p.system.filter +5/−7
adblock2privoxy.cabal view
@@ -1,10 +1,10 @@-name: adblock2privoxy-version: 2.0.2-cabal-version: >= 1.10-build-type: Simple+name: adblock2privoxy+version: 2.1.0+cabal-version: >= 1.10+build-type: Simple tested-with:- GHC==8.10.4-author: Alexey Zubritsky <adblock2privoxy@zubr.me>, Steven Thomas Smith <steve.t.smith@gmail.com>+ GHC==8.10.7+author: Alexey Zubritsky <adblock2privoxy@zubr.me>, Steven Thomas Smith <steve.t.smith@gmail.com> data-files: templates/ab2p.system.action, templates/ab2p.system.filter@@ -19,88 +19,88 @@ distribution/makeRpm.sh distribution/debbuild/DEBIAN/control distribution/makeDeb.sh-license: GPL-3-maintainer: Steven Thomas Smith <steve.t.smith@gmail.com>-license-file: LICENSE-stability: stable-homepage: https://github.com/essandess/adblock2privoxy-category: Web-synopsis: Convert adblock config files to privoxy format+license: GPL-3+maintainer: Steven Thomas Smith <steve.t.smith@gmail.com>+license-file: LICENSE+stability: stable+homepage: https://github.com/essandess/adblock2privoxy+category: Web+synopsis: Convert adblock config files to privoxy format description:- AdBlock Plus browser plugin has great block list files provided by big community,- but it is client software and cannot work on a server as proxy.- .- Privoxy proxy has good potential to block ads at server side,- but it experiences acute shortage of updated block lists.- .- This software converts adblock lists to privoxy config files format.- .- Almost all adblock features are supported including- .- * block/unblock requests (on privoxy)- .- all syntax features are supported except for regex templates matching host name- .- * hide/unhide page elements (via CSS)- .- all syntax features are supported- .- * all block request options except for outdated ones:- .- Supported: script, image, stylesheet, object, xmlhttprequest, object-subrequest, subdocument,- document, elemhide, other, popup, third-party, domain=..., match-case, donottrack- .- Unsupported: collapse, background, xbl, ping and dtd+ AdBlock Plus browser plugin has great block list files provided by big community,+ but it is client software and cannot work on a server as proxy.+ .+ Privoxy proxy has good potential to block ads at server side,+ but it experiences acute shortage of updated block lists.+ .+ This software converts adblock lists to privoxy config files format.+ .+ Almost all adblock features are supported including+ .+ * block/unblock requests (on privoxy)+ .+ all syntax features are supported except for regex templates matching host name+ .+ * hide/unhide page elements (via CSS)+ .+ all syntax features are supported+ .+ * all block request options except for outdated ones:+ .+ Supported: script, image, stylesheet, object, xmlhttprequest, object-subrequest, subdocument,+ document, elemhide, other, popup, third-party, domain=..., match-case, donottrack+ .+ Unsupported: collapse, background, xbl, ping and dtd executable adblock2privoxy- hs-source-dirs: src- main-is: Main.hs+ hs-source-dirs: src+ main-is: Main.hs default-language: Haskell2010 default-extensions:- RankNTypes,- ScopedTypeVariables,- FlexibleInstances,- GeneralizedNewtypeDeriving,- FlexibleContexts+ RankNTypes,+ ScopedTypeVariables,+ FlexibleInstances,+ GeneralizedNewtypeDeriving,+ FlexibleContexts build-depends:- base >= 4 && < 5,- parsec,- mtl,- containers,- filepath,- directory,- MissingH,- parsec-permutation >= 0.1.2.0,- time >=1.4,- old-locale >=1.0,- strict >=0.3,- network >=2.4,- http-conduit,- text >=0.11,- network-uri,- case-insensitive- ghc-options: -Wall+ base >= 4 && < 5,+ parsec,+ mtl,+ containers,+ filepath,+ directory,+ MissingH >=1.4.3.0,+ parsec-permutation >=0.1.2.0,+ time >=1.4,+ old-locale >=1.0,+ strict >=0.3,+ network >=2.4,+ http-conduit,+ text >=0.11,+ network-uri,+ case-insensitive+ ghc-options: -Wall other-modules:- ElementBlocker,- InputParser,- Network,- OptionsConverter,- ParsecExt,- Paths_adblock2privoxy,- PatternConverter,- PolicyTree,- PopupBlocker,- ProgramOptions,- SourceInfo,- Statistics,- Task,- Templates,- UrlBlocker,- Utils+ ElementBlocker,+ InputParser,+ Network,+ OptionsConverter,+ ParsecExt,+ Paths_adblock2privoxy,+ PatternConverter,+ PolicyTree,+ PopupBlocker,+ ProgramOptions,+ SourceInfo,+ Statistics,+ Task,+ Templates,+ UrlBlocker,+ Utils source-repository this- type: git- location: https://github.com/essandess/adblock2privoxy.git- subdir: adblock2privoxy- tag: v2.0.2+ type: git+ location: https://github.com/essandess/adblock2privoxy.git+ subdir: adblock2privoxy+ tag: v2.1.0
changelog view
@@ -1,3 +1,8 @@+2.1.0+ * Use TLS for CSS server to avoid mixed content errors+ * Add --useHTTP option+ * Update to ghc 8.10.7, lts-18.18 resolver+ 2.0.2 * Update to ghc 8.10.4, lts-17.11 resolver
src/Main.hs view
@@ -35,7 +35,7 @@ then putStrLn "WARNING: CSS generation is not run because webserver domain is not specified" else elemBlock (_webDir options) sourceInfoText parsed' urlBlock (_privoxyDir options) sourceInfoText parsed'- writeTemplateFiles (_privoxyDir options) (_cssDomain options)+ writeTemplateFiles (_privoxyDir options) (_cssDomain options) (_useHTTP options) putStrLn $ "Run 'adblock2privoxy -t " ++ taskFile ++ "' every 1-2 days to process data updates." where parseSource manager sourceInfo = do@@ -62,7 +62,7 @@ setForeignEncoding utf8 now <- getCurrentTime args <- getArgs- (options@(Options printVersion _ _ taskFile _ forced), urls) <- parseOptions args+ (options@(Options printVersion _ _ taskFile _ _ forced), urls) <- parseOptions args (options', task) <- do fileExists <- doesFileExist taskFile if fileExists
src/ProgramOptions.hs view
@@ -22,6 +22,7 @@ , _webDir :: FilePath , _taskFile :: FilePath , _cssDomain :: String+ , _useHTTP :: Bool , _forced :: Bool } @@ -42,6 +43,9 @@ (ReqArg (\ d opts -> opts { _cssDomain = d }) "DOMAIN") "Domain of CSS web server (required for Element Hide functionality)"+ , Option "u" ["useHTTP"]+ (NoArg (\ opts -> opts { _useHTTP = True }))+ "Use HTTP for CSS web server; the default is HTTPS to avoid mixed content" , Option "t" ["taskFile"] (ReqArg (\ f opts -> opts { _taskFile = f }) "PATH")@@ -56,13 +60,13 @@ case getOpt Permute options argv of (opts,nonOpts,[] ) -> case foldl (flip id) emptyOptions opts of- Options False "" _ "" _ _ -> writeError "Privoxy dir or task file should be specified.\n"+ Options False "" _ "" _ _ _ -> writeError "Privoxy dir or task file should be specified.\n" opts'@Options{_showVersion = True} -> return (opts', nonOpts) opts' -> return (setDefaults opts', nonOpts) (_,_,errs) -> writeError $ concat errs where- setDefaults opts@(Options _ (privoxyDir@(_:_)) "" _ _ _) = setDefaults opts{ _webDir = privoxyDir }- setDefaults opts@(Options _ privoxyDir _ "" _ _) = setDefaults opts{ _taskFile = privoxyDir </> "ab2p.task" }+ setDefaults opts@(Options _ (privoxyDir@(_:_)) "" _ _ _ _) = setDefaults opts{ _webDir = privoxyDir }+ setDefaults opts@(Options _ privoxyDir _ "" _ _ _) = setDefaults opts{ _taskFile = privoxyDir </> "ab2p.task" } setDefaults opts = opts versionText :: String@@ -92,7 +96,7 @@ endMark = "------- end ------" emptyOptions :: Options-emptyOptions = Options False "" "" "" "" False+emptyOptions = Options False "" "" "" "" False False fillFromLog :: Options -> [String] -> Options
src/Templates.hs view
@@ -28,8 +28,13 @@ terminalActionSwitch True Dnt = "+add-header{DNT: 1}" terminalActionSwitch _ _ = "" -writeTemplateFiles :: String -> String -> IO ()-writeTemplateFiles outDir cssDomain = do+cssProtocol :: Bool -> String+cssProtocol useHTTP+ | useHTTP == True = "http"+ | otherwise = "https"++writeTemplateFiles :: String -> String -> Bool -> IO ()+writeTemplateFiles outDir cssDomain useHTTP = do copySystem "ab2p.system.action" copySystem "ab2p.system.filter" where@@ -38,8 +43,8 @@ lns = lines content replace' line (from, to) = replace from to line filterLine line- | null cssDomain && startswith "[?CSS_DOMAIN]" line = ""- | otherwise = foldl replace' line [("[?CSS_DOMAIN]", ""), ("[CSS_DOMAIN]", cssDomain)]+ | null cssDomain && (startswith "[?CSS_DOMAIN]" line || startswith "[?CSS_DOMAIN_DEBUG]" line) = ""+ | otherwise = foldl replace' line [("[?CSS_DOMAIN]", ""), ("[?CSS_DOMAIN_DEBUG]", "# "), ("[CSS_DOMAIN]", cssDomain), ("[CSS_PROTOCOL]", cssProtocol useHTTP)] copySystem file = do dataDir <- getDataDir
stack.yaml view
@@ -1,14 +1,16 @@ # For more information, see: https://github.com/commercialhaskell/stack/blob/release/doc/yaml_configuration.md # Specifies the GHC version and set of packages available (e.g., lts-3.5, nightly-2015-09-21, ghc-7.10.2)-resolver: lts-17.11+resolver: lts-18.18 # Local packages, usually specified by relative directory name packages: - '.' # Packages to be pulled from upstream that are not in the resolver (e.g., acme-missiles-0.3)-extra-deps: [parsec-permutation-0.1.2.0]+extra-deps:+- parsec-permutation-0.1.2.0+- MissingH-1.4.3.0@sha256:efbbe7065e17bc01ed925593a0c5b5793ab857585a8e9d5015d0025e526ab55c # Override default flag values for local packages and extra-deps flags: {}
templates/ab2p.system.filter view
@@ -24,16 +24,14 @@ SERVER-HEADER-FILTER: ab2p-xframe-filter s@.*\sHTTP\/1.*@$&\r\nX-Frame-Options: DENY@i -CLIENT-HEADER-TAGGER: ab2p-elemhide-check-debug-s@^cookie:.*ab2p-elemhide-filter-debug=true(?:;|$).*@ab2p-elemhide-filter-debug@Ti+[?CSS_DOMAIN_DEBUG]CLIENT-HEADER-TAGGER: ab2p-elemhide-check-debug+[?CSS_DOMAIN_DEBUG]s@^cookie:.*ab2p-elemhide-filter-debug=true(?:;|$).*@ab2p-elemhide-filter-debug@Ti [?CSS_DOMAIN]FILTER: ab2p-elemhide-filter-[?CSS_DOMAIN]s@[^'"\s]\s*<head[^>]*>(?=\s*[^'"\s])@$&<link rel="stylesheet" type="text/css" href="http://[CSS_DOMAIN]/ab2p.common.css"></link><link rel="stylesheet" type="text/css" href="http://[CSS_DOMAIN]/$host/ab2p.css"></link>@iUD+[?CSS_DOMAIN]s@[^'"\s]\s*<head[^>]*>(?=\s*[^'"\s])@$&<link rel="stylesheet" type="text/css" href="[CSS_PROTOCOL]://[CSS_DOMAIN]/ab2p.common.css"></link><link rel="stylesheet" type="text/css" href="[CSS_PROTOCOL]://[CSS_DOMAIN]/$host/ab2p.css"></link>@iUD -[?CSS_DOMAIN]FILTER: ab2p-elemhide-filter-debug-[?CSS_DOMAIN]s@[^'"\s]\s*<head[^>]*>(?=\s*[^'"\s])@$&<link rel="stylesheet" type="text/css" href="http://[CSS_DOMAIN]/debug/ab2p.common.css"></link><link rel="stylesheet" type="text/css" href="http://[CSS_DOMAIN]/$host.debug/ab2p.css"></link>@iUD+[?CSS_DOMAIN_DEBUG]FILTER: ab2p-elemhide-filter-debug+[?CSS_DOMAIN_DEBUG]s@[^'"\s]\s*<head[^>]*>(?=\s*[^'"\s])@$&<link rel="stylesheet" type="text/css" href="[CSS_PROTOCOL]://[CSS_DOMAIN]/debug/ab2p.common.css"></link><link rel="stylesheet" type="text/css" href="[CSS_PROTOCOL]://[CSS_DOMAIN]/$host.debug/ab2p.css"></link>@iUD FILTER: ab2p-popup-filter s@[^'"\s]\s*<head[^>]*>(?=\s*[^'"\s])@$&<script type="text/javascript">parent==window&&opener&&close()</script>@iUD--