diff --git a/apiclient.js b/apiclient.js index 58b13ae..7a11610 100644 --- a/apiclient.js +++ b/apiclient.js @@ -108,6 +108,15 @@ function getFetchPromise(request) { return fetchWithTimeout(request.url, fetchRequest, request.timeout); } +function clearCurrentUserCacheIfNeeded(apiClient) { + + var user = apiClient._currentUser; + var serverInfo = apiClient._serverInfo; + if (user && serverInfo && user.Id !== serverInfo.UserId) { + apiClient._currentUser = null; + } +} + /** * Creates a new api client instance * @param {String} serverAddress @@ -385,6 +394,7 @@ class ApiClient { this._serverInfo.AccessToken = accessKey; this._serverInfo.UserId = userId; + clearCurrentUserCacheIfNeeded(this); redetectBitrate(this); refreshWakeOnLanInfoIfNeeded(this); } @@ -393,6 +403,7 @@ class ApiClient { if (info) { this._serverInfo = info; + clearCurrentUserCacheIfNeeded(this); } return this._serverInfo; diff --git a/connectionmanager.js b/connectionmanager.js index 871bb57..538ffb3 100644 --- a/connectionmanager.js +++ b/connectionmanager.js @@ -248,7 +248,7 @@ export default class ConnectionManager { let connectUser; self.connectUser = () => connectUser; - self._minServerVersion = '3.2.33'; + self._minServerVersion = '3.3.0'; self.appVersion = () => appVersion;