homebridge-xbox-tv 3.5.2 → 3.5.4

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.
@@ -169,6 +169,7 @@
169
169
  "contentType": {
170
170
  "title": "Content Type",
171
171
  "type": "string",
172
+ "default": "Game",
172
173
  "description": "Here select source input type.",
173
174
  "oneOf": [
174
175
  {
@@ -199,8 +200,7 @@
199
200
  "required": false
200
201
  }
201
202
  }
202
- },
203
- "required": false
203
+ }
204
204
  },
205
205
  "buttons": {
206
206
  "type": "array",
@@ -259,6 +259,7 @@
259
259
  "mediaCommand": {
260
260
  "title": "Media Command",
261
261
  "type": "string",
262
+ "default": "play",
262
263
  "oneOf": [
263
264
  {
264
265
  "title": "Play",
@@ -357,6 +358,7 @@
357
358
  "gamePadCommand": {
358
359
  "title": "Game Pad Command",
359
360
  "type": "string",
361
+ "default": "nexus",
360
362
  "oneOf": [
361
363
  {
362
364
  "title": "Nexus",
@@ -431,6 +433,7 @@
431
433
  "tvRemoteCommand": {
432
434
  "title": "TV Remote Command",
433
435
  "type": "string",
436
+ "default": "volUp",
434
437
  "oneOf": [
435
438
  {
436
439
  "title": "Volume Up",
@@ -457,6 +460,7 @@
457
460
  "consoleControlCommand": {
458
461
  "title": "Console Control Command",
459
462
  "type": "string",
463
+ "default": "reboot",
460
464
  "oneOf": [
461
465
  {
462
466
  "title": "Reboot",
@@ -518,8 +522,7 @@
518
522
  "required": false
519
523
  }
520
524
  }
521
- },
522
- "required": false
525
+ }
523
526
  },
524
527
  "sensorPower": {
525
528
  "title": "Power",
@@ -603,8 +606,7 @@
603
606
  "required": false
604
607
  }
605
608
  }
606
- },
607
- "required": false
609
+ }
608
610
  },
609
611
  "webApiPowerOnOff": {
610
612
  "title": "Power Control",
@@ -1,230 +1,242 @@
1
- <div class="container mt-4">
2
- <div class="text-center">
3
- <img src="homebridge-xbox-tv.png" alt="Image" height="120" />
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+
4
+ <head>
5
+ <meta charset="UTF-8">
6
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
7
+ <title>Xbox Homebridge Configuration</title>
8
+ <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap/5.3.0/css/bootstrap.min.css">
9
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/js/all.min.js"></script>
10
+ </head>
11
+
12
+ <body>
13
+
14
+ <div class="container mt-4">
15
+ <div class="text-center">
16
+ <img src="homebridge-xbox-tv.png" alt="Image" height="120" />
17
+ </div>
18
+
19
+ <div id="authorizationManager" class="card card-body mt-3">
20
+ <form id="configForm">
21
+ <div class="text-center">
22
+ <label id="deviceName" class="fw-bold" style="font-size: 23px;">Xbox</label><br>
23
+ <label id="info" class="d-block" style="font-size: 17px;"></label>
24
+ <label id="info1" class="d-block" style="font-size: 15px;"></label>
25
+ </div>
26
+
27
+ <div class="mb-3">
28
+ <label for="deviceHost" class="form-label">Host</label>
29
+ <input id="deviceHost" type="text" class="form-control" required>
30
+ </div>
31
+
32
+ <div class="mb-3">
33
+ <label for="deviceLiveId" class="form-label">Xbox Live ID</label>
34
+ <input id="deviceLiveId" type="password" class="form-control" autocomplete="off" required>
35
+ </div>
36
+
37
+ <div class="mb-3">
38
+ <label for="deviceToken" class="form-label">Web API Token</label>
39
+ <input id="deviceToken" type="password" class="form-control" autocomplete="off" required>
40
+ </div>
41
+
42
+ <div class="form-check mb-3">
43
+ <input id="deviceWebApiControl" type="checkbox" class="form-check-input">
44
+ <label for="deviceWebApiControl" class="form-check-label">Web API Control</label>
45
+ </div>
46
+
47
+ <div class="text-center">
48
+ <button id="startAuthorizationButton" type="button" class="btn btn-primary">Start Authorization</button>
49
+ <button id="clearTokenButton" type="button" class="btn btn-secondary">Clear Web API Token</button>
50
+ <button id="configButton" type="button" class="btn btn-secondary"><i class="fas fa-gear"></i></button>
51
+ </div>
52
+ </form>
53
+ </div>
54
+
55
+ <div id="consoleButton"></div>
4
56
  </div>
5
57
 
6
- <div id="authorizationManager" class="card card-body mt-3">
7
- <form id="configForm">
8
- <div class="text-center">
9
- <label id="deviceName" class="fw-bold" style="font-size: 23px;">Xbox</label><br>
10
- <label id="info" class="d-block" style="font-size: 17px;"></label>
11
- <label id="info1" class="d-block" style="font-size: 15px;"></label>
12
- </div>
13
-
14
- <div class="mb-3">
15
- <label for="deviceHost" class="form-label">Host</label>
16
- <input id="deviceHost" type="text" class="form-control" required>
17
- </div>
18
-
19
- <div class="mb-3">
20
- <label for="deviceLiveId" class="form-label">Xbox Live ID</label>
21
- <input id="deviceLiveId" type="password" class="form-control" autocomplete="off" required>
22
- </div>
23
-
24
- <div class="mb-3">
25
- <label for="deviceToken" class="form-label">Web API Token</label>
26
- <input id="deviceToken" type="password" class="form-control" autocomplete="off" required>
27
- </div>
28
-
29
- <div class="form-check mb-3">
30
- <input id="deviceWebApiControl" type="checkbox" class="form-check-input">
31
- <label for="deviceWebApiControl" class="form-check-label">Web API Control</label>
32
- </div>
33
-
34
- <div class="text-center">
35
- <button id="startAuthorizationButton" type="button" class="btn btn-primary">Start Authorization</button>
36
- <button id="clearTokenButton" type="button" class="btn btn-secondary">Clear Web API Token</button>
37
- <button id="configButton" type="button" class="btn btn-secondary"><i class="fas fa-gear"></i></button>
38
- </div>
39
- </form>
40
- </div>
41
-
42
- <div id="consoleButton"></div>
43
- </div>
44
-
45
- <script>
46
- (async () => {
47
- //get the plugin config array
48
- const pluginConfig = await homebridge.getPluginConfig();
49
-
50
- if (!pluginConfig.length) {
51
- pluginConfig.push({});
52
- await homebridge.updatePluginConfig(pluginConfig);
53
- homebridge.showSchemaForm();
54
- return;
55
- }
56
- this.configButtonState = false;
57
-
58
- //get devices count
59
- const devicesCount = pluginConfig[0].devices.length;
60
- this.deviceIndex = 0;
61
- for (let i = 0; i < devicesCount; i++) {
62
- //create buttons
63
- const button = document.createElement("button");
64
- button.setAttribute("type", "button");
65
- button.setAttribute("id", `button${i}`);
66
- button.setAttribute("class", "btn btn-primary");
67
- button.style.textTransform = 'none';
68
- button.innerText = pluginConfig[0].devices[i].name;
69
- document.getElementById("consoleButton").appendChild(button);
70
-
71
- //get actuall value on console select
72
- document.getElementById(`button${i}`).addEventListener('click', async () => {
73
- for (let j = 0; j < devicesCount; j++) {
74
- const setRemoveAtribute = j === i ? document.getElementById(`button${j}`).setAttribute("class", "btn btn-primary") : document.getElementById(`button${j}`).setAttribute("class", "btn btn-secondary");
75
- }
58
+ <script>
59
+ (async () => {
60
+ //get the plugin config array
61
+ const pluginConfig = await homebridge.getPluginConfig();
76
62
 
77
- document.getElementById('deviceName').innerHTML = pluginConfig[0].devices[i].name || '';
78
- document.getElementById('deviceHost').value = pluginConfig[0].devices[i].host || '';
79
- document.getElementById('deviceLiveId').value = pluginConfig[0].devices[i].xboxLiveId || '';
80
- document.getElementById('deviceToken').value = pluginConfig[0].devices[i].webApiToken || '';
81
- document.getElementById('deviceWebApiControl').checked = pluginConfig[0].devices[i].webApiControl || false;
63
+ if (!pluginConfig.length) {
64
+ pluginConfig.push({});
65
+ await homebridge.updatePluginConfig(pluginConfig);
66
+ homebridge.showSchemaForm();
67
+ return;
68
+ }
69
+ this.configButtonState = false;
70
+
71
+ //get devices count
72
+ const devicesCount = pluginConfig[0].devices.length;
73
+ this.deviceIndex = 0;
74
+ for (let i = 0; i < devicesCount; i++) {
75
+ //create buttons
76
+ const button = document.createElement("button");
77
+ button.setAttribute("type", "button");
78
+ button.setAttribute("id", `button${i}`);
79
+ button.setAttribute("class", "btn btn-primary");
80
+ button.style.textTransform = 'none';
81
+ button.innerText = pluginConfig[0].devices[i].name;
82
+ document.getElementById("consoleButton").appendChild(button);
83
+
84
+ //get actuall value on console select
85
+ document.getElementById(`button${i}`).addEventListener('click', async () => {
86
+ for (let j = 0; j < devicesCount; j++) {
87
+ const setRemoveAtribute = j === i ? document.getElementById(`button${j}`).setAttribute("class", "btn btn-primary") : document.getElementById(`button${j}`).setAttribute("class", "btn btn-secondary");
88
+ }
89
+
90
+ document.getElementById('deviceName').innerHTML = pluginConfig[0].devices[i].name || '';
91
+ document.getElementById('deviceHost').value = pluginConfig[0].devices[i].host || '';
92
+ document.getElementById('deviceLiveId').value = pluginConfig[0].devices[i].xboxLiveId || '';
93
+ document.getElementById('deviceToken').value = pluginConfig[0].devices[i].webApiToken || '';
94
+ document.getElementById('deviceWebApiControl').checked = pluginConfig[0].devices[i].webApiControl || false;
95
+
96
+ const tokenLength = (pluginConfig[0].devices[i].webApiToken).length || 0;
97
+ const setButtonName = tokenLength <= 10 ? document.getElementById('startAuthorizationButton').innerText = "Start authorization" : document.getElementById('startAuthorizationButton').innerText = "Check state";
98
+ const setCheckboxState = tokenLength <= 10 ? document.getElementById('deviceWebApiControl').checked = false : false;
99
+ const setCheckboxMode = tokenLength <= 10 ? document.getElementById('deviceWebApiControl').disabled = true : document.getElementById('deviceWebApiControl').disabled = false;
100
+ const setWebApiControlMode = tokenLength <= 10 ? pluginConfig[0].devices[i].webApiControl = false : false;
101
+
102
+ await homebridge.updatePluginConfig(pluginConfig)
103
+ this.deviceIndex = i;
104
+ });
105
+ const click = i === devicesCount - 1 ? document.getElementById(`button0`).click() : false;
106
+ const update = i === devicesCount - 1 ? await homebridge.updatePluginConfig(pluginConfig) : false;
107
+ };
82
108
 
83
- const tokenLength = (pluginConfig[0].devices[i].webApiToken).length || 0;
84
- const setButtonName = tokenLength <= 10 ? document.getElementById('startAuthorizationButton').innerText = "Start authorization" : document.getElementById('startAuthorizationButton').innerText = "Check state";
85
- const setCheckboxState = tokenLength <= 10 ? document.getElementById('deviceWebApiControl').checked = false : false;
86
- const setCheckboxMode = tokenLength <= 10 ? document.getElementById('deviceWebApiControl').disabled = true : document.getElementById('deviceWebApiControl').disabled = false;
87
- const setWebApiControlMode = tokenLength <= 10 ? pluginConfig[0].devices[i].webApiControl = false : false;
109
+ //load authorizationManager form
110
+ document.getElementById('authorizationManager').style.display = 'block';
88
111
 
89
- await homebridge.updatePluginConfig(pluginConfig)
90
- this.deviceIndex = i;
112
+ //watch for changes to the config button
113
+ document.getElementById('configButton').addEventListener('click', async () => {
114
+ const showHideSettings = this.configButtonState ? homebridge.hideSchemaForm() : homebridge.showSchemaForm();
115
+ const setRemoveAtribute = this.configButtonState ? document.getElementById(`configButton`).setAttribute("class", "btn btn-secondary") : document.getElementById(`configButton`).setAttribute("class", "btn btn-primary");
116
+ this.configButtonState = !this.configButtonState;
91
117
  });
92
- const click = i === devicesCount - 1 ? document.getElementById(`button0`).click() : false;
93
- const update = i === devicesCount - 1 ? await homebridge.updatePluginConfig(pluginConfig) : false;
94
- };
95
-
96
- //load authorizationManager form
97
- document.getElementById('authorizationManager').style.display = 'block';
98
- document.getElementById(`configButton`).setAttribute("class", "btn btn-secondary");
99
-
100
- //watch for changes to the config button
101
- document.getElementById('configButton').addEventListener('click', async () => {
102
- const showHideSettings = this.configButtonState ? homebridge.hideSchemaForm() : homebridge.showSchemaForm();
103
- const setRemoveAtribute = this.configButtonState ? document.getElementById(`configButton`).setAttribute("class", "btn btn-secondary") : document.getElementById(`configButton`).setAttribute("class", "btn btn-primary");
104
- this.configButtonState = !this.configButtonState;
105
- });
106
-
107
- //watch for changes to the form
108
- document.getElementById('configForm').addEventListener('input', async () => {
109
- pluginConfig[0].devices[this.deviceIndex].host = document.querySelector('#deviceHost').value;
110
- pluginConfig[0].devices[this.deviceIndex].xboxLiveId = document.querySelector('#deviceLiveId').value;
111
- pluginConfig[0].devices[this.deviceIndex].webApiToken = document.querySelector('#deviceToken').value;
112
- pluginConfig[0].devices[this.deviceIndex].webApiControl = document.querySelector('#deviceWebApiControl').checked;
113
-
114
- const tokenLength1 = (document.querySelector('#deviceToken').value).length || 0;
115
- const setButtonName = tokenLength1 <= 10 ? document.getElementById('startAuthorizationButton').innerText = "Start authorization" : false;
116
- const setButtonMode = tokenLength1 <= 10 ? document.getElementById('startAuthorizationButton').removeAttribute('disabled') : false;
117
-
118
- await homebridge.updatePluginConfig(pluginConfig);
119
- await homebridge.savePluginConfig(pluginConfig);
120
- });
121
-
122
- //clear token file
123
- document.getElementById('clearTokenButton').addEventListener('click', async () => {
124
- homebridge.showSpinner();
125
- document.getElementById('info').innerHTML = 'Start clearing token...';
126
- document.getElementById('info').style.color = 'yellow';
127
-
128
- try {
129
- const host = pluginConfig[0].devices[this.deviceIndex].host;
130
- await homebridge.request('/clearToken', { host: host });
131
-
132
- //update value
133
- pluginConfig[0].devices[this.deviceIndex].webApiToken = '';
134
- pluginConfig[0].devices[this.deviceIndex].webApiControl = false;
135
-
136
- document.getElementById('info').innerHTML = 'Web api token cleared, now You can start new authorization process.';
137
- document.getElementById('info').style.color = 'green';
138
- document.getElementById('deviceToken').value = '';
139
- document.getElementById('startAuthorizationButton').removeAttribute("disabled");
140
- document.getElementById('startAuthorizationButton').innerText = "Start authorization";
141
- document.getElementById('deviceWebApiControl').checked = false;
142
- document.getElementById('deviceWebApiControl').disabled = true;
118
+
119
+ //watch for changes to the form
120
+ document.getElementById('configForm').addEventListener('input', async () => {
121
+ pluginConfig[0].devices[this.deviceIndex].host = document.querySelector('#deviceHost').value;
122
+ pluginConfig[0].devices[this.deviceIndex].xboxLiveId = document.querySelector('#deviceLiveId').value;
123
+ pluginConfig[0].devices[this.deviceIndex].webApiToken = document.querySelector('#deviceToken').value;
124
+ pluginConfig[0].devices[this.deviceIndex].webApiControl = document.querySelector('#deviceWebApiControl').checked;
125
+
126
+ const tokenLength1 = (document.querySelector('#deviceToken').value).length || 0;
127
+ const setButtonName = tokenLength1 <= 10 ? document.getElementById('startAuthorizationButton').innerText = "Start authorization" : false;
128
+ const setButtonMode = tokenLength1 <= 10 ? document.getElementById('startAuthorizationButton').removeAttribute('disabled') : false;
143
129
 
144
130
  await homebridge.updatePluginConfig(pluginConfig);
145
131
  await homebridge.savePluginConfig(pluginConfig);
132
+ });
146
133
 
147
- homebridge.hideSpinner();
148
- } catch (error) {
149
- document.getElementById('info').innerHTML = 'Clear web api token error.';
134
+ //clear token file
135
+ document.getElementById('clearTokenButton').addEventListener('click', async () => {
136
+ homebridge.showSpinner();
137
+ document.getElementById('info').innerHTML = 'Start clearing token...';
150
138
  document.getElementById('info').style.color = 'yellow';
151
- document.getElementById('info1').innerHTML = `Error: ${error}`;
152
- document.getElementById('info1').style.color = 'red';
153
- }
154
- });
155
-
156
- //watch for click on the Start authorization button
157
- document.getElementById('startAuthorizationButton').addEventListener('click', async () => {
158
- homebridge.showSpinner();
159
- document.getElementById('info').innerHTML = 'Starting authorization...';
160
- document.getElementById('info').style.color = 'yellow';
161
-
162
- try {
163
- const host = pluginConfig[0].devices[this.deviceIndex].host;
164
- const webApiClientId = pluginConfig[0].devices[this.deviceIndex].webApiClientId;
165
- const webApiClientSecret = pluginConfig[0].devices[this.deviceIndex].webApiClientSecret;
166
- const webApiToken = pluginConfig[0].devices[this.deviceIndex].webApiToken;
167
-
168
- const payload = {
169
- host: host,
170
- webApiClientId: webApiClientId,
171
- webApiClientSecret: webApiClientSecret,
172
- webApiToken: webApiToken
173
- };
174
- const response = await homebridge.request('/startAuthorization', payload);
175
- const info = response.info;
176
- const status = response.status;
177
-
178
- switch (status) {
179
- case 0:
180
- document.getElementById('info').innerHTML = info;
181
- document.getElementById('info').style.color = 'green';
182
- document.getElementById('startAuthorizationButton').innerText = "Check state";
183
- document.getElementById('deviceWebApiControl').disabled = false;
184
- break;
185
- case 1:
186
- document.getElementById('startAuthorizationButton').innerText = "Activate console";
187
- document.getElementById('deviceWebApiControl').checked = false;
188
- document.getElementById('deviceWebApiControl').disabled = true;
189
- pluginConfig[0].devices[this.deviceIndex].webApiControl = false;
190
-
191
- let timeLeft = 15;
192
- let timerId = setInterval(() => {
193
- if (timeLeft <= 0) {
194
- open(info);
195
- clearInterval(timerId);
196
- document.getElementById('info').innerHTML = `Now paste the *code* to the *Web Api Token* and press *Activate Console*.`;
197
- document.getElementById('info').style.color = 'yellow';
198
- } else {
199
- document.getElementById('info').innerHTML = `After ${timeLeft} sec. on the opened page, sign in to your Xbox Live account and give permission for Xbox TV. Next from the response URI copy the part after *?code=* and return to Authorization Manager.`;
200
- timeLeft--;
201
- document.getElementById('info').style.color = 'yellow';
202
- }
203
- }, 1000);
204
- break;
205
- case 2:
206
- document.getElementById('info').innerHTML = info;
207
- document.getElementById('info').style.color = 'green';
208
- document.getElementById('startAuthorizationButton').innerText = "Check state";
209
- document.getElementById('deviceWebApiControl').disabled = false;
210
- document.getElementById('deviceWebApiControl').checked = true;
211
- pluginConfig[0].devices[this.deviceIndex].webApiControl = true;
212
-
213
- await homebridge.updatePluginConfig(pluginConfig)
214
- await homebridge.savePluginConfig(pluginConfig);
215
- break;
216
- };
217
139
 
218
- homebridge.hideSpinner();
219
- } catch (error) {
220
- document.getElementById('info').innerHTML = 'Check Your credentials data and try again.';
140
+ try {
141
+ const host = pluginConfig[0].devices[this.deviceIndex].host;
142
+ await homebridge.request('/clearToken', { host: host });
143
+
144
+ //update value
145
+ pluginConfig[0].devices[this.deviceIndex].webApiToken = '';
146
+ pluginConfig[0].devices[this.deviceIndex].webApiControl = false;
147
+
148
+ document.getElementById('info').innerHTML = 'Web api token cleared, now You can start new authorization process.';
149
+ document.getElementById('info').style.color = 'green';
150
+ document.getElementById('deviceToken').value = '';
151
+ document.getElementById('startAuthorizationButton').removeAttribute("disabled");
152
+ document.getElementById('startAuthorizationButton').innerText = "Start authorization";
153
+ document.getElementById('deviceWebApiControl').checked = false;
154
+ document.getElementById('deviceWebApiControl').disabled = true;
155
+
156
+ await homebridge.updatePluginConfig(pluginConfig);
157
+ await homebridge.savePluginConfig(pluginConfig);
158
+
159
+ homebridge.hideSpinner();
160
+ } catch (error) {
161
+ document.getElementById('info').innerHTML = 'Clear web api token error.';
162
+ document.getElementById('info').style.color = 'yellow';
163
+ document.getElementById('info1').innerHTML = `Error: ${error}`;
164
+ document.getElementById('info1').style.color = 'red';
165
+ }
166
+ });
167
+
168
+ //watch for click on the Start authorization button
169
+ document.getElementById('startAuthorizationButton').addEventListener('click', async () => {
170
+ homebridge.showSpinner();
171
+ document.getElementById('info').innerHTML = 'Starting authorization...';
221
172
  document.getElementById('info').style.color = 'yellow';
222
- document.getElementById('info1').innerHTML = `Error: ${error}`;
223
- document.getElementById('info1').style.color = 'red';
224
- } finally {
225
- homebridge.hideSpinner();
226
- };
227
- });
228
173
 
229
- })();
230
- </script>
174
+ try {
175
+ const host = pluginConfig[0].devices[this.deviceIndex].host;
176
+ const webApiClientId = pluginConfig[0].devices[this.deviceIndex].webApiClientId;
177
+ const webApiClientSecret = pluginConfig[0].devices[this.deviceIndex].webApiClientSecret;
178
+ const webApiToken = pluginConfig[0].devices[this.deviceIndex].webApiToken;
179
+
180
+ const payload = {
181
+ host: host,
182
+ webApiClientId: webApiClientId,
183
+ webApiClientSecret: webApiClientSecret,
184
+ webApiToken: webApiToken
185
+ };
186
+ const response = await homebridge.request('/startAuthorization', payload);
187
+ const info = response.info;
188
+ const status = response.status;
189
+
190
+ switch (status) {
191
+ case 0:
192
+ document.getElementById('info').innerHTML = info;
193
+ document.getElementById('info').style.color = 'green';
194
+ document.getElementById('startAuthorizationButton').innerText = "Check state";
195
+ document.getElementById('deviceWebApiControl').disabled = false;
196
+ break;
197
+ case 1:
198
+ document.getElementById('startAuthorizationButton').innerText = "Activate console";
199
+ document.getElementById('deviceWebApiControl').checked = false;
200
+ document.getElementById('deviceWebApiControl').disabled = true;
201
+ pluginConfig[0].devices[this.deviceIndex].webApiControl = false;
202
+
203
+ let timeLeft = 15;
204
+ let timerId = setInterval(() => {
205
+ if (timeLeft <= 0) {
206
+ open(info);
207
+ clearInterval(timerId);
208
+ document.getElementById('info').innerHTML = `Now paste the *code* to the *Web Api Token* and press *Activate Console*.`;
209
+ document.getElementById('info').style.color = 'yellow';
210
+ } else {
211
+ document.getElementById('info').innerHTML = `After ${timeLeft} sec. on the opened page, sign in to your Xbox Live account and give permission for Xbox TV. Next from the response URI copy the part after *?code=* and return to Authorization Manager.`;
212
+ timeLeft--;
213
+ document.getElementById('info').style.color = 'yellow';
214
+ }
215
+ }, 1000);
216
+ break;
217
+ case 2:
218
+ document.getElementById('info').innerHTML = info;
219
+ document.getElementById('info').style.color = 'green';
220
+ document.getElementById('startAuthorizationButton').innerText = "Check state";
221
+ document.getElementById('deviceWebApiControl').disabled = false;
222
+ document.getElementById('deviceWebApiControl').checked = true;
223
+ pluginConfig[0].devices[this.deviceIndex].webApiControl = true;
224
+
225
+ await homebridge.updatePluginConfig(pluginConfig)
226
+ await homebridge.savePluginConfig(pluginConfig);
227
+ break;
228
+ };
229
+
230
+ homebridge.hideSpinner();
231
+ } catch (error) {
232
+ document.getElementById('info').innerHTML = 'Check Your credentials data and try again.';
233
+ document.getElementById('info').style.color = 'yellow';
234
+ document.getElementById('info1').innerHTML = `Error: ${error}`;
235
+ document.getElementById('info1').style.color = 'red';
236
+ } finally {
237
+ homebridge.hideSpinner();
238
+ };
239
+ });
240
+
241
+ })();
242
+ </script>
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "displayName": "Xbox TV",
3
3
  "name": "homebridge-xbox-tv",
4
- "version": "3.5.2",
4
+ "version": "3.5.4",
5
5
  "description": "Homebridge plugin to control Xbox game consoles.",
6
6
  "license": "MIT",
7
7
  "author": "grzegorz914",
@@ -43,7 +43,7 @@
43
43
  "uuid": "^11.1.0",
44
44
  "ping": "^0.4.4",
45
45
  "express": "^4.21.2",
46
- "axios": "^1.8.3"
46
+ "axios": "^1.8.4"
47
47
  },
48
48
  "keywords": [
49
49
  "homebridge",