mirror of
https://github.com/jellyfin/jellyfin-kodi.git
synced 2024-11-12 21:26:10 +00:00
Fix double connection test
Remote old preference dialog. Update token revoked behavior.
This commit is contained in:
parent
bfa3b0f2da
commit
b161ec6f4e
4 changed files with 20 additions and 143 deletions
|
@ -153,15 +153,18 @@ class ConnectManager(object):
|
||||||
dialog.doModal()
|
dialog.doModal()
|
||||||
|
|
||||||
if dialog.is_user_selected():
|
if dialog.is_user_selected():
|
||||||
|
|
||||||
user = dialog.get_user()
|
user = dialog.get_user()
|
||||||
|
username = user['Name']
|
||||||
|
|
||||||
if user['HasPassword']:
|
if user['HasPassword']:
|
||||||
log.debug("User has password, present manual login")
|
log.debug("User has password, present manual login")
|
||||||
try:
|
try:
|
||||||
return self.login_manual(server_address, user)
|
return self.login_manual(server_address, username)
|
||||||
except RuntimeError:
|
except RuntimeError:
|
||||||
return self.login(server)
|
return self.login(server)
|
||||||
else:
|
else:
|
||||||
user = self.emby.loginUser(server_address, user['Name'])
|
user = self.emby.loginUser(server_address, username)
|
||||||
self._connect.onAuthenticated(user)
|
self._connect.onAuthenticated(user)
|
||||||
return user
|
return user
|
||||||
|
|
||||||
|
@ -188,5 +191,13 @@ class ConnectManager(object):
|
||||||
raise RuntimeError("User is not authenticated")
|
raise RuntimeError("User is not authenticated")
|
||||||
|
|
||||||
def update_token(self, servers, server):
|
def update_token(self, servers, server):
|
||||||
self._connect.credentialProvider.addOrUpdateServer(servers, server)
|
|
||||||
self.update_state()
|
credentials = self._connect.credentialProvider.getCredentials()
|
||||||
|
updated_server = self._connect.credentialProvider.addOrUpdateServer(servers, server)
|
||||||
|
|
||||||
|
for server in self.get_state()['Servers']:
|
||||||
|
if server['Id'] == updated_server['Id']:
|
||||||
|
# Update token saved in current state
|
||||||
|
server.update(updated_server)
|
||||||
|
# Update the token in data.txt
|
||||||
|
self._connect.credentialProvider.getCredentials(credentials)
|
||||||
|
|
|
@ -35,6 +35,7 @@ class LoginManual(xbmcgui.WindowXMLDialog):
|
||||||
|
|
||||||
_user = None
|
_user = None
|
||||||
error = None
|
error = None
|
||||||
|
username = None
|
||||||
|
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
|
@ -49,7 +50,7 @@ class LoginManual(xbmcgui.WindowXMLDialog):
|
||||||
self.server = server
|
self.server = server
|
||||||
|
|
||||||
def set_user(self, user):
|
def set_user(self, user):
|
||||||
self.user = user or {}
|
self.username = user or {}
|
||||||
|
|
||||||
def get_user(self):
|
def get_user(self):
|
||||||
return self._user
|
return self._user
|
||||||
|
@ -63,8 +64,8 @@ class LoginManual(xbmcgui.WindowXMLDialog):
|
||||||
self.user_field = self._add_editcontrol(725, 400, 40, 500)
|
self.user_field = self._add_editcontrol(725, 400, 40, 500)
|
||||||
self.password_field = self._add_editcontrol(725, 475, 40, 500, password=1)
|
self.password_field = self._add_editcontrol(725, 475, 40, 500, password=1)
|
||||||
|
|
||||||
if "Name" in self.user:
|
if self.username:
|
||||||
self.user_field.setText(self.user['Name'])
|
self.user_field.setText(self.username)
|
||||||
self.setFocus(self.password_field)
|
self.setFocus(self.password_field)
|
||||||
else:
|
else:
|
||||||
self.setFocus(self.user_field)
|
self.setFocus(self.user_field)
|
||||||
|
|
|
@ -173,15 +173,9 @@ class UserClient(threading.Thread):
|
||||||
##### AUTHENTICATE USER #####
|
##### AUTHENTICATE USER #####
|
||||||
server = self.get_server()
|
server = self.get_server()
|
||||||
username = self.get_username().decode('utf-8')
|
username = self.get_username().decode('utf-8')
|
||||||
users = self.emby.getUsers(server)
|
|
||||||
user_found = None
|
|
||||||
|
|
||||||
for user in users:
|
|
||||||
if username == user['Name']:
|
|
||||||
user_found = user
|
|
||||||
break
|
|
||||||
try:
|
try:
|
||||||
user = self.connectmanager.login_manual(server, user_found)
|
user = self.connectmanager.login_manual(server, username)
|
||||||
except RuntimeError:
|
except RuntimeError:
|
||||||
window('emby_serverStatus', value="stop")
|
window('emby_serverStatus', value="stop")
|
||||||
self._auth = False
|
self._auth = False
|
||||||
|
|
|
@ -1,129 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<window>
|
|
||||||
<defaultcontrol always="true">8011</defaultcontrol>
|
|
||||||
<zorder>0</zorder>
|
|
||||||
<controls>
|
|
||||||
<control type="group">
|
|
||||||
<right>560</right>
|
|
||||||
<top>140</top>
|
|
||||||
<width>800</width>
|
|
||||||
<height>800</height>
|
|
||||||
<control type="group">
|
|
||||||
<control type="image">
|
|
||||||
<texture border="5" colordiffuse="ff111111">box.png</texture>
|
|
||||||
<height>100</height>
|
|
||||||
</control>
|
|
||||||
<control type="image">
|
|
||||||
<texture border="5" colordiffuse="ff222222">box.png</texture>
|
|
||||||
<top>100</top>
|
|
||||||
<height>700</height>
|
|
||||||
</control>
|
|
||||||
<control type="image" id="8002">
|
|
||||||
<description>user image</description>
|
|
||||||
<width>80</width>
|
|
||||||
<height>100</height>
|
|
||||||
</control>
|
|
||||||
<control type="label" id="8001" description="name">
|
|
||||||
<left>90</left>
|
|
||||||
<top>30</top>
|
|
||||||
<height>40</height>
|
|
||||||
<width>20%</width>
|
|
||||||
<align>left</align>
|
|
||||||
<font>font16</font>
|
|
||||||
<textcolor>ffeeeeee</textcolor>
|
|
||||||
</control>
|
|
||||||
<!-- -->
|
|
||||||
<control type="label" description="Title">
|
|
||||||
<left>320</left>
|
|
||||||
<top>30</top>
|
|
||||||
<align>left</align>
|
|
||||||
<height>40</height>
|
|
||||||
<width>100%</width>
|
|
||||||
<font>font16</font>
|
|
||||||
<textcolor>ffeeeeee</textcolor>
|
|
||||||
<label>User Preferences</label>
|
|
||||||
</control>
|
|
||||||
<control type="image">
|
|
||||||
<description>separator</description>
|
|
||||||
<left>-10</left>
|
|
||||||
<top>103</top>
|
|
||||||
<width>101%</width>
|
|
||||||
<height>1</height>
|
|
||||||
<texture colordiffuse="ffffffff" border="90,3,90,3">separator.png</texture>
|
|
||||||
</control>
|
|
||||||
<control type="grouplist">
|
|
||||||
<top>50</top>
|
|
||||||
<height>600</height>
|
|
||||||
<orientation>vertical</orientation>
|
|
||||||
<align>left</align>
|
|
||||||
<itemgap>20</itemgap>
|
|
||||||
<control type="group">
|
|
||||||
<control type="radiobutton" id="8011">
|
|
||||||
<left>8</left>
|
|
||||||
<ondown>8012</ondown>
|
|
||||||
<onup>8012</onup>
|
|
||||||
<top>100</top>
|
|
||||||
<width>785</width>
|
|
||||||
<align>left</align>
|
|
||||||
<height>70</height>
|
|
||||||
<textureradiofocus colordiffuse="B3dddddd">radio-on.png</textureradiofocus>
|
|
||||||
<textureradionofocus colordiffuse="1Fdddddd">radio-off.png</textureradionofocus>
|
|
||||||
<texturefocus border="5" colordiffuse="ff0385b5">white.png</texturefocus>
|
|
||||||
<radioposx>750</radioposx>
|
|
||||||
<radiowidth>32</radiowidth>
|
|
||||||
<radioheight>32</radioheight>
|
|
||||||
<textoffsetx>30</textoffsetx>
|
|
||||||
<textcolor>B3dddddd</textcolor>
|
|
||||||
<label>Enable cinema mode</label>
|
|
||||||
</control>
|
|
||||||
</control>
|
|
||||||
</control>
|
|
||||||
<!-- buttons -->
|
|
||||||
<control type="image">
|
|
||||||
<description>separator</description>
|
|
||||||
<bottom>70</bottom>
|
|
||||||
<left>-10</left>
|
|
||||||
<width>101%</width>
|
|
||||||
<height>1</height>
|
|
||||||
<texture border="90,3,90,3">separator.png</texture>
|
|
||||||
</control>
|
|
||||||
<control type="button" id="8012">
|
|
||||||
<description>Save</description>
|
|
||||||
<left>150</left>
|
|
||||||
<bottom>20</bottom>
|
|
||||||
<width>230</width>
|
|
||||||
<onup>8011</onup>
|
|
||||||
<onleft>8013</onleft>
|
|
||||||
<onright>8013</onright>
|
|
||||||
<font>font14</font>
|
|
||||||
<label>Save</label>
|
|
||||||
<focusedcolor>FFededed</focusedcolor>
|
|
||||||
<disabledcolor>B3dddddd</disabledcolor>
|
|
||||||
<selectedcolor>FF000000</selectedcolor>
|
|
||||||
<height>40</height>
|
|
||||||
<textcolor>ff333333</textcolor>
|
|
||||||
<texturefocus colordiffuse="ff0385b5" border="5">box.png</texturefocus>
|
|
||||||
<texturenofocus colordiffuse="B3dddddd" border="5">box.png</texturenofocus>
|
|
||||||
</control>
|
|
||||||
<control type="button" id="8013">
|
|
||||||
<description>Cancel</description>
|
|
||||||
<left>430</left>
|
|
||||||
<bottom>20</bottom>
|
|
||||||
<width>230</width>
|
|
||||||
<onup>8011</onup>
|
|
||||||
<onleft>8012</onleft>
|
|
||||||
<onright>8012</onright>
|
|
||||||
<font>font14</font>
|
|
||||||
<label>222</label>
|
|
||||||
<focusedcolor>FFededed</focusedcolor>
|
|
||||||
<disabledcolor>B3dddddd</disabledcolor>
|
|
||||||
<selectedcolor>FF000000</selectedcolor>
|
|
||||||
<height>40</height>
|
|
||||||
<textcolor>ff333333</textcolor>
|
|
||||||
<texturefocus colordiffuse="ff0385b5" border="5">box.png</texturefocus>
|
|
||||||
<texturenofocus colordiffuse="B3dddddd" border="5">box.png</texturenofocus>
|
|
||||||
</control>
|
|
||||||
</control>
|
|
||||||
</control>
|
|
||||||
</controls>
|
|
||||||
</window>
|
|
Loading…
Reference in a new issue