Refactored rbw-autofill

This commit is contained in:
2026-02-23 14:12:08 +00:00
parent 2e1da650f1
commit d25930beda
2 changed files with 22 additions and 23 deletions

View File

@@ -2,27 +2,5 @@
pkgs.writeShellApplication {
name = "rbw-autofill";
runtimeInputs = [pkgs.bash pkgs.libsecret pkgs.zenity];
text = ''
#!/usr/bin/env bash
echo "OK"
while read -r line; do
if [[ "$line" == "GETPIN" ]]; then
pass=$(secret-tool lookup application rbw 2>/dev/null)
if [[ -z "$pass" ]]; then
pass=$(zenity --password --title="rbw Setup" --text="Enter Bitwarden Master Password to save to Keyring:")
if [[ -n "$pass" ]]; then
printf "%s" "$pass" | secret-tool store --label="rbw" application rbw
else
echo "ERR 100 Password retrieval cancelled"
exit 1
fi
fi
printf "D %s\n" "$pass"
echo "OK"
exit 0
fi
echo "OK"
done
'';
text = builtins.readFile ./rbw_autofill.sh;
}

View File

@@ -0,0 +1,21 @@
#!/usr/bin/env bash
echo "OK"
while read -r line; do
if [[ "$line" == "GETPIN" ]]; then
pass=$(secret-tool lookup application rbw 2>/dev/null)
if [[ -z "$pass" ]]; then
pass=$(zenity --password --title="rbw Setup" --text="Enter Bitwarden Master Password to save to Keyring:")
if [[ -n "$pass" ]]; then
printf "%s" "$pass" | secret-tool store --label="rbw" application rbw
else
echo "ERR 100 Password retrieval cancelled"
exit 1
fi
fi
printf "D %s\n" "$pass"
echo "OK"
exit 0
fi
echo "OK"
done