homebridge-melcloud-control 4.0.0-beta.330 → 4.0.0-beta.331

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": "MELCloud Control",
3
3
  "name": "homebridge-melcloud-control",
4
- "version": "4.0.0-beta.330",
4
+ "version": "4.0.0-beta.331",
5
5
  "description": "Homebridge plugin to control Mitsubishi Air Conditioner, Heat Pump and Energy Recovery Ventilation.",
6
6
  "license": "MIT",
7
7
  "author": "grzegorz914",
@@ -148,6 +148,7 @@ class MelCloudHomeToken extends EventEmitter {
148
148
  if (response.status === 302 && response.headers.location) {
149
149
  // Login success — mamy redirect z "code="
150
150
  const redirectUrl = response.headers.location;
151
+ if (this.logWarn) this.emit('warn', `Redirect URL: ${redirectUrl}`);
151
152
 
152
153
  // 🔹 wykonaj GET na redirect URL (tam ustawiane sÄ… C1/C2)
153
154
  const finalResp = await axios.get(redirectUrl, {
@@ -158,18 +159,14 @@ class MelCloudHomeToken extends EventEmitter {
158
159
  validateStatus: s => [200, 302].includes(s),
159
160
  });
160
161
 
161
- if (this.logWarn) this.emit('warn', `Redirect URL: ${redirectUrl}`);
162
+ if (this.logWarn) this.emit('warn', `Redirect URL: ${finalResp}`);
162
163
 
163
164
  const finalCookies = finalResp.headers['set-cookie'] || [];
164
165
  const c1 = finalCookies.find(c => c.startsWith('__Secure-monitorandcontrolC1='))?.split(';')[0];
165
166
  const c2 = finalCookies.find(c => c.startsWith('__Secure-monitorandcontrolC2='))?.split(';')[0];
166
167
 
167
168
  if (c1 && c2) {
168
- const cookieHeader = [
169
- '__Secure-monitorandcontrol=chunks-2',
170
- c1,
171
- c2
172
- ].join('; ');
169
+ const cookieHeader = ['__Secure-monitorandcontrol=chunks-2', c1, c2].join('; ');
173
170
  if (this.logWarn) this.emit('warn', `Cookie returned: ${cookieHeader}`);
174
171
 
175
172
  return cookieHeader;