homebridge-xbox-tv 2.8.2-beta.21 → 2.8.2-beta.23

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.
@@ -42,7 +42,7 @@
42
42
  const devices = { 'devices': [] };
43
43
  pluginConfig.push(devices);
44
44
  await homebridge.updatePluginConfig(pluginConfig);
45
- await homebridge.showSchemaForm();
45
+ homebridge.showSchemaForm();
46
46
  return;
47
47
  }
48
48
 
@@ -72,6 +72,8 @@
72
72
  document.querySelector('#deviceTokenInput').value = pluginConfig[0].devices[i].xboxWebApiToken || '';
73
73
  document.querySelector('#deviceWebApiControl').checked = pluginConfig[0].devices[i].webApiControl || false;
74
74
  this.deviceIndex = i;
75
+
76
+ await homebridge.updatePluginConfig(pluginConfig);
75
77
  });
76
78
  this.deviceIndex = 0;
77
79
  };
@@ -91,7 +93,7 @@
91
93
 
92
94
  //watch for changes to the config button
93
95
  document.getElementById('configButton').addEventListener('click', async () => {
94
- const showHideSettings = this.configButtonState ? await homebridge.hideSchemaForm() : await homebridge.showSchemaForm();
96
+ const showHideSettings = this.configButtonState ? homebridge.hideSchemaForm() : homebridge.showSchemaForm();
95
97
  this.configButtonState = !this.configButtonState;
96
98
  });
97
99
 
@@ -106,8 +108,8 @@
106
108
  const setButtonName = tokenLength1 <= 10 ? document.getElementById('startAuthorizationButton').innerText = "Start authorization" : false;
107
109
  const setButtonMode = tokenLength1 <= 10 ? document.getElementById('startAuthorizationButton').removeAttribute('disabled') : false;
108
110
 
109
- await homebridge.savePluginConfig(pluginConfig);
110
111
  await homebridge.updatePluginConfig(pluginConfig);
112
+ await homebridge.savePluginConfig(pluginConfig);
111
113
  });
112
114
 
113
115
  //clear token file
@@ -121,7 +123,6 @@
121
123
  const response = await homebridge.request('/clearToken', payload);
122
124
 
123
125
  if (response) {
124
- pluginConfig[0].devices[this.deviceIndex].xboxWebApiToken = '';
125
126
  document.querySelector('#deviceTokenInput').value = '';
126
127
  document.getElementById('startAuthorizationButton').removeAttribute("disabled");
127
128
  document.getElementById('startAuthorizationButton').innerText = "Start authorization";
@@ -130,9 +131,10 @@
130
131
  document.getElementById('info').innerHTML = 'Web Api Token cleared, now You can start new authorization process.';
131
132
  document.getElementById('info').style.color = 'green';
132
133
  homebridge.toast.info('Web Api Token cleared!', 'Info!');
134
+ pluginConfig[0].devices[this.deviceIndex].xboxWebApiToken = '';
133
135
 
134
- await homebridge.savePluginConfig(pluginConfig);
135
136
  await homebridge.updatePluginConfig(pluginConfig);
137
+ await homebridge.savePluginConfig(pluginConfig);
136
138
  };
137
139
 
138
140
  homebridge.hideSpinner();
@@ -147,7 +149,6 @@
147
149
  document.getElementById('startAuthorizationButton').addEventListener('click', async () => {
148
150
  try {
149
151
  homebridge.showSpinner();
150
- await homebridge.updatePluginConfig(pluginConfig);
151
152
 
152
153
  const host = pluginConfig[0].devices[this.deviceIndex].host || '';
153
154
  this.clientId = pluginConfig[0].devices[this.deviceIndex].clientId || '5e5ead27-ed60-482d-b3fc-702b28a97404';
@@ -183,7 +184,7 @@
183
184
  document.getElementById('deviceWebApiControl').disabled = true;
184
185
 
185
186
  // open the oauth2 URI for authentication
186
- const authWindow = await window.open(info, "_blank");
187
+ const authWindow = await open(info, "_blank");
187
188
  document.getElementById('info').innerHTML = JSON.stringify(authWindow);
188
189
  // get the authorization code from the URL
189
190
  authWindow.addEventListener('load', async () => {
@@ -201,8 +202,8 @@
201
202
  document.getElementById('startAuthorizationButton').innerText = "Check state";
202
203
  document.getElementById('deviceWebApiControl').disabled = false;
203
204
 
204
- await homebridge.savePluginConfig(pluginConfig);
205
205
  await homebridge.updatePluginConfig(pluginConfig)
206
+ await homebridge.savePluginConfig(pluginConfig);
206
207
  break;
207
208
  case 3:
208
209
  document.getElementById('info').innerHTML = 'Authorization or Token save error!!!.';
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.21",
4
+ "version": "2.8.2-beta.23",
5
5
  "description": "Homebridge plugin (https://github.com/homebridge/homebridge) to control Xbox game consoles.",
6
6
  "license": "MIT",
7
7
  "author": "grzegorz914",