fix IndexedDB directories not being deleted
This commit is contained in:
parent
62953174b4
commit
ff66f6705c
11
Main.hs
11
Main.hs
@ -82,16 +82,19 @@ deleteCookies domains = do
|
||||
deleteData :: [Text] -> Action (Int, [Text])
|
||||
deleteData whitelist = do
|
||||
webengine <- asks webenginePath
|
||||
appCache <- liftIO $ getDirectoryFiles (webengine </> "Application Cache")
|
||||
indexedDB <- liftIO $ getDirectoryFiles (webengine </> "IndexedDB")
|
||||
localStorage <- liftIO $ getDirectoryFiles (webengine </> "Local Storage")
|
||||
appCache <- liftIO $ listDirectoryAbs (webengine </> "Application Cache")
|
||||
indexedDB <- liftIO $ listDirectoryAbs (webengine </> "IndexedDB")
|
||||
localStorage <- liftIO $ listDirectoryAbs (webengine </> "Local Storage")
|
||||
let
|
||||
entries = appCache ++ indexedDB ++ localStorage
|
||||
badFiles = filterMaybe (fmap unlisted . domain) entries
|
||||
badDomains = mapMaybe domain badFiles
|
||||
liftIO $ mapM_ removeFile badFiles
|
||||
liftIO $ mapM_ removePathForcibly badFiles
|
||||
return (length badFiles, nub badDomains)
|
||||
where
|
||||
listDirectoryAbs :: FilePath -> IO [FilePath]
|
||||
listDirectoryAbs dir = map (dir </>) <$> listDirectory dir
|
||||
|
||||
maybeToBool :: Maybe Bool -> Bool
|
||||
maybeToBool Nothing = False
|
||||
maybeToBool (Just x) = x
|
||||
|
Loading…
Reference in New Issue
Block a user