homebridge-xbox-tv 3.3.4 → 3.3.5

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "displayName": "Xbox TV",
3
3
  "name": "homebridge-xbox-tv",
4
- "version": "3.3.4",
4
+ "version": "3.3.5",
5
5
  "description": "Homebridge plugin to control Xbox game consoles.",
6
6
  "license": "MIT",
7
7
  "author": "grzegorz914",
@@ -43,26 +43,29 @@ class XboxWebApi extends EventEmitter {
43
43
  try {
44
44
  const data = await this.authentication.checkAuthorization();
45
45
  const debug = this.enableDebugMode ? this.emit('debug', `Authorization headers: ${JSON.stringify(data.headers, null, 2)}, tokens: ${JSON.stringify(data.tokens, null, 2)}`) : false;
46
- const headers = {
47
- 'Authorization': data.headers,
48
- 'Accept-Language': 'en-US',
49
- 'x-xbl-contract-version': '4',
50
- 'x-xbl-client-name': 'XboxApp',
51
- 'x-xbl-client-type': 'UWA',
52
- 'x-xbl-client-version': '39.39.22001.0',
53
- 'skillplatform': 'RemoteManagement'
54
- }
55
- this.headers = headers;
56
- this.tokens = data.tokens;
57
- this.authorized = true;
58
46
 
59
- if (!this.authorized) {
47
+ const authorized = data.tokens?.xsts?.Token?.trim() || false;
48
+ if (!authorized) {
60
49
  this.emit('warn', `not authorized`);
61
50
  return false;
62
51
  };
52
+ this.tokens = data.tokens;
53
+ this.authorized = true;
63
54
 
64
55
  //check xbox live data
65
56
  try {
57
+ //headers
58
+ const headers = {
59
+ 'Authorization': data.headers,
60
+ 'Accept-Language': 'en-US',
61
+ 'x-xbl-contract-version': '4',
62
+ 'x-xbl-client-name': 'XboxApp',
63
+ 'x-xbl-client-type': 'UWA',
64
+ 'x-xbl-client-version': '39.39.22001.0',
65
+ 'skillplatform': 'RemoteManagement'
66
+ }
67
+ this.headers = headers;
68
+
66
69
  //create axios instance
67
70
  this.axiosInstance = axios.create({
68
71
  method: 'GET',