From 5558564da8a06a52ec4dc996ce72fad6bf325174 Mon Sep 17 00:00:00 2001 From: Brian Zalewski Date: Wed, 1 Feb 2023 13:43:29 +0000 Subject: [PATCH] Update 8 files - /home/dot_local/share/firefox/distribution/policies.json - /home/dot_local/share/firefox/profiles.ini.tmpl - /home/.chezmoidata.yaml - /home/.chezmoiscripts/universal/run_onchange_after_40-firefox.tmpl - /home/dot_config/firefoxprofileswitcher/avatars.json - /home/dot_config/firefoxprofileswitcher/global-options.json - /home/dot_config/firefoxprofileswitcher/profile-options.json - /.vscode/settings.json --- .vscode/settings.json | 2 +- home/.chezmoidata.yaml | 1 + .../run_onchange_after_40-firefox.tmpl | 67 ++++++++++++++----- .../firefoxprofileswitcher/avatars.json | 11 +++ .../global-options.json | 4 ++ .../profile-options.json | 11 +++ .../share/firefox/distribution/policies.json | 12 ---- .../dot_local/share/firefox/profiles.ini.tmpl | 5 ++ 8 files changed, 85 insertions(+), 28 deletions(-) create mode 100644 home/dot_config/firefoxprofileswitcher/avatars.json create mode 100644 home/dot_config/firefoxprofileswitcher/global-options.json create mode 100644 home/dot_config/firefoxprofileswitcher/profile-options.json diff --git a/.vscode/settings.json b/.vscode/settings.json index 5c6d875d..c4a57fb0 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -12,7 +12,7 @@ "editor.defaultFormatter": "esbenp.prettier-vscode" }, "[json]": { - "editor.defaultFormatter": "esbenp.prettier-vscode" + "editor.defaultFormatter": "vscode.json-language-features" }, "[jsonc]": { "editor.defaultFormatter": "esbenp.prettier-vscode" diff --git a/home/.chezmoidata.yaml b/home/.chezmoidata.yaml index 20639da8..65519a0b 100644 --- a/home/.chezmoidata.yaml +++ b/home/.chezmoidata.yaml @@ -67,6 +67,7 @@ chromeExtensions: - https://chrome.google.com/webstore/detail/vytal/ncbknoohfjmcfneopnfkapmkblaenokb - https://chrome.google.com/webstore/detail/web-archives/hkligngkgcpcolhcnkgccglchdafcnao - https://chrome.google.com/webstore/detail/web-vitals/ahfhijdlegdabablpippeagghigmibma +firefoxProfile: https://dash.cloudflare.com/84fa0d1b16ff8086dd958c468ce7fd59/r2/overview/buckets/public/objects/firefox-preconfigured-profile.primary.tar.gz firefoxAddOns: - automa - bitwarden-password-manager diff --git a/home/.chezmoiscripts/universal/run_onchange_after_40-firefox.tmpl b/home/.chezmoiscripts/universal/run_onchange_after_40-firefox.tmpl index 121f0778..765d72c2 100644 --- a/home/.chezmoiscripts/universal/run_onchange_after_40-firefox.tmpl +++ b/home/.chezmoiscripts/universal/run_onchange_after_40-firefox.tmpl @@ -133,26 +133,63 @@ for SETTINGS_DIR in "$HOME/snap/firefox/common/.mozilla/firefox" "$HOME/.var/app fi ### Initiatize Firefox default profiles if command -v "$FIREFOX_EXE" > /dev/null; then + ### Create default profile by launching Firefox headlessly logg info "Firefox executable set to $FIREFOX_EXE" if [ ! -d "$SETTINGS_DIR" ]; then logg info 'Running Firefox headlessly to generate default profiles' timeout 8 "$FIREFOX_EXE" --headless logg info 'Finished running Firefox headlessly' fi + + ### Default profile (created by launching Firefox headlessly) DEFAULT_RELEASE_PROFILE="$(find "$SETTINGS_DIR" -mindepth 1 -maxdepth 1 -name "*.default-*")" - DEFAULT_PROFILE="$(find "$SETTINGS_DIR" -mindepth 1 -maxdepth 1 -name "*.default" -not -name "profile.default")" - if [ -n "$DEFAULT_PROFILE" ] && [ "$DEFAULT_PROFILE" != "$SETTINGS_DIR/profile.default" ]; then - logg info "Renaming $DEFAULT_PROFILE to $SETTINGS_DIR/profile.default" - rsync -a "$DEFAULT_PROFILE/" "$SETTINGS_DIR/profile.default" - fi + # DEFAULT_PROFILE="$(find "$SETTINGS_DIR" -mindepth 1 -maxdepth 1 -name "*.default" -not -name "profile.default")" if [ -n "$DEFAULT_RELEASE_PROFILE" ]; then - logg info "Renaming $DEFAULT_RELEASE_PROFILE to $SETTINGS_DIR/profile.primary" - rsync -a "$DEFAULT_RELEASE_PROFILE/" "$SETTINGS_DIR/profile.primary" + logg info "Renaming $DEFAULT_RELEASE_PROFILE to $SETTINGS_DIR/profile.default" + rsync -a "$DEFAULT_RELEASE_PROFILE/" "$SETTINGS_DIR/profile.default" fi - if [ ! -d "$SETTINGS_DIR/profile.secondary" ] && [ -d "$SETTINGS_DIR/profile.default" ]; then - logg info 'Adding a secondary profile' - rsync -a "$SETTINGS_DIR/profile.default/" "$SETTINGS_DIR/profile.secondary" + + ### Default profile w/ plugins installed (installation happens below) + if [ -n "$DEFAULT_RELEASE_PROFILE" ]; then + logg info "Renaming $DEFAULT_RELEASE_PROFILE to $SETTINGS_DIR/profile.plugins" + rsync -a "$DEFAULT_RELEASE_PROFILE/" "$SETTINGS_DIR/profile.plugins" fi + + ### Miscellaneous default profiles + for NEW_PROFILE in "automation" "development" "miscellaneous"; do + if [ ! -d "$SETTINGS_DIR/profile.${NEW_PROFILE}" ] && [ -d "$SETTINGS_DIR/profile.default" ]; then + logg info "Cloning $NEW_PROFILE from profile.default" + rsync -a "$SETTINGS_DIR/profile.default/" "$SETTINGS_DIR/profile.${NEW_PROFILE}" + fi + done + + ### Public git profile + if [ -d "$SETTINGS_DIR/profile.git" ]; then + logg info 'Resetting the Firefox git profile' + cd "$SETTINGS_DIR/profile.git" + git reset --hard HEAD + git clean -fxd + logg info 'Pulling latest updates to the Firefox git profile' + git pull origin master + else + logg info 'Cloning the public Firefox git profile' + cd "$SETTINGS_DIR" + git clone {{ .firefoxPublicProfile }} profile.git + fi + + ### Private hosted profile + if [ ! -d "$SETTINGS_DIR/profile.private" ]; then + logg info 'Downloading the encrypted Firefox private profile' + curl -sSL '{{ .firefoxPrivateProfile }}' -o profile.private.tar.gz.age + logg info 'Decrypting the Firefox private profile' + chezmoi decrypt profile.private.tar.gz.age > profile.private.tar.gz + rm -f profile.private.tar.gz.age + logg info 'Decompressing the Firefox private profile' + tar -xzf profile.private.tar.gz + logg success 'The Firefox private profile was successfully installed' + fi + + ### Add the populated profiles.ini logg info "Copying "${XDG_DATA_HOME:-$HOME/.local/share}/firefox/profiles.ini" to profile directory" if [ -d /Applications ] && [ -d /System ]; then # macOS @@ -190,12 +227,12 @@ for SETTINGS_DIR in "$HOME/snap/firefox/common/.mozilla/firefox" "$HOME/.var/app PLUGIN_URL="$(cat "$PLUGIN_HTML" | htmlq '.InstallButtonWrapper-download-link' --attribute href)" PLUGIN_FILENAME="${PLUGIN_FILE_ID}.xpi" PLUGIN_FOLDER="$(echo "$PLUGIN_FILENAME" | sed 's/.xpi$//')" - if [ ! -d "$SETTINGS_DIR/profile.primary/extensions/$PLUGIN_FOLDER" ]; then + if [ ! -d "$SETTINGS_DIR/profile.plugins/extensions/$PLUGIN_FOLDER" ]; then logg info 'Downloading plugin file for '"$PLUGIN_FILENAME"' ('"$FIREFOX_PLUGIN"')' - if [ ! -d "$SETTINGS_DIR/profile.primary/extensions" ]; then - mkdir -p "$SETTINGS_DIR/profile.primary/extensions" + if [ ! -d "$SETTINGS_DIR/profile.plugins/extensions" ]; then + mkdir -p "$SETTINGS_DIR/profile.plugins/extensions" fi - curl -sSL "$PLUGIN_URL" -o "$SETTINGS_DIR/profile.primary/extensions/$PLUGIN_FILENAME" + curl -sSL "$PLUGIN_URL" -o "$SETTINGS_DIR/profile.plugins/extensions/$PLUGIN_FILENAME" # Unzipping like this causes Firefox to complain about unsigned plugins # TODO - figure out how to headlessly enable the extensions in such a way that is compatible with Flatpak / Snap # using the /usr/lib/firefox/distribution/policies.json works but this is not compatible with Flatpak / Snap out of the box @@ -203,7 +240,7 @@ for SETTINGS_DIR in "$HOME/snap/firefox/common/.mozilla/firefox" "$HOME/.var/app # all Firefox profiles to use the same extensions. Ideally, we should find a way to enable the extensions scoped # to the user profile. # logg info 'Unzipping '"$PLUGIN_FILENAME"' ('"$FIREFOX_PLUGIN"')' - # unzip "$SETTINGS_DIR/profile.primary/extensions/$PLUGIN_FILENAME" -d "$SETTINGS_DIR/profile.primary/extensions/$PLUGIN_FOLDER" + # unzip "$SETTINGS_DIR/profile.plugins/extensions/$PLUGIN_FILENAME" -d "$SETTINGS_DIR/profile.primary/extensions/$PLUGIN_FOLDER" logg success 'Installed `'"$FIREFOX_PLUGIN"'`' fi else diff --git a/home/dot_config/firefoxprofileswitcher/avatars.json b/home/dot_config/firefoxprofileswitcher/avatars.json new file mode 100644 index 00000000..81292b4f --- /dev/null +++ b/home/dot_config/firefoxprofileswitcher/avatars.json @@ -0,0 +1,11 @@ +{ + "avatars": { + "0B803C3C78AB69A7FA2B43EDF4F139C60B16081EE3C8B4F98FAF07D2EA236505": "res:/img/avatars/modern_cros_200/abstract/avatar_melon.png", + "43D07063950E4B54FE593B7C6DF3BC64ADAA374A1BBFA885CDFC04C7A3C8072A": "res:/img/avatars/modern_cros_200/abstract/avatar_pizza.png", + "A9D6FA4B7A2043B7FB3EDCB95FEDCC8B137DF5821357CF76ADB6B29B5B3E558A": "res:/img/avatars/modern_cros_200/abstract/avatar_sandwich.png", + "E098B8A5E8AD32E45AFFE798EBA7067D889111E9D57D92FA01046EF0AFCB1CCA": "res:/img/avatars/modern_cros_200/abstract/avatar_icewater.png", + "2E72B43D0149045B0A028448C9D10BD55F961857D1AD7F758BE71CB87539E787": "res:/img/avatars/modern_cros_200/illustration/avatar_cheese.png", + "1D24BBDF1FB63F9785102F65138E17B1EE8C8531856791F6646A3C75F9B3F852": "res:/img/avatars/modern_cros_200/illustration/avatar_basketball.png", + "4C1004A5D052D0ED7B120AC39DFD6F33EAD3EA7EAC047B9DD4F8AEF91232BE51": "res:/img/avatars/modern_cros_200/abstract/avatar_avocado.png" + } +} \ No newline at end of file diff --git a/home/dot_config/firefoxprofileswitcher/global-options.json b/home/dot_config/firefoxprofileswitcher/global-options.json new file mode 100644 index 00000000..d44a21ec --- /dev/null +++ b/home/dot_config/firefoxprofileswitcher/global-options.json @@ -0,0 +1,4 @@ +{ + "windowFocusWorkaround": false, + "darkMode": true +} \ No newline at end of file diff --git a/home/dot_config/firefoxprofileswitcher/profile-options.json b/home/dot_config/firefoxprofileswitcher/profile-options.json new file mode 100644 index 00000000..316c94e2 --- /dev/null +++ b/home/dot_config/firefoxprofileswitcher/profile-options.json @@ -0,0 +1,11 @@ +{ + "options": { + "E098B8A5E8AD32E45AFFE798EBA7067D889111E9D57D92FA01046EF0AFCB1CCA": {}, + "2E72B43D0149045B0A028448C9D10BD55F961857D1AD7F758BE71CB87539E787": {}, + "0B803C3C78AB69A7FA2B43EDF4F139C60B16081EE3C8B4F98FAF07D2EA236505": {}, + "43D07063950E4B54FE593B7C6DF3BC64ADAA374A1BBFA885CDFC04C7A3C8072A": {}, + "1D24BBDF1FB63F9785102F65138E17B1EE8C8531856791F6646A3C75F9B3F852": {}, + "A9D6FA4B7A2043B7FB3EDCB95FEDCC8B137DF5821357CF76ADB6B29B5B3E558A": {}, + "4C1004A5D052D0ED7B120AC39DFD6F33EAD3EA7EAC047B9DD4F8AEF91232BE51": {} + } +} \ No newline at end of file diff --git a/home/dot_local/share/firefox/distribution/policies.json b/home/dot_local/share/firefox/distribution/policies.json index 932f14eb..4f73ebe7 100644 --- a/home/dot_local/share/firefox/distribution/policies.json +++ b/home/dot_local/share/firefox/distribution/policies.json @@ -27,10 +27,6 @@ "install_url": "https://addons.mozilla.org/firefox/downloads/latest/clearurls/latest.xpi", "installation_mode": "normal_installed" }, - "CookieAutoDelete@kennydo.com": { - "install_url": "https://addons.mozilla.org/firefox/downloads/latest/cookie-autodelete/latest.xpi", - "installation_mode": "normal_installed" - }, "Decentraleyes@ThomasRientjes": { "install_url": "https://addons.mozilla.org/firefox/downloads/latest/decentraleyes/latest.xpi", "installation_mode": "normal_installed" @@ -43,14 +39,6 @@ "install_url": "https://addons.mozilla.org/firefox/downloads/latest/temporary-containers/latest.xpi", "installation_mode": "normal_installed" }, - "https-everywhere@eff.org": { - "install_url": "https://addons.mozilla.org/firefox/downloads/latest/https-everywhere/latest.xpi", - "installation_mode": "normal_installed" - }, - "jid1-MnnxcxisBPnSXQ@jetpack": { - "install_url": "https://addons.mozilla.org/firefox/downloads/latest/privacy-badger17/latest.xpi", - "installation_mode": "normal_installed" - }, "uBlock0@raymondhill.net": { "install_url": "https://addons.mozilla.org/firefox/downloads/latest/ublock-origin/latest.xpi", "installation_mode": "normal_installed" diff --git a/home/dot_local/share/firefox/profiles.ini.tmpl b/home/dot_local/share/firefox/profiles.ini.tmpl index 0956570d..f3d832e7 100644 --- a/home/dot_local/share/firefox/profiles.ini.tmpl +++ b/home/dot_local/share/firefox/profiles.ini.tmpl @@ -1,3 +1,8 @@ +[Profile3] +Name=Development +IsRelative=1 +Path={{ if eq .host.distro.family "darwin" }}Profiles/{{ end }}profile.development + [Profile2] Name=Secondary IsRelative=1