homebridge-xbox-tv 2.8.13 → 2.8.14-beta.0

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": "2.8.13",
4
+ "version": "2.8.14-beta.0",
5
5
  "description": "Homebridge plugin (https://github.com/homebridge/homebridge) to control Xbox game consoles.",
6
6
  "license": "MIT",
7
7
  "author": "grzegorz914",
@@ -237,8 +237,8 @@ class AUTHENTICATION {
237
237
  checkAuthorization() {
238
238
  return new Promise(async (resolve, reject) => {
239
239
  try {
240
- if (fs.existsSync(this.tokensFile) && fs.readFileSync(this.tokensFile).length > 30) {
241
- const tokens = fs.readFileSync(this.tokensFile).toString();
240
+ if (await fsPromises.access(this.tokensFile, fs.constants.F_OK) && (await fsPromises.stat(this.tokensFile)).size > 30) {
241
+ const tokens = await fsPromises.readFile(this.tokensFile).toString();
242
242
  this.tokens = JSON.parse(tokens);
243
243
  }
244
244
 
@@ -288,11 +288,11 @@ class AUTHENTICATION {
288
288
  })
289
289
  }
290
290
 
291
- clearToken(tokensFile) {
291
+ clearToken() {
292
292
  return new Promise(async (resolve, reject) => {
293
293
  try {
294
294
  const object = JSON.stringify({});
295
- await fsPromises.writeFile(tokensFile, object);
295
+ await fsPromises.writeFile(this.tokensFile, object);
296
296
  resolve();
297
297
  } catch (error) {
298
298
  reject(error);