Skip to content

Commit fddb4d1

Browse files
Merge pull request #160 from ExtremeFiretop/dev
Dev 1.0.7 as next Stable Release
2 parents 5425c29 + 585364f commit fddb4d1

File tree

3 files changed

+34
-34
lines changed

3 files changed

+34
-34
lines changed

MerlinAU.sh

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@
44
#
55
# Original Creation Date: 2023-Oct-01 by @ExtremeFiretop.
66
# Official Co-Author: @Martinski W. - Date: 2023-Nov-01
7-
# Last Modified: 2024-Feb-29
7+
# Last Modified: 2024-Mar-03
88
###################################################################
99
set -u
1010

11-
readonly SCRIPT_VERSION=1.0.6
11+
readonly SCRIPT_VERSION=1.0.7
1212
readonly SCRIPT_NAME="MerlinAU"
1313

1414
##-------------------------------------##
@@ -1917,15 +1917,16 @@ _TestLoginCredentials_()
19171917
fi
19181918
}
19191919

1920-
##-------------------------------------##
1921-
## Added by Martinski W. [2024-Feb-29] ##
1922-
##-------------------------------------##
1920+
##----------------------------------------##
1921+
## Modified by Martinski W. [2024-Mar-03] ##
1922+
##----------------------------------------##
19231923
_GetPasswordInput_()
19241924
{
19251925
local PSWDstrLenMIN=1 PSWDstrLenMAX=64
19261926
local PSWDstring PSWDtmpStr PSWDprompt
1927-
local retCode charNum prevChar pswdLength showPSWD
1928-
local lastTabTime=0 # Added for debounce
1927+
local retCode charNum pswdLength showPSWD
1928+
# Added for TAB keypress debounce #
1929+
local lastTabTime=0 currentTime timeDiff
19291930

19301931
if [ $# -eq 0 ] || [ -z "$1" ]
19311932
then
@@ -1934,6 +1935,15 @@ _GetPasswordInput_()
19341935
fi
19351936
PSWDprompt="$1"
19361937

1938+
_GetKeypress_()
1939+
{
1940+
local savedSettings
1941+
savedSettings="$(stty -g)"
1942+
stty -echo raw
1943+
echo "$(dd count=1 2>/dev/null)"
1944+
stty "$savedSettings"
1945+
}
1946+
19371947
_showPSWDPrompt_()
19381948
{
19391949
local pswdTemp LENct LENwd
@@ -1946,7 +1956,7 @@ _GetPasswordInput_()
19461956
}
19471957

19481958
showPSWD=0
1949-
charNum="" prevChar=""
1959+
charNum=""
19501960
PSWDstring="$pswdString"
19511961
pswdLength="${#PSWDstring}"
19521962
if [ -z "$PSWDstring" ]
@@ -1955,9 +1965,11 @@ _GetPasswordInput_()
19551965
fi
19561966
echo ; _showPSWDPrompt_
19571967

1958-
while IFS='' read -n 1 -rs theChar
1968+
while IFS='' theChar="$(_GetKeypress_)"
19591969
do
1960-
if [ "$theChar" = "" ]
1970+
charNum="$(printf "%d" "'$theChar")"
1971+
1972+
if [ "$theChar" = "" ] || [ "$charNum" -eq 13 ]
19611973
then
19621974
if [ "$pswdLength" -ge "$PSWDstrLenMIN" ] && [ "$pswdLength" -le "$PSWDstrLenMAX" ]
19631975
then
@@ -1978,37 +1990,25 @@ _GetPasswordInput_()
19781990
fi
19791991
break
19801992
fi
1981-
charNum="$(printf "%d" "'$theChar")"
19821993

1983-
## TAB keypress with debounce ##
1994+
## Ignore Escape Sequences ##
1995+
[ "$charNum" -eq 27 ] && continue
1996+
1997+
## TAB keypress as toggle with debounce ##
19841998
if [ "$charNum" -eq 9 ]
19851999
then
1986-
local currentTime=$(date +%s)
1987-
local timeDiff=$((currentTime - lastTabTime))
1988-
if [ "$timeDiff" -ge 1 ] # Check if at least 1 second has passed
2000+
currentTime="$(date +%s)"
2001+
timeDiff="$((currentTime - lastTabTime))"
2002+
if [ "$timeDiff" -gt 0 ]
19892003
then
19902004
showPSWD="$((! showPSWD))"
1991-
lastTabTime=$currentTime # Update last TAB press time
2005+
lastTabTime="$currentTime" # Update last TAB press time #
19922006
_showPSWDPrompt_
19932007
fi
19942008
continue
19952009
fi
19962010

1997-
## Ignore Escape Sequences ##
1998-
if [ "$charNum" -eq 27 ]
1999-
then prevChar="${charNum}" ; continue ; fi
2000-
2001-
if [ -n "$prevChar" ] && \
2002-
{ [ "$prevChar" -eq 27 ] || \
2003-
[ "$prevChar" -eq 2791 ] || \
2004-
[ "$prevChar" -eq 279150 ] || \
2005-
[ "$prevChar" -eq 279151 ] || \
2006-
[ "$prevChar" -eq 279153 ] || \
2007-
[ "$prevChar" -eq 279154 ] ; }
2008-
then prevChar="${prevChar}${charNum}" ; continue
2009-
else prevChar="" ; fi
2010-
2011-
## Backspace keypress ##
2011+
## BACKSPACE keypress ##
20122012
if [ "$charNum" -eq 8 ] || [ "$charNum" -eq 127 ]
20132013
then
20142014
if [ "$pswdLength" -gt 0 ]

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
## v1.0.7
33
## 2024-03-09
44

5-
![image](https://github.com/ExtremeFiretop/MerlinAutoUpdate-Router/assets/1971404/3e8c1159-8e12-4c1f-9df2-d328087c7a4a)
6-
![image](https://github.com/ExtremeFiretop/MerlinAutoUpdate-Router/assets/1971404/faf9db84-b8a4-4e33-b9e4-3c231c02abb8)
5+
![image](https://github.com/ExtremeFiretop/MerlinAutoUpdate-Router/assets/1971404/21774f93-ce0a-43a9-986c-a02538e1526d)
6+
![image](https://github.com/ExtremeFiretop/MerlinAutoUpdate-Router/assets/1971404/2a12c08b-87e8-42d4-b231-e4bff58a4465)
77

88
## TESTED MODELS (Multi-image models) - i.e. Any model that uses a .w or a .pkgtb file
99

version.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.0.6
1+
1.0.7

0 commit comments

Comments
 (0)