Adds authentication as anyrun

This commit is contained in:
Michel Fedde 2025-09-13 00:56:43 +02:00
parent fec7b2ca1e
commit 3761169203
6 changed files with 34 additions and 3 deletions

View file

@ -108,7 +108,7 @@ bind = $mainMod Shift, Return, exec, hyprdrop ghostty --identifier term_hyprdrop
bind = $mainMod, Z, exec, $files
bind = $mainMod, R, focusurgentorlast
bind = $mainMod SHIFT, P, exec, $scriptsDir/anyrun/Bitwarden.sh
bind = $mainMod SHIFT, P, exec, $scriptsDir/anyrun/Auth.sh
# Master Layout Keybinds
bind = $mainMod, A, layoutmsg,swapwithmaster master

View file

@ -0,0 +1,4 @@
return {
"kaarmu/typst.vim",
ft = "typst",
}

24
.config/scripts/anyrun/Auth.sh Executable file
View file

@ -0,0 +1,24 @@
#!/bin/env sh
SCRIPTPATH="$(
cd -- "$(dirname "$0")" >/dev/null 2>&1
pwd -P
)"
TOKEN=$(cat "$SCRIPTPATH/.auth-token")
DOMAIN="https://auth.iedsoftworks.com"
list=$(curl --oauth2-bearer "$TOKEN" "$DOMAIN/api/v1/twofaccounts" | jq 'map({"\(.service) - \(.account)": .id}) | add' -r)
selection=$(echo "$list" | jq 'keys | map("\(.)\n") | add' -r | anyrun --plugins libstdin.so)
if [[ $selection == "" ]]; then
exit 0
fi
id=$(echo $list | jq ".[\"${selection}\"]")
curl --oauth2-bearer "$TOKEN" "$DOMAIN/api/v1/twofaccounts/$id/otp" |
jq ".password" -r |
wl-copy
notify-send -i "lock" "2FA Code copied" "Copied code for '$selection'"

View file

@ -1,3 +1,5 @@
.ssh/*.key
.local/share/kwalletd/*
.config/scripts/anyrun/.auth-token