homebridge-melcloud-control 4.9.0-beta.7 → 4.9.0-beta.8

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.9.0-beta.7",
4
+ "version": "4.9.0-beta.8",
5
5
  "description": "Homebridge plugin to control Mitsubishi Air Conditioner, Heat Pump and Energy Recovery Ventilation.",
6
6
  "license": "MIT",
7
7
  "author": "grzegorz914",
@@ -418,7 +418,7 @@ class MelCloudHome extends EventEmitter {
418
418
 
419
419
  // GET na signin-oidc-meu — IdentityServer przetworzy i przekieruje do melcloudhome://
420
420
  const signinResp = await this.pace(() =>
421
- client.get(signinUrl, {
421
+ client.post(signinUrl, {
422
422
  headers: { 'User-Agent': ApiUrls.Home.UserAgent },
423
423
  maxRedirects: 0, // przechwytujemy redirect do melcloudhome://
424
424
  })
@@ -436,11 +436,11 @@ class MelCloudHome extends EventEmitter {
436
436
  const signinBody = typeof signinResp.data === 'string' ? signinResp.data : '';
437
437
 
438
438
  // Przypadek A: bezpośredni redirect na melcloudhome://
439
- let codeMatch = /code=([^&"' ]+)/.exec(cognitoRedirectLocation);
439
+ let codeMatch = /code=([^&"' ]+)/.exec(signinLocation);
440
440
 
441
441
  // Przypadek B: IdentityServer przekierowuje do /connect/authorize/callback
442
442
  if (!codeMatch) {
443
- const callbackMatch = /\/connect\/authorize\/callback\?([^"' ]+)/.exec(cognitoRedirectLocation)
443
+ const callbackMatch = /\/connect\/authorize\/callback\?([^"' ]+)/.exec(signinLocation)
444
444
  || /\/connect\/authorize\/callback\?([^"' ]+)/.exec(signinBody);
445
445
 
446
446
  if (callbackMatch) {
@@ -449,7 +449,7 @@ class MelCloudHome extends EventEmitter {
449
449
  } else {
450
450
  // Przypadek C: kod bezpośrednio w body (np. form hidden field)
451
451
  codeMatch = /code=([^&"' ]+)/.exec(signinBody);
452
- if (!codeMatch) throw new Error(`Failed to extract auth code. signin status=${signinResp.status}, location=${cognitoRedirectLocation}`);
452
+ if (!codeMatch) throw new Error(`Failed to extract auth code. signin status=${signinResp.status}, location=${signinLocation}`);
453
453
  authCode = codeMatch[1];
454
454
  }
455
455
  } else {
@@ -458,7 +458,7 @@ class MelCloudHome extends EventEmitter {
458
458
 
459
459
  if (this.logDebug) this.emit('debug', `Got auth code: ${authCode.slice(0, 20)}...`);
460
460
 
461
- // ── Step 6: Wymień kod na tokeny (WAŻNE: await!) ──────────────────
461
+ // ── Step 6: Wymień kod na tokeny ──────────────────
462
462
  const exchangeRes = await this.exchangeCodeForTokens(client, authCode, codeVerifier);
463
463
  return this._buildConnectInfo(connectInfo, exchangeRes);
464
464