Skip to content

Commit 5cc1898

Browse files
committed
Fix roaming warning
1 parent 0a95599 commit 5cc1898

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

resources/lib/kodiutils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1112,7 +1112,7 @@ def open_url(url, data=None, headers=None, method=None, cookiejar=None, follow_r
11121112
ok_dialog(heading='HTTP Error {code}'.format(code=exc.code), message='{}\n{}'.format(url, exc.reason))
11131113
log_error('HTTP Error {code}: {reason}', code=exc.code, reason=exc.reason)
11141114
return None
1115-
if exc.code in (400, 403) and exc.headers.get('Content-Type') == 'application/json':
1115+
if exc.code in (400, 403) and exc.headers.get('Content-Type') and 'application/json' in exc.headers.get('Content-Type'):
11161116
return exc
11171117
reason = exc.reason
11181118
code = exc.code

resources/lib/tokenresolver.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -137,11 +137,11 @@ def _get_new_token(self, name, variant=None, url=None, roaming=False, login_json
137137
return self._get_playertoken(variant, url, roaming)
138138

139139
if name in ('vrtlogin-at', 'vrtlogin-expiry', 'vrtlogin-rt', 'SESSION', 'OIDCXSRF', 'state'):
140-
return self._get_usertoken(name)
140+
return self._get_usertoken(name, roaming=roaming)
141141

142142
return None
143143

144-
def _get_usertoken(self, name=None, login_json=None):
144+
def _get_usertoken(self, name=None, login_json=None, roaming=False):
145145
"""Get a user X-VRT-Token, vrtlogin-at, vrtlogin-expiry, vrtlogin-rt, SESSION, OIDCXSRF or state token"""
146146
if not login_json:
147147
login_json = self._get_login_json()
@@ -161,7 +161,8 @@ def _get_usertoken(self, name=None, login_json=None):
161161
destination = open_url(self._VRT_LOGIN_URL, data=data, cookiejar=cookiejar).geturl()
162162
usertoken = TokenResolver._create_token_dictionary(cookiejar, name)
163163
if not usertoken and not destination.startswith('https://www.vrt.be/vrtnu'):
164-
ok_dialog(heading=localize(30970), message=localize(30972))
164+
if roaming is False:
165+
ok_dialog(heading=localize(30970), message=localize(30972))
165166
return None
166167

167168
# Cache additional tokens for later use
@@ -203,7 +204,7 @@ def _get_xvrttoken(self, login_json=None):
203204

204205
def _get_roaming_xvrttoken(self):
205206
"""Get a X-VRT-Token for roaming"""
206-
vrtlogin_at = self.get_token('vrtlogin-at')
207+
vrtlogin_at = self.get_token('vrtlogin-at', roaming=True)
207208
if vrtlogin_at is None:
208209
return None
209210
cookie_value = 'vrtlogin-at=' + vrtlogin_at

0 commit comments

Comments
 (0)