add script to delete cookies and local storage of epiphany
This commit is contained in:
parent
dbb4cc522a
commit
45f2492857
1 changed files with 57 additions and 0 deletions
57
epiphany
Executable file
57
epiphany
Executable file
|
|
@ -0,0 +1,57 @@
|
|||
#!/bin/bash
|
||||
CONFIG_DIR="$HOME/.config/epiphany"
|
||||
COOKIES="cookies.sqlite"
|
||||
WHITELIST="cookie_whitelist.txt"
|
||||
LOCALSTORAGE_DIR="$HOME/.local/share/epiphany/localstorage"
|
||||
|
||||
|
||||
# Run Epiphany
|
||||
/usr/bin/epiphany $@
|
||||
RC=$?
|
||||
if [[ $RC != 0 ]]; then
|
||||
exit $RC
|
||||
fi
|
||||
|
||||
|
||||
### Delete cookies ###
|
||||
# Go to config directory
|
||||
cd "$CONFIG_DIR"
|
||||
|
||||
# Check cookie file
|
||||
if [ ! -e "$COOKIES" ]; then
|
||||
exit
|
||||
fi
|
||||
|
||||
# Check whitelist
|
||||
if [ ! -e "$WHITELIST" ]; then
|
||||
exit
|
||||
fi
|
||||
|
||||
# Read whitelist
|
||||
domainList=()
|
||||
while read domain
|
||||
do
|
||||
if [ -n "$domain" ]; then
|
||||
domainList=(${domainList[@]} $domain)
|
||||
fi
|
||||
done < "${WHITELIST}"
|
||||
|
||||
# Join whitelist to string
|
||||
function join {
|
||||
local IFS="$1";
|
||||
shift;
|
||||
echo "$*";
|
||||
}
|
||||
domainString=`join , "${domainList[@]}"`
|
||||
domainString=\'${domainString//,/\',\'}\'
|
||||
|
||||
# Delete cookies
|
||||
sqlite3 cookies.sqlite "DELETE FROM moz_cookies WHERE host NOT IN (${domainString});"
|
||||
|
||||
|
||||
### Delete locale storage ###
|
||||
cd "$LOCALSTORAGE_DIR"
|
||||
rm *.localstorage
|
||||
if [ -e "StorageTracker.db" ]; then
|
||||
rm StorageTracker.db
|
||||
fi
|
||||
Loading…
Add table
Add a link
Reference in a new issue