homebridge-xbox-tv 3.3.2 → 3.3.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -10,6 +10,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
10
10
  - After update to 2.x.x the plugin settings (xboxLiveId) need to be updated
11
11
  - After update to v3.0.0 RESTFull and MQTT config settings need to be updated
12
12
 
13
+ ## [3.3.3] - (04.02.2025)
14
+
15
+ ## Changes
16
+
17
+ - fix [#221](https://github.com/grzegorz914/homebridge-xbox-tv/issues/221)
18
+
13
19
  ## [3.3.2] - (04.02.2025)
14
20
 
15
21
  ## Changes
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "displayName": "Xbox TV",
3
3
  "name": "homebridge-xbox-tv",
4
- "version": "3.3.2",
4
+ "version": "3.3.3",
5
5
  "description": "Homebridge plugin to control Xbox game consoles.",
6
6
  "license": "MIT",
7
7
  "author": "grzegorz914",
@@ -441,12 +441,12 @@ class XboxLocalApi extends EventEmitter {
441
441
  connectRequest.set('publicKey', data.publicKey);
442
442
  connectRequest.set('iv', data.iv);
443
443
 
444
- const token = await this.readData(this.tokensFile);
445
- const parseTokenData = JSON.parse(token);
446
- const tokenData = parseTokenData.xsts.Token.length > 0 ? parseTokenData : false;
444
+ const response = await this.readData(this.tokensFile);
445
+ const parseTokenData = JSON.parse(response);
446
+ const tokenData = parseTokenData?.xsts?.Token?.trim() || null;
447
447
  if (tokenData) {
448
- connectRequest.set('userHash', tokenData.xsts.DisplayClaims.xui[0].uhs, true);
449
- connectRequest.set('jwt', tokenData.xsts.Token, true);
448
+ connectRequest.set('userHash', parseTokenData.xsts.DisplayClaims?.xui?.[0]?.uhs || '', true);
449
+ connectRequest.set('jwt', parseTokenData.xsts.Token, true);
450
450
  this.isAuthorized = true;
451
451
  }
452
452
  const debug = this.enableDebugMode ? this.emit('debug', `Client connecting using: ${this.isAuthorized ? 'XSTS token' : 'Anonymous'}.`) : false;