mirror of
https://github.com/mrworf/plexupdate.git
synced 2025-08-20 13:23:21 -07:00
Only store tokens if PMS token is unavailable
This commit is contained in:
parent
6565c3a875
commit
c0353a2a5d
2 changed files with 14 additions and 6 deletions
|
@ -147,17 +147,21 @@ configure_plexupdate() {
|
|||
[ -f "$CONFIGFILE" ] && source "$CONFIGFILE"
|
||||
|
||||
echo
|
||||
echo -n "Do you want to install the latest PlexPass releases? (requires PlexPass username and password) "
|
||||
echo -n "Do you want to install the latest PlexPass releases? (requires PlexPass account) "
|
||||
# The answer to this question and the value of PUBLIC are basically inverted
|
||||
if [ "$PUBLIC" == "yes" ]; then
|
||||
default=N
|
||||
fi
|
||||
if yesno $default; then
|
||||
PUBLIC=no
|
||||
source "${FULL_PATH}/plexupdate-core"
|
||||
getPlexToken
|
||||
if [ -z "$TOKEN" ]; then
|
||||
abort "Failed to retrieve Plex token, please try again."
|
||||
# If they already have a VALID token, leave it alone
|
||||
if [ -z "$TOKEN" ] || ! verifyToken;
|
||||
if getPlexServerToken; then
|
||||
# Only store the token if it's not in PMS
|
||||
TOKEN=
|
||||
else
|
||||
getPlexToken
|
||||
fi
|
||||
fi
|
||||
else
|
||||
# don't forget to erase old settings if they changed their answer
|
||||
|
@ -336,7 +340,7 @@ else
|
|||
install_plexupdate
|
||||
fi
|
||||
|
||||
|
||||
source "${FULL_PATH}/plexupdate-core"
|
||||
|
||||
configure_plexupdate
|
||||
configure_cron
|
||||
|
|
|
@ -200,6 +200,10 @@ running() {
|
|||
fi
|
||||
}
|
||||
|
||||
verifyToken() {
|
||||
wget -qO /dev/null "https://plex.tv/api/resources?X-Plex-Token=${TOKEN}"
|
||||
}
|
||||
|
||||
# Shared functions
|
||||
|
||||
# SHARED
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue