From 0c092f7ab7bddec1e27dc7fa5f53c5ab0de39e36 Mon Sep 17 00:00:00 2001 From: Shihaam Abdul Rahman Date: Sun, 20 Aug 2023 12:24:56 +0500 Subject: [PATCH] added passcode setup if not found --- scripts/tginput.sh | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/scripts/tginput.sh b/scripts/tginput.sh index ae8d730..432c939 100755 --- a/scripts/tginput.sh +++ b/scripts/tginput.sh @@ -23,16 +23,20 @@ lock_tg(){ xdotool windowactivate --sync $tg_window_id key ctrl+l } -readpin(){ - if [[ ! -f ~/.local/.tgpin.txt ]]; then +read_passcode(){ + if [[ ! -f $HOME/.local/.tgpasscode ]]; then echo "Error: PIN file not found!" - exit 1 + echo "Enter Telegram local passcode seperated characters by space" + echo "If passcode is 1234, then enter 1 2 3 4 " + read -p "Enter passcode: " PASSCODE + echo $PASSCODE > $HOME/.local/.tgpasscode + echo Telegram Passcode saved at: $HOME/.local/.tgpasscode fi - tgpin=$(cat ~/.local/.tgpin.txt) + tgpasscode=$(cat $HOME/.local/.tgpasscode) } unlock_tg(){ - xdotool windowactivate --sync $tg_window_id key $tgpin Return + xdotool windowactivate --sync $tg_window_id key $tgpasscode Return } if [ "$1" == "lock" ]; then @@ -41,7 +45,7 @@ if [ "$1" == "lock" ]; then lock_tg return_mouse elif [ "$1" == "unlock" ]; then - readpin + read_passcode get_tg_window_id get_mouse_location unlock_tg