update startover var and session if saver serverurl has no connection at s tartup
This commit is contained in:
parent
d5b7e0ebdb
commit
94bcf10231
|
@ -5,7 +5,11 @@ function LoginFlow(startOver = false as boolean)
|
|||
serverUrl = get_setting("server")
|
||||
if isValid(serverUrl)
|
||||
print "Previous server connection saved to registry"
|
||||
session.server.UpdateURL(serverUrl)
|
||||
startOver = not session.server.UpdateURL(serverUrl)
|
||||
if startOver
|
||||
print "Could not connect to previously saved server."
|
||||
session.server.Delete()
|
||||
end if
|
||||
else
|
||||
startOver = true
|
||||
print "No previous server connection saved to registry"
|
||||
|
|
|
@ -59,21 +59,23 @@ namespace session
|
|||
end sub
|
||||
|
||||
' Add or update the jellyfin server URL from the global server session array (m.global.session.server)
|
||||
sub UpdateURL(value as string)
|
||||
' Returns a boolean based on if a connection to the Jellyfin server was made
|
||||
function UpdateURL(value as string) as boolean
|
||||
' validate parameters
|
||||
if value = "" then return
|
||||
if value = "" then return false
|
||||
session.server.Update("url", value)
|
||||
session.server.Populate()
|
||||
end sub
|
||||
return session.server.Populate()
|
||||
end function
|
||||
|
||||
' Use the saved server url to populate the global server session array (m.global.session.server)
|
||||
sub Populate()
|
||||
' Returns a boolean based on if a connection to the Jellyfin server was made
|
||||
function Populate() as boolean
|
||||
' validate server url
|
||||
if m.global.session.server.url = invalid or m.global.session.server.url = "" then return
|
||||
if m.global.session.server.url = invalid or m.global.session.server.url = "" then return false
|
||||
' get server info using API
|
||||
myServerInfo = ServerInfo()
|
||||
' validate data returned from API
|
||||
if myServerInfo.id = invalid then return
|
||||
if myServerInfo.id = invalid then return false
|
||||
' make copy of global server session
|
||||
tmpSessionServer = m.global.session.server
|
||||
' update the temp array
|
||||
|
@ -93,7 +95,8 @@ namespace session
|
|||
tmpSessionServer.AddReplace("isLocalHTTPS", isLocalServerHTTPS)
|
||||
' update global server session using the temp array
|
||||
session.Update("server", tmpSessionServer)
|
||||
end sub
|
||||
return true
|
||||
end function
|
||||
end namespace
|
||||
|
||||
namespace user
|
||||
|
|
Loading…
Reference in New Issue
Block a user