mirror of
https://github.com/thorsten-gehrig/alexa-remote-control.git
synced 2025-10-28 20:47:36 +01:00
Changed customerId retrieval
CustomerId is now retrieved from the logged in user. The customerId in the device list is always from the user registering the device initially
This commit is contained in:
@@ -445,7 +445,9 @@ check_status()
|
||||
# bootstrap with GUI-Version writes GUI version to cookie
|
||||
# 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} | sed -r 's/^.*"authenticated":([^,]+),.*$/\1/g')
|
||||
AUTHSTATUS=$(${CURL} ${OPTS} -s -b ${COOKIE} -A "${BROWSER}" -H "DNT: 1" -H "Connection: keep-alive" -L https://${ALEXA}/api/bootstrap?version=${GUIVERSION})
|
||||
MEDIAOWNERCUSTOMERID=$(echo $AUTHSTATUS | sed -r 's/^.*"customerId":"([^,]+)",.*$/\1/g')
|
||||
AUTHSTATUS=$(echo $AUTHSTATUS | sed -r 's/^.*"authenticated":([^,]+),.*$/\1/g')
|
||||
|
||||
if [ "$AUTHSTATUS" = "true" ] ; then
|
||||
return 1
|
||||
@@ -470,7 +472,10 @@ set_var()
|
||||
|
||||
DEVICETYPE=$(jq --arg device "${DEVICE}" -r '.devices[] | select(.accountName == $device) | .deviceType' ${DEVLIST})
|
||||
DEVICESERIALNUMBER=$(jq --arg device "${DEVICE}" -r '.devices[] | select(.accountName == $device) | .serialNumber' ${DEVLIST})
|
||||
MEDIAOWNERCUSTOMERID=$(jq --arg device "${DEVICE}" -r '.devices[] | select(.accountName == $device) | .deviceOwnerCustomerId' ${DEVLIST})
|
||||
|
||||
# customerId is now retrieved from the logged in user
|
||||
# the customerId in the device list is always from the user registering the device initially
|
||||
# MEDIAOWNERCUSTOMERID=$(jq --arg device "${DEVICE}" -r '.devices[] | select(.accountName == $device) | .deviceOwnerCustomerId' ${DEVLIST})
|
||||
|
||||
if [ -z "${DEVICESERIALNUMBER}" ] ; then
|
||||
echo "ERROR: unkown device dev:${DEVICE}"
|
||||
|
||||
@@ -396,7 +396,9 @@ check_status()
|
||||
# bootstrap with GUI-Version writes GUI version to cookie
|
||||
# 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} | sed -r 's/^.*"authenticated":([^,]+),.*$/\1/g')
|
||||
AUTHSTATUS=$(${CURL} ${OPTS} -s -b ${COOKIE} -A "${BROWSER}" -H "DNT: 1" -H "Connection: keep-alive" -L https://${ALEXA}/api/bootstrap?version=${GUIVERSION})
|
||||
MEDIAOWNERCUSTOMERID=$(echo $AUTHSTATUS | sed -r 's/^.*"customerId":"([^,]+)",.*$/\1/g')
|
||||
AUTHSTATUS=$(echo $AUTHSTATUS | sed -r 's/^.*"authenticated":([^,]+),.*$/\1/g')
|
||||
|
||||
if [ "$AUTHSTATUS" = "true" ] ; then
|
||||
return 1
|
||||
@@ -419,8 +421,8 @@ set_var()
|
||||
ATTR="serialNumber"
|
||||
SERIAL=`grep ${ATTR}\| ${DEVTXT} | sed "s/^.*${ATTR}|//" | sed 's/ /_/g'`
|
||||
|
||||
ATTR="deviceOwnerCustomerId"
|
||||
MEDIAID=`grep ${ATTR}\| ${DEVTXT} | sed "s/^.*${ATTR}|//" | sed 's/ /_/g'`
|
||||
# ATTR="deviceOwnerCustomerId"
|
||||
# MEDIAID=`grep ${ATTR}\| ${DEVTXT} | sed "s/^.*${ATTR}|//" | sed 's/ /_/g'`
|
||||
|
||||
ATTR="deviceFamily"
|
||||
FAMILY=`grep ${ATTR}\| ${DEVTXT} | sed "s/^.*${ATTR}|//" | sed 's/ /_/g'`
|
||||
@@ -457,14 +459,16 @@ set_var()
|
||||
done
|
||||
fi
|
||||
|
||||
C=0
|
||||
for I in $MEDIAID ; do
|
||||
if [ $C -eq $IDX ] ; then
|
||||
MEDIAOWNERCUSTOMERID=$I
|
||||
break
|
||||
fi
|
||||
C=$((C+1))
|
||||
done
|
||||
# customerId is now retrieved from the logged in user
|
||||
# the customerId in the device list is always from the user registering the device initially
|
||||
# C=0
|
||||
# for I in $MEDIAID ; do
|
||||
# if [ $C -eq $IDX ] ; then
|
||||
# MEDIAOWNERCUSTOMERID=$I
|
||||
# break
|
||||
# fi
|
||||
# C=$((C+1))
|
||||
# done
|
||||
|
||||
C=0
|
||||
for I in $TYPE ; do
|
||||
|
||||
Reference in New Issue
Block a user