homebridge-flume 3.0.2-beta.0 → 3.0.2

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/CHANGELOG.md CHANGED
@@ -2,6 +2,12 @@
2
2
 
3
3
  All notable changes to homebridge-flume will be documented in this file.
4
4
 
5
+ ## 3.0.2 (2023-03-24)
6
+
7
+ ### Fixed
8
+
9
+ - Debug logging
10
+
5
11
  ## 3.0.1 (2023-03-11)
6
12
 
7
13
  ### Fixed
@@ -57,9 +57,6 @@ export default class {
57
57
  }
58
58
  */
59
59
 
60
- // Log the response if in debug mode
61
- this.log.debug('[HTTP obtainToken()] %s.', JSON.stringify(res.data));
62
-
63
60
  // Check to see we got a proper response
64
61
  if (!res.data.data || !res.data.data[0]) {
65
62
  this.log.warn('[HTTP obtainToken()] %s.', JSON.stringify(res.data));
@@ -71,6 +68,12 @@ export default class {
71
68
  this.refreshToken = res.data.data[0].refresh_token;
72
69
  this.expiresIn = now + res.data.data[0].expires_in;
73
70
 
71
+ // Log the response if in debug mode
72
+ this.log.debug(
73
+ '[HTTP obtainToken()] %s.',
74
+ JSON.stringify(res.data).replaceAll(this.accessToken, '[redacted]').replaceAll(this.refreshToken, '[redacted]'),
75
+ );
76
+
74
77
  // Obtain the user ID
75
78
  this.userId = jwtDecode(this.accessToken).user_id;
76
79
 
@@ -123,8 +126,17 @@ export default class {
123
126
  throw new Error(platformLang.noDataReceived);
124
127
  }
125
128
 
129
+ // Make the token available in other functions
130
+ this.accessToken = res.data.data[0].access_token;
131
+ this.refreshToken = res.data.data[0].refresh_token;
132
+ this.expiresIn = now + res.data.data[0].expires_in;
133
+
126
134
  // Log the response if in debug mode
127
- this.log.debug('[HTTP renewToken()] %s.', JSON.stringify(res.data));
135
+ // Redact the access token and refresh token
136
+ this.log.debug(
137
+ '[HTTP renewToken()] %s.',
138
+ JSON.stringify(res.data).replaceAll(this.accessToken, '[redacted]').replaceAll(this.refreshToken, '[redacted]'),
139
+ );
128
140
 
129
141
  /*
130
142
  {
@@ -146,11 +158,6 @@ export default class {
146
158
  pagination: null
147
159
  }
148
160
  */
149
-
150
- // Make the token available in other functions
151
- this.accessToken = res.data.data[0].access_token;
152
- this.refreshToken = res.data.data[0].refresh_token;
153
- this.expiresIn = now + res.data.data[0].expires_in;
154
161
  return true;
155
162
  } catch (err) {
156
163
  if (err.code && platformConsts.httpRetryCodes.includes(err.code)) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "homebridge-flume",
3
3
  "alias": "Flume",
4
- "version": "3.0.2-beta.0",
4
+ "version": "3.0.2",
5
5
  "author": {
6
6
  "name": "Ben Potter",
7
7
  "email": "bwp91@icloud.com"