Skip to content

Commit

Permalink
Fix launching proxy service with Flatpak
Browse files Browse the repository at this point in the history
  • Loading branch information
droidmonkey committed Oct 29, 2022
1 parent ceb2cd2 commit 3efad4e
Showing 1 changed file with 8 additions and 16 deletions.
24 changes: 8 additions & 16 deletions utils/keepassxc-flatpak-wrapper.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,26 +23,18 @@
# For format of parsed arguments, see "Connection-based messaging" at:
# https://developer.mozilla.org/docs/Mozilla/Add-ons/WebExtensions/Native_messaging

readonly appId='org.keepassxc.KeePassXC'
# Chromium, Google Chrome, Vivaldi & Brave
readonly arg1='chrome-extension://oboonakemofpalcgghocfoadofidjkkk'
# Firefox & Tor Browser
readonly arg2='[email protected]'

# Browser integration is enabled if unix socket exists
if [[ -S "${XDG_RUNTIME_DIR}/app/${appId}/${appId}.BrowserServer" ]]; then
# Using the =~ operator is intended to allow small variations
# in the parameters, like and ending slash.
# shellcheck disable=2076
if [[ "$1" =~ "${arg1}" ]] || [[ "$2" =~ "${arg2}" ]]; then
exec keepassxc-proxy "$@"
fi
fi

# If the first argument is "cli", execute keepassxc-cli instead.
if [[ "$1" == "cli" ]]; then
# Check arguments to see if this was a proxy launch from the browser
# Use =~ to account for minor variations in the chrome extension
if [[ "$1" =~ "$arg1" || "$2" == "$arg2" ]]; then
exec keepassxc-proxy "$@"
elif [[ "$1" == "cli" ]]; then
exec keepassxc-cli "${@:2}"
else
# If no arguments are matched or browser integration is off, execute keepassxc
exec keepassxc "$@"
fi

# If no arguments are matched or browser integration is off, execute keepassxc
exec keepassxc "$@"

0 comments on commit 3efad4e

Please sign in to comment.