homebridge-xbox-tv 2.8.2-beta.13 → 2.8.2-beta.15
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.
|
@@ -51,14 +51,13 @@
|
|
|
51
51
|
|
|
52
52
|
//get devices count
|
|
53
53
|
const devicesCount = pluginConfig[0].devices.length;
|
|
54
|
-
this.deviceIndex = 0;
|
|
55
54
|
|
|
56
55
|
//get the intial from the config and add it to the form
|
|
57
56
|
for (let i = 0; i < devicesCount; i++) {
|
|
58
57
|
//create consoles buttons
|
|
59
58
|
const button = document.createElement("button");
|
|
60
59
|
button.setAttribute("type", "button");
|
|
61
|
-
button.setAttribute("id",
|
|
60
|
+
button.setAttribute("id", `button${i}`);
|
|
62
61
|
button.setAttribute("class", "btn btn-secondary");
|
|
63
62
|
button.innerText = pluginConfig[0].devices[i].name || 'Not set';
|
|
64
63
|
button.style.width = '160px';
|
|
@@ -66,7 +65,7 @@
|
|
|
66
65
|
document.body.appendChild(button);
|
|
67
66
|
|
|
68
67
|
//get actuall value on console select
|
|
69
|
-
document.getElementById(
|
|
68
|
+
document.getElementById(`button${i}`).addEventListener('click', async () => {
|
|
70
69
|
document.querySelector('#deviceNameInput').innerHTML = pluginConfig[0].devices[i].name || '';
|
|
71
70
|
document.querySelector('#deviceHostInput').value = pluginConfig[0].devices[i].host || '';
|
|
72
71
|
document.querySelector('#deviceLiveId').value = pluginConfig[0].devices[i].xboxLiveId || '';
|
|
@@ -74,8 +73,16 @@
|
|
|
74
73
|
document.querySelector('#deviceWebApiControl').checked = pluginConfig[0].devices[i].webApiControl || false;
|
|
75
74
|
this.deviceIndex = i;
|
|
76
75
|
});
|
|
76
|
+
this.deviceIndex = 0;
|
|
77
77
|
};
|
|
78
78
|
|
|
79
|
+
//load values on first run
|
|
80
|
+
document.querySelector('#deviceNameInput').innerHTML = pluginConfig[0].devices[0].name || '';
|
|
81
|
+
document.querySelector('#deviceHostInput').value = pluginConfig[0].devices[0].host || '';
|
|
82
|
+
document.querySelector('#deviceLiveId').value = pluginConfig[0].devices[0].xboxLiveId || '';
|
|
83
|
+
document.querySelector('#deviceTokenInput').value = pluginConfig[0].devices[0].xboxWebApiToken || '';
|
|
84
|
+
document.querySelector('#deviceWebApiControl').checked = pluginConfig[0].devices[0].webApiControl || false;
|
|
85
|
+
|
|
79
86
|
//check token length and set buttons name and checkbock state after open
|
|
80
87
|
const tokenLength = (document.querySelector('#deviceTokenInput').value).length || 0;
|
|
81
88
|
const setButtonMode = tokenLength <= 10 ? document.getElementById('startAuthorizationButton').innerText = "Start authorization" : document.getElementById('startAuthorizationButton').innerText = "Check state";
|
|
@@ -200,10 +207,6 @@
|
|
|
200
207
|
document.getElementById('deviceWebApiControl').checked = false;
|
|
201
208
|
document.getElementById('deviceWebApiControl').disabled = true;
|
|
202
209
|
} finally {
|
|
203
|
-
//set page to the erste console after open
|
|
204
|
-
window.onload = () => {
|
|
205
|
-
document.getElementById('button0').click();
|
|
206
|
-
}
|
|
207
210
|
homebridge.hideSpinner();
|
|
208
211
|
};
|
|
209
212
|
});
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"displayName": "Xbox TV",
|
|
3
3
|
"name": "homebridge-xbox-tv",
|
|
4
|
-
"version": "2.8.2-beta.
|
|
4
|
+
"version": "2.8.2-beta.15",
|
|
5
5
|
"description": "Homebridge plugin (https://github.com/homebridge/homebridge) to control Xbox game consoles.",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"author": "grzegorz914",
|