mirror of
https://github.com/thorsten-gehrig/alexa-remote-control.git
synced 2025-11-10 18:52:41 +01:00
PR#191 switched to new auth-status detection
switched to new auth-status detection
This commit is contained in:
@@ -86,6 +86,8 @@
|
|||||||
# 2024-02-01: v0.21b changed the output of -lastalexa back to the output of devicelist.txt
|
# 2024-02-01: v0.21b changed the output of -lastalexa back to the output of devicelist.txt
|
||||||
# 2024-04-06: v0.22 changed the date calculation once again, now the date processing ignores the actual cookie validity
|
# 2024-04-06: v0.22 changed the date calculation once again, now the date processing ignores the actual cookie validity
|
||||||
# and simply sets it to "now + COOKIE_LIFETIME"
|
# and simply sets it to "now + COOKIE_LIFETIME"
|
||||||
|
# 2025-11-07: v0.23 /api/bootstrap is gone, switched to /api/customer-status
|
||||||
|
# (thanks once again to Ingo Fischer)
|
||||||
#
|
#
|
||||||
###
|
###
|
||||||
#
|
#
|
||||||
@@ -170,8 +172,6 @@ COOKIE="${TMP}/.alexa.cookie"
|
|||||||
DEVLIST="${TMP}/.alexa.devicelist"
|
DEVLIST="${TMP}/.alexa.devicelist"
|
||||||
COOKIE_LIFETIME=$(( 24 * 60 * 60 )) # default lifetime of one day before revalidation
|
COOKIE_LIFETIME=$(( 24 * 60 * 60 )) # default lifetime of one day before revalidation
|
||||||
|
|
||||||
GUIVERSION=0
|
|
||||||
|
|
||||||
LIST=""
|
LIST=""
|
||||||
LOGOFF=""
|
LOGOFF=""
|
||||||
COMMAND=""
|
COMMAND=""
|
||||||
@@ -239,7 +239,7 @@ usage()
|
|||||||
while [ "$#" -gt 0 ] ; do
|
while [ "$#" -gt 0 ] ; do
|
||||||
case "$1" in
|
case "$1" in
|
||||||
--version)
|
--version)
|
||||||
echo "v0.22"
|
echo "v0.23"
|
||||||
exit 0
|
exit 0
|
||||||
;;
|
;;
|
||||||
-d)
|
-d)
|
||||||
@@ -568,18 +568,22 @@ get_devlist()
|
|||||||
check_status()
|
check_status()
|
||||||
{
|
{
|
||||||
#
|
#
|
||||||
# bootstrap with GUI-Version writes GUI version to cookie
|
# returns the current authentication state (HTTP/200)
|
||||||
# returns among other the current authentication state
|
|
||||||
#
|
#
|
||||||
AUTHSTATUS=$(${CURL} ${OPTS} -s -b ${COOKIE} -A "${BROWSER}" -H "DNT: 1" -H "Connection: keep-alive" -L https://${ALEXA}/api/bootstrap?version=${GUIVERSION})
|
AUTHSTATUS=$(${CURL} ${OPTS} -s -w "%{http_code}" -b ${COOKIE} -A "${BROWSER}" -H "DNT: 1" -H "Connection: keep-alive" -L https://${ALEXA}/api/customer-status -o ${TMP}/.alexa.authstatus.json)
|
||||||
MEDIAOWNERCUSTOMERID=$(echo $AUTHSTATUS | sed -r 's/^.*"customerId":"([^,]+)",.*$/\1/g')
|
|
||||||
AUTHSTATUS=$(echo $AUTHSTATUS | sed -r 's/^.*"authenticated":([^,]+),.*$/\1/g')
|
|
||||||
|
|
||||||
if [ "$AUTHSTATUS" = "true" ] ; then
|
case $AUTHSTATUS in
|
||||||
|
200)
|
||||||
|
MEDIAOWNERCUSTOMERID=$(${CURL} ${OPTS} -s -b ${COOKIE} -A "${BROWSER}" -H "DNT: 1" -H "Connection: keep-alive" -L https://${ALEXA}/api/users/me | ${JQ} '.id')
|
||||||
return 1
|
return 1
|
||||||
fi
|
;;
|
||||||
|
401|403)
|
||||||
return 0
|
return 0
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
echo "ERROR: /api/customer-status returned unexpected HTTP/${AUTHSTATUS}"
|
||||||
}
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
|
|||||||
Reference in New Issue
Block a user