Skip to content

Commit

Permalink
Version 6.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
ajrosen committed Sep 11, 2024
1 parent f6932a4 commit 5c75f56
Show file tree
Hide file tree
Showing 24 changed files with 440 additions and 320 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
## 6.1.0

* Search deleted items and restore them
* Add support for Zen browser
* Use --connect-timeout 3 --max-time 5 on all calls to curl
* Clean up some outputs and log messages
* Bug fixes
* Unlock vault with two different payload formats

# 6.0.0

* Add a new login item to your vault
Expand Down
11 changes: 10 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,10 @@ Keyword used to bring up Bitwarden Accelerator's main menu

Keyword used to bring up Bitwarden Accelerator's search menu

### Trash Keyword

Keyword used to search deleted items

---

<a name="invoking"></a>
Expand All @@ -133,6 +137,10 @@ There are three ways to invoke Bitwarden Accelerator.

The default hotkey is ***Control-Command-L***, because the Bitwarden browser extension uses *Shift-Command-L*. If you wish to change or disable the hotkey, open the workflow in *Alfred Preferences*. The hotkey trigger is in the top-left corner.

### Trash

Use the Trash Keyword (default: ***.bwtrash***) will list any deleted items. Select an item to restore it.

---

<a name="mainMenu"></a>
Expand Down Expand Up @@ -233,6 +241,7 @@ Supported browsers:
* [Vivaldi](https://vivaldi.com/)
* [Ghost](https://ghostbrowser.com/)
* [Arc](https://arc.net/)
* [Zen](https://zen-browser.app/)<sup>(2)</sup>

The default behavior when selecting an item depends on its *type*.

Expand Down Expand Up @@ -288,7 +297,7 @@ Lets you edit the username, password, or name of the item.

Deletes the item from your vault.

You will get a warning that **THIS ACTION CANNOT BE UNDONE**. This is not technically true; the item is moved to your vault's ***Trash***. However, Bitwarden Accelerator *does not support* recovering items from your vault's Trash.
You will get a warning that **THIS ACTION CANNOT BE UNDONE**. This is not technically true; the item is moved to your vault's ***Trash***.

---
1. *Bitwarden Accelerator makes extensive use of [jq](https://jqlang.github.io/jq/). If the [Bitwarden CLI](https://bitwarden.com/help/cli/) or [jq](https://jqlang.github.io/jq/) package is not installed, Bitwarden Accelerator will ask to install it using [Homebrew](https://brew.sh) or [MacPorts](https://ports.macports.org/). [Homebrew](https://brew.sh), [MacPorts](https://ports.macports.org/), or [Nix](https://nixos.org/) must already be installed.*
Expand Down
22 changes: 12 additions & 10 deletions add_item.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,41 +4,43 @@

. lib/env.sh

URL=$(echo "${*}" | jq -r .url)
SITE=$(echo "${URL}" | cut -d/ -f3)
log "add_item"

URL=$(jq -j .url <<< "${*}")
SITE=$(cut -d/ -f3 <<< "${URL}")

P='return text returned of (display dialog'
I='with icon caution'
T='with title "Add item"'

# Get name
CMD="${P} \"Enter name of new item\" ${I} ${T} default answer \"${SITE}\")"
NAME=$(osascript -e "${CMD}")
NAME=$(2>&- osascript -e "${CMD}")

[ "${NAME}" == "" ] && exit

# Get username
SITE=$(echo "${NAME}" | cut -d/ -f3)
SITE=$(cut -d/ -f3 <<< "${NAME}")

CMD="${P} \"Enter username for ${SITE}\" ${I} ${T} default answer \"${bwuser}\")"
USERNAME=$(osascript -e "${CMD}")
USERNAME=$(2>&- osascript -e "${CMD}")

[ "${USERNAME}" == "" ] && exit

# Get password
GENERATED=$(curl -s "${API}/generate?length=20&uppercase&lowercase&number&special" | jq -r .data.data)
GENERATED=$(curl -s "${API}/generate?length=20&uppercase&lowercase&number&special" | jq -j .data.data)

CMD="${P} \"Enter password for ${USERNAME}\" ${I} ${T} default answer \"${GENERATED}\" with hidden answer)"
PASSWORD=$(osascript -e "${CMD}")
PASSWORD=$(2>&- osascript -e "${CMD}")

[ "${PASSWORD}" == "" ] && exit

if [ "${PASSWORD}" != "${GENERATED}" ]; then
CMD="${P} \"Confirm password for ${USERNAME}\" ${I} ${T} default answer \"\" with hidden answer)"
CONFIRM=$(osascript -e "${CMD}")
CONFIRM=$(2>&- osascript -e "${CMD}")

if [ "${CONFIRM}" != "${PASSWORD}" ]; then
echo 'Add item,Passwords do not match'
echo -n 'Add item,Passwords do not match'
exit
fi
fi
Expand All @@ -60,6 +62,6 @@ PAYLOAD+=',"uris": [ { "match": null, "uri": "'"${URL}"'" }'
PAYLOAD+='] } }'

# Add item
S=$(curl -s -H 'Content-Type: application/json' -d "${PAYLOAD}" "${API}"/object/item | jq -r .success)
S=$(curl -s -H 'Content-Type: application/json' -d "${PAYLOAD}" "${API}"/object/item | jq -j .success)

echo -n "Added ${SITE//,/ },Success: ${S}"
2 changes: 1 addition & 1 deletion get_attachment.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ fi
log curl -s --output-dir "${downloadFolder}" -o "${attachmentName}" "${API}/object/attachment/${attachmentId}?itemid=${id}"
curl -s --output-dir "${downloadFolder}" -o "${attachmentName}" "${API}/object/attachment/${attachmentId}?itemid=${id}"

echo "${downloadFolder}"
echo -n "${downloadFolder}"
2 changes: 1 addition & 1 deletion get_code.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ if [ "${twoStepMethod}" == "1" ]; then
bw --nointeraction login "${bwuser}" --method "${twoStepMethod}" --passwordenv PASS
fi

CODE=$(./get_code.applescript "${twoStepMethod}")
CODE=$(2>&- ./get_code.applescript "${twoStepMethod}")

echo "--method ${twoStepMethod} --code ${CODE}"
6 changes: 3 additions & 3 deletions get_field.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ log "${API}/object/${field}/${id}"

OBJ=$(curl -s "${API}"/object/"${field}"/"${id}")

if [ "$(jq -r .success <<< "${OBJ}")" == "true" ]; then
jq -r .data.data <<< "${OBJ}"
if [ "$(jq -j .success <<< "${OBJ}")" == "true" ]; then
jq -j .data.data <<< "${OBJ}"
else
jq -r .message <<< "${OBJ}"
jq -j .message <<< "${OBJ}"
exit 1
fi
10 changes: 3 additions & 7 deletions get_firefox_url.sh
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
#!/bin/bash

# shellcheck disable=2154

. lib/env.sh
# shellcheck disable=2059

# Look for workflow
AF=$(echo ../*/alfred-firefox)
[ "${AF}" == "../*/alfred-firefox" ] && exit 0
[ "${AF}" == "2>&- ../*/alfred-firefox" ] && exit 0

TAB_INFO=$(${AF} tab-info)

log "Firefox ${TAB_INFO}"

jq -r .alfredworkflow.variables.FF_URL <<< "${TAB_INFO}"
jq -j .alfredworkflow.variables.FF_URL <<< "${TAB_INFO}"
6 changes: 4 additions & 2 deletions get_new_field.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

. lib/env.sh

log "get_new_field"

function mkscript() {
script='return text returned of (display dialog "'"${1}"'"'
script="${script} buttons { \"OK\", \"Cancel\" }"
Expand All @@ -21,15 +23,15 @@ jqItem=".login.username"

# Prompt for new value
mkscript "Enter new value:"
new=$(osascript -e "${script}")
new=$(2>&- osascript -e "${script}")

# Exit if canceled
[ "${new}" == "" ] && exit 0

# Confirm value if password
if [ "${editField}" == "Password" ]; then
mkscript "Confirm new password"
again=$(osascript -e "${script}")
again=$(2>&- osascript -e "${script}")

if [ "${new}" != "${again}" ]; then
osascript -e 'display notification "Passwords do not match"'
Expand Down
Binary file added icons/org.mozilla.com.zen.browser.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 5c75f56

Please sign in to comment.