adblock2privoxy 2.1.1 → 2.2.0
raw patch · 6 files changed
+18/−22 lines, 6 files
Files
- adblock2privoxy.cabal +2/−2
- changelog +3/−0
- src/ElementBlocker.hs +8/−6
- src/Templates.hs +5/−3
- templates/ab2p.system.action +0/−5
- templates/ab2p.system.filter +0/−6
adblock2privoxy.cabal view
@@ -1,5 +1,5 @@ name: adblock2privoxy-version: 2.1.1+version: 2.2.0 cabal-version: >= 1.10 build-type: Simple tested-with:@@ -103,4 +103,4 @@ type: git location: https://github.com/essandess/adblock2privoxy.git subdir: adblock2privoxy- tag: v2.1.1+ tag: v2.2.0
changelog view
@@ -1,3 +1,6 @@+2.2.0+ * Remove unused debug code+ 2.1.1 * Fix compilation issues for ghc 9.6.3
src/ElementBlocker.hs view
@@ -25,15 +25,16 @@ writeElemBlock :: ElemBlockData -> IO () writeElemBlock (ElemBlockData flatPatterns rulesTree) = do- let debugPath = path </> "debug"- filteredInfo = filter ((||) <$> not . startswith "Url:" <*> startswith "Url: http") info+ let filteredInfo = filter ((||) <$> not . startswith "Url:" <*> startswith "Url: http") info+ -- debugPath = path </> "debug" createDirectoryIfMissing True path cont <- getDirectoryContents path _ <- sequence $ removeOld <$> cont- createDirectoryIfMissing True debugPath+ -- createDirectoryIfMissing True debugPath -- writeBlockTree path debugPath rulesTree writeBlockTree path rulesTree- writePatterns_with_debug filteredInfo (path </> "ab2p.common.css") (debugPath </> "ab2p.common.css") flatPatterns+ writePatterns_with_debug filteredInfo (path </> "ab2p.common.css") "" flatPatterns+ -- writePatterns_with_debug filteredInfo (path </> "ab2p.common.css") (debugPath </> "ab2p.common.css") flatPatterns removeOld entry' = let entry = path </> entry' in do@@ -64,9 +65,10 @@ writePatterns_with_debug _ _ _ [] = return () writePatterns_with_debug info' normalFilename debugFilename patterns = do- writeCssFile debugFilename $ intercalate "\n" $ (++ Templates.blockCss) <$> patterns writeCssFile normalFilename $ intercalate "\n" ((++ Templates.blockCss) . intercalate "," <$>- splitEvery 4000 patterns)+ splitEvery 4000 patterns)+ when (debugFilename /= "") $+ writeCssFile debugFilename $ intercalate "\n" $ (++ Templates.blockCss) <$> patterns where splitEvery n = takeWhile (not . null) . unfoldr (Just . splitAt n) writeCssFile filename content =
src/Templates.hs view
@@ -43,10 +43,12 @@ lns = lines content replace' line (from, to) = replace from to line filterLine line- | 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)]+ | null cssDomain && (startswith "[?CSS_DOMAIN]" line) = ""+ | otherwise = foldl replace' line [("[?CSS_DOMAIN]", ""), ("[CSS_DOMAIN]", cssDomain), ("[CSS_PROTOCOL]", cssProtocol useHTTP)]+ -- | 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- content <- readFile $ dataDir </> "templates" </> file+ content <- readFile $ dataDir </> "templates" </> file writeFile (outDir </> file) $ filterDomain content
templates/ab2p.system.action view
@@ -2,14 +2,9 @@ {+set-image-blocker{blank} \ [?CSS_DOMAIN] +filter{ab2p-elemhide-filter} \- +client-header-tagger{ab2p-elemhide-check-debug} \ +client-header-tagger{ab2p-handle-as-image-c} \ +server-header-tagger{ab2p-handle-as-image-s}} /--[?CSS_DOMAIN]{-filter{ab2p-elemhide-filter} \-[?CSS_DOMAIN] +filter{ab2p-elemhide-filter-debug}}-[?CSS_DOMAIN]TAG:^ab2p-elemhide-filter-debug$ {+handle-as-image} TAG:^ab2p-handle-as-image$
templates/ab2p.system.filter view
@@ -24,14 +24,8 @@ SERVER-HEADER-FILTER: ab2p-xframe-filter s@.*\sHTTP\/1.*@$&\r\nX-Frame-Options: DENY@i -[?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="[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_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