aboutsummaryrefslogtreecommitdiffstats
path: root/hm/soispha/conf/firefox/scripts
diff options
context:
space:
mode:
authorSoispha <soispha@vhack.eu>2024-02-20 17:21:42 +0100
committerSoispha <soispha@vhack.eu>2024-02-20 17:21:42 +0100
commitf2bdeaed0bcf97a880fe36cfc8a050d1643120b8 (patch)
treeba4fe9c3ddf076529701c0e776ffef2104ac23d5 /hm/soispha/conf/firefox/scripts
parentrefactor(treewide): Add a `.sh` extension to shell scripts (diff)
downloadnixos-config-f2bdeaed0bcf97a880fe36cfc8a050d1643120b8.zip
refactor(treewide): Reformat all files with treefmt
This includes getting all shellscripts to pass shellcheck. To accomplish this, some old scripts were removed
Diffstat (limited to 'hm/soispha/conf/firefox/scripts')
-rwxr-xr-xhm/soispha/conf/firefox/scripts/extract_cookies.sh11
-rwxr-xr-xhm/soispha/conf/firefox/scripts/unzip_mozlz4.py41
-rwxr-xr-xhm/soispha/conf/firefox/scripts/update_extensions.sh9
3 files changed, 27 insertions, 34 deletions
diff --git a/hm/soispha/conf/firefox/scripts/extract_cookies.sh b/hm/soispha/conf/firefox/scripts/extract_cookies.sh
index e4eec72c..e3d50d43 100755
--- a/hm/soispha/conf/firefox/scripts/extract_cookies.sh
+++ b/hm/soispha/conf/firefox/scripts/extract_cookies.sh
@@ -10,7 +10,6 @@
# which means cookies which are kept only in memory ("session cookies")
# will not be extracted. You will need an extension to do that.
-
# USAGE:
#
# $ extract_cookies.sh > /tmp/cookies.txt
@@ -31,20 +30,17 @@
#
# B) If you've redirected stdin (with < or |) , then that will be used.
-
# HISTORY: I believe this is circa 2010 from:
# http://slacy.com/blog/2010/02/using-cookies-sqlite-in-wget-or-curl/
# However, that site is down now.
# Cleaned up by Hackerb9 (2017) to be more robust and require less typing.
-
cleanup() {
rm -f "$TMPFILE"
exit 0
}
-trap cleanup EXIT INT QUIT TERM
-
+trap cleanup EXIT INT QUIT TERM
if [ "$#" -ge 1 ]; then
SQLFILE="$1"
@@ -59,14 +55,13 @@ fi
# We have to copy cookies.sqlite, because FireFox has a lock on it
TMPFILE=$(mktemp /tmp/cookies.sqlite.XXXXXXXXXX)
-cat "$SQLFILE" >> "$TMPFILE"
-
+cat "$SQLFILE" >>"$TMPFILE"
# This is the format of the sqlite database:
# CREATE TABLE moz_cookies (id INTEGER PRIMARY KEY, name TEXT, value TEXT, host TEXT, path TEXT,expiry INTEGER, lastAccessed INTEGER, isSecure INTEGER, isHttpOnly INTEGER);
echo "# Netscape HTTP Cookie File"
-sqlite3 -separator $'\t' "$TMPFILE" << EOF
+sqlite3 -separator $'\t' "$TMPFILE" <<EOF
.mode tabs
.header off
select host,
diff --git a/hm/soispha/conf/firefox/scripts/unzip_mozlz4.py b/hm/soispha/conf/firefox/scripts/unzip_mozlz4.py
index 90dfdd29..44e00d53 100755
--- a/hm/soispha/conf/firefox/scripts/unzip_mozlz4.py
+++ b/hm/soispha/conf/firefox/scripts/unzip_mozlz4.py
@@ -18,26 +18,27 @@ def mozlz4_to_text(filepath):
def main(args):
- # Given command-line arguments of an input filepath for a ".mozlz4" file
- # and optionally an output filepath, write the decompressed text to the
- # output filepath.
- # Default output filepath is the input filepath minus the last three characters
- # (e.g. "foo.jsonlz4" becomes "foo.json")
- filepath_in = args[0]
- if len(args) < 2:
- filepath_out = filepath_in[:-3]
- else:
- filepath_out = args[1]
- text = mozlz4_to_text(filepath_in)
- with open(filepath_out, "wb") as outfile:
- outfile.write(text)
- print("Wrote decompressed text to {}".format(filepath_out))
+ # Given command-line arguments of an input filepath for a ".mozlz4" file
+ # and optionally an output filepath, write the decompressed text to the
+ # output filepath.
+ # Default output filepath is the input filepath minus the last three characters
+ # (e.g. "foo.jsonlz4" becomes "foo.json")
+ filepath_in = args[0]
+ if len(args) < 2:
+ filepath_out = filepath_in[:-3]
+ else:
+ filepath_out = args[1]
+ text = mozlz4_to_text(filepath_in)
+ with open(filepath_out, "wb") as outfile:
+ outfile.write(text)
+ print("Wrote decompressed text to {}".format(filepath_out))
if __name__ == "__main__":
- import sys
- args = sys.argv[1:]
- if args and not args[0] in ("--help", "-h"):
- main(args)
- else:
- print("Usage: mozlz4.py <mozlz4 file to read> <location to write>")
+ import sys
+
+ args = sys.argv[1:]
+ if args and not args[0] in ("--help", "-h"):
+ main(args)
+ else:
+ print("Usage: mozlz4.py <mozlz4 file to read> <location to write>")
diff --git a/hm/soispha/conf/firefox/scripts/update_extensions.sh b/hm/soispha/conf/firefox/scripts/update_extensions.sh
index f8ed3a9a..83b0146d 100755
--- a/hm/soispha/conf/firefox/scripts/update_extensions.sh
+++ b/hm/soispha/conf/firefox/scripts/update_extensions.sh
@@ -1,8 +1,7 @@
#!/bin/sh
-
tmp=$(mktemp)
-cat << EOF > "$tmp"
+cat <<EOF >"$tmp"
darkreader:navbar
keepassxc-browser:navbar
vhack-libredirect:navbar
@@ -15,8 +14,6 @@ EOF
# The bin is provided in the devshell;
# The cat execution should be unquoted;
# shellcheck disable=SC2046
-generate_extensions $(cat "$tmp") > "$(dirname "$0")"/../config/extensions/extensions.json
-
-
+generate_extensions $(cat "$tmp") >"$(dirname "$0")"/../config/extensions/extensions.json
-rm "$tmp";
+rm "$tmp"