update all login paths to use new UpdateURL() function
This commit is contained in:
parent
ff8e7c3471
commit
87448d02cd
|
@ -248,6 +248,11 @@ function CreateServerGroup()
|
|||
else if type(msg) = "roSGNodeEvent"
|
||||
node = msg.getNode()
|
||||
if node = "submit"
|
||||
' Show Connecting to Server spinner
|
||||
dialog = createObject("roSGNode", "ProgressDialog")
|
||||
dialog.title = tr("Connecting to Server")
|
||||
m.scene.dialog = dialog
|
||||
|
||||
serverUrl = standardize_jellyfin_url(screen.serverUrl)
|
||||
'If this is a different server from what we know, reset username/password setting
|
||||
if m.global.session.server.url <> serverUrl
|
||||
|
@ -255,42 +260,46 @@ function CreateServerGroup()
|
|||
set_setting("password", "")
|
||||
end if
|
||||
set_setting("server", serverUrl)
|
||||
session.server.UpdateURL(serverUrl)
|
||||
' Show Connecting to Server spinner
|
||||
dialog = createObject("roSGNode", "ProgressDialog")
|
||||
dialog.title = tr("Connecting to Server")
|
||||
m.scene.dialog = dialog
|
||||
|
||||
serverInfoResult = ServerInfo()
|
||||
|
||||
isConnected = session.server.UpdateURL(serverUrl)
|
||||
serverInfoResult = invalid
|
||||
if isConnected
|
||||
serverInfoResult = ServerInfo()
|
||||
end if
|
||||
dialog.close = true
|
||||
|
||||
if serverInfoResult = invalid
|
||||
if isConnected = false or serverInfoResult = invalid
|
||||
' Maybe don't unset setting, but offer as a prompt
|
||||
' Server not found, is it online? New values / Retry
|
||||
print "Server not found, is it online? New values / Retry"
|
||||
screen.errorMessage = tr("Server not found, is it online?")
|
||||
SignOut(false)
|
||||
else if isValid(serverInfoResult.Error) and serverInfoResult.Error
|
||||
' If server redirected received, update the URL
|
||||
if isValid(serverInfoResult.UpdatedUrl)
|
||||
serverUrl = serverInfoResult.UpdatedUrl
|
||||
set_setting("server", serverUrl)
|
||||
session.server.UpdateURL(serverUrl)
|
||||
end if
|
||||
' Display Error Message to user
|
||||
message = tr("Error: ")
|
||||
if isValid(serverInfoResult.ErrorCode)
|
||||
message = message + "[" + serverInfoResult.ErrorCode.toStr() + "] "
|
||||
end if
|
||||
screen.errorMessage = message + tr(serverInfoResult.ErrorMessage)
|
||||
SignOut(false)
|
||||
else
|
||||
screen.visible = false
|
||||
if isValid(serverInfoResult.serverName)
|
||||
return serverInfoResult.ServerName + " (Saved)"
|
||||
if isValid(serverInfoResult.Error) and serverInfoResult.Error
|
||||
' If server redirected received, update the URL
|
||||
if isValid(serverInfoResult.UpdatedUrl)
|
||||
serverUrl = serverInfoResult.UpdatedUrl
|
||||
set_setting("server", serverUrl)
|
||||
isConnected = session.server.UpdateURL(serverUrl)
|
||||
if isConnected
|
||||
screen.visible = false
|
||||
return ""
|
||||
end if
|
||||
end if
|
||||
' Display Error Message to user
|
||||
message = tr("Error: ")
|
||||
if isValid(serverInfoResult.ErrorCode)
|
||||
message = message + "[" + serverInfoResult.ErrorCode.toStr() + "] "
|
||||
end if
|
||||
screen.errorMessage = message + tr(serverInfoResult.ErrorMessage)
|
||||
SignOut(false)
|
||||
else
|
||||
return "Saved"
|
||||
screen.visible = false
|
||||
if isValid(serverInfoResult.serverName)
|
||||
return serverInfoResult.ServerName + " (Saved)"
|
||||
else
|
||||
return "Saved"
|
||||
end if
|
||||
end if
|
||||
end if
|
||||
else if node = "delete_saved"
|
||||
|
|
|
@ -90,13 +90,15 @@ function ServerInfo()
|
|||
' set the server to new location and try again
|
||||
if right(headers.location, 19) = "/System/Info/Public"
|
||||
set_setting("server", left(headers.location, len(headers.location) - 19))
|
||||
session.server.UpdateURL(left(headers.location, len(headers.location) - 19))
|
||||
info = ServerInfo()
|
||||
if info.Error
|
||||
info.UpdatedUrl = left(headers.location, len(headers.location) - 19)
|
||||
info.ErrorMessage = info.ErrorMessage + " (Note: Server redirected us to " + info.UpdatedUrl + ")"
|
||||
isConnected = session.server.UpdateURL(left(headers.location, len(headers.location) - 19))
|
||||
if isConnected
|
||||
info = ServerInfo()
|
||||
if info.Error
|
||||
info.UpdatedUrl = left(headers.location, len(headers.location) - 19)
|
||||
info.ErrorMessage = info.ErrorMessage + " (Note: Server redirected us to " + info.UpdatedUrl + ")"
|
||||
end if
|
||||
return info
|
||||
end if
|
||||
return info
|
||||
end if
|
||||
end if
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user