Code cleanup based on review
This commit is contained in:
parent
f3c04377c1
commit
16ccfe2930
|
@ -119,7 +119,6 @@ function LoginFlow()
|
||||||
else
|
else
|
||||||
print "Success! Auth token is still valid"
|
print "Success! Auth token is still valid"
|
||||||
session.user.Login(currentUser, true)
|
session.user.Login(currentUser, true)
|
||||||
session.user.LoadUserPreferences()
|
|
||||||
LoadUserAbilities()
|
LoadUserAbilities()
|
||||||
return true
|
return true
|
||||||
end if
|
end if
|
||||||
|
@ -132,7 +131,6 @@ function LoginFlow()
|
||||||
if isValid(userData)
|
if isValid(userData)
|
||||||
print "login success!"
|
print "login success!"
|
||||||
session.user.Login(userData, true)
|
session.user.Login(userData, true)
|
||||||
session.user.LoadUserPreferences()
|
|
||||||
LoadUserAbilities()
|
LoadUserAbilities()
|
||||||
return true
|
return true
|
||||||
else
|
else
|
||||||
|
@ -175,7 +173,6 @@ function LoginFlow()
|
||||||
if isValid(userData)
|
if isValid(userData)
|
||||||
print "login success!"
|
print "login success!"
|
||||||
session.user.Login(userData, true)
|
session.user.Login(userData, true)
|
||||||
session.user.LoadUserPreferences()
|
|
||||||
LoadUserAbilities()
|
LoadUserAbilities()
|
||||||
return true
|
return true
|
||||||
else
|
else
|
||||||
|
@ -201,7 +198,6 @@ function LoginFlow()
|
||||||
goto start_login
|
goto start_login
|
||||||
end if
|
end if
|
||||||
|
|
||||||
session.user.LoadUserPreferences()
|
|
||||||
LoadUserAbilities()
|
LoadUserAbilities()
|
||||||
m.global.sceneManager.callFunc("clearScenes")
|
m.global.sceneManager.callFunc("clearScenes")
|
||||||
|
|
||||||
|
|
|
@ -1374,7 +1374,7 @@ namespace api
|
||||||
end function
|
end function
|
||||||
|
|
||||||
' Gets a list of sessions.
|
' Gets a list of sessions.
|
||||||
function Get(params = {} as object)
|
function Get(params = { "deviceId": m.global.device.serverDeviceName } as object)
|
||||||
req = APIRequest("/sessions", params)
|
req = APIRequest("/sessions", params)
|
||||||
return getJson(req)
|
return getJson(req)
|
||||||
end function
|
end function
|
||||||
|
|
|
@ -107,7 +107,7 @@ sub SaveDeviceToGlobal()
|
||||||
uuid: deviceInfo.GetRandomUUID(),
|
uuid: deviceInfo.GetRandomUUID(),
|
||||||
name: displayName,
|
name: displayName,
|
||||||
friendlyName: filteredFriendly,
|
friendlyName: filteredFriendly,
|
||||||
serverDeviceName: "",
|
serverDeviceName: deviceInfo.getChannelClientID(),
|
||||||
model: deviceInfo.GetModel(),
|
model: deviceInfo.GetModel(),
|
||||||
modelType: deviceInfo.GetModelType(),
|
modelType: deviceInfo.GetModelType(),
|
||||||
modelDetails: deviceInfo.GetModelDetails(),
|
modelDetails: deviceInfo.GetModelDetails(),
|
||||||
|
|
|
@ -173,16 +173,23 @@ namespace session
|
||||||
set_user_setting("token", tmpSession.user.authToken)
|
set_user_setting("token", tmpSession.user.authToken)
|
||||||
set_user_setting("username", tmpSession.user.name)
|
set_user_setting("username", tmpSession.user.name)
|
||||||
end if
|
end if
|
||||||
|
|
||||||
|
session.user.LoadUserPreferences()
|
||||||
end sub
|
end sub
|
||||||
|
|
||||||
' Load and parse Display Settings from server
|
' Sets the global service device name value used by the API
|
||||||
sub LoadUserPreferences()
|
sub SetServerDeviceName()
|
||||||
' Save device id so we don't calculate it every time we need it
|
|
||||||
if isValid(m.global.session.user) and isValid(m.global.session.user.friendlyName)
|
if isValid(m.global.session.user) and isValid(m.global.session.user.friendlyName)
|
||||||
m.global.device.serverDeviceName = m.global.device.id + m.global.session.user.friendlyName
|
m.global.device.serverDeviceName = m.global.device.id + m.global.session.user.friendlyName
|
||||||
else
|
else
|
||||||
m.global.device.serverDeviceName = m.global.device.id
|
m.global.device.serverDeviceName = m.global.device.id
|
||||||
end if
|
end if
|
||||||
|
end sub
|
||||||
|
|
||||||
|
' Load and parse Display Settings from server
|
||||||
|
sub LoadUserPreferences()
|
||||||
|
' Save device id so we don't calculate it every time we need it
|
||||||
|
session.user.SetServerDeviceName()
|
||||||
|
|
||||||
id = m.global.session.user.id
|
id = m.global.session.user.id
|
||||||
' Currently using client "emby", which is what website uses so we get same Display prefs as web.
|
' Currently using client "emby", which is what website uses so we get same Display prefs as web.
|
||||||
|
@ -344,6 +351,9 @@ namespace session
|
||||||
session.user.settings.Save(item, get_setting(item))
|
session.user.settings.Save(item, get_setting(item))
|
||||||
end if
|
end if
|
||||||
end for
|
end for
|
||||||
|
|
||||||
|
' Reset server device name state
|
||||||
|
session.user.SetServerDeviceName()
|
||||||
end sub
|
end sub
|
||||||
|
|
||||||
' Saves the user setting to the global session.
|
' Saves the user setting to the global session.
|
||||||
|
|
Loading…
Reference in New Issue
Block a user