mirror of
https://github.com/mrworf/plexupdate.git
synced 2025-08-20 21:33:16 -07:00
Check if server activity call requires a token before asking for one
This commit is contained in:
parent
ab7f4052b1
commit
6ae101f8d6
2 changed files with 14 additions and 12 deletions
|
@ -178,8 +178,17 @@ getLocalSHA() {
|
||||||
|
|
||||||
# RNNG
|
# RNNG
|
||||||
running() {
|
running() {
|
||||||
local DATA="$(wget --no-check-certificate -q -O - https://$1:$3/status/sessions?X-Plex-Token=$2)"
|
# If a server is unclaimed, it probably doesn't have TLS enabled either
|
||||||
|
local DATA="$(wget -q -O - http://$1:$2/status/sessions)"
|
||||||
local RET=$?
|
local RET=$?
|
||||||
|
|
||||||
|
if [ ${RET} -eq 6 ]; then
|
||||||
|
# Server may be claimed, in which case we should use TLS and pass a token
|
||||||
|
getPlexToken
|
||||||
|
DATA="$(wget --no-check-certificate -q -O - https://$1:$2/status/sessions?X-Plex-Token=$TOKEN)"
|
||||||
|
RET=$?
|
||||||
|
fi
|
||||||
|
|
||||||
if [ ${RET} -eq 0 ]; then
|
if [ ${RET} -eq 0 ]; then
|
||||||
if [ -z "${DATA}" ]; then
|
if [ -z "${DATA}" ]; then
|
||||||
# Odd, but usually means noone is watching
|
# Odd, but usually means noone is watching
|
||||||
|
|
|
@ -334,16 +334,9 @@ if [ "${CHECKUPDATE}" = "yes" -a "${AUTOUPDATE}" = "no" ]; then
|
||||||
popd > /dev/null
|
popd > /dev/null
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "${PUBLIC}" = "no" -o -n "${PLEXSERVER}" ] && ! getPlexToken; then
|
if [ "${PUBLIC}" = "no" ] && ! getPlexToken; then
|
||||||
if [ "${PUBLIC}" = "no" ]; then
|
|
||||||
error "Unable to get Plex token, falling back to public release"
|
error "Unable to get Plex token, falling back to public release"
|
||||||
PUBLIC="yes"
|
PUBLIC="yes"
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -n "${PLEXSERVER}" ]; then
|
|
||||||
error "Unable to get Plex token, server activity check will be skipped"
|
|
||||||
PLEXSERVER=
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$PUBLIC" != "no" ]; then
|
if [ "$PUBLIC" != "no" ]; then
|
||||||
|
@ -491,7 +484,7 @@ fi
|
||||||
|
|
||||||
if [ -n "${PLEXSERVER}" -a "${AUTOINSTALL}" = "yes" ]; then
|
if [ -n "${PLEXSERVER}" -a "${AUTOINSTALL}" = "yes" ]; then
|
||||||
# Check if server is in-use before continuing (thanks @AltonV, @hakong and @sufr3ak)...
|
# Check if server is in-use before continuing (thanks @AltonV, @hakong and @sufr3ak)...
|
||||||
if running "${PLEXSERVER}" "${TOKEN}" "${PLEXPORT}"; then
|
if running "${PLEXSERVER}" "${PLEXPORT}"; then
|
||||||
error "Server ${PLEXSERVER} is currently being used by one or more users, skipping installation. Please run again later"
|
error "Server ${PLEXSERVER} is currently being used by one or more users, skipping installation. Please run again later"
|
||||||
exit 6
|
exit 6
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue