homebridge-melcloud-control 4.0.0-beta.382 → 4.0.0-beta.384
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 +1 -1
- package/src/melcloudhometoken.js +2 -9
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.
|
|
4
|
+
"version": "4.0.0-beta.384",
|
|
5
5
|
"description": "Homebridge plugin to control Mitsubishi Air Conditioner, Heat Pump and Energy Recovery Ventilation.",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"author": "grzegorz914",
|
package/src/melcloudhometoken.js
CHANGED
|
@@ -7,7 +7,7 @@ import EventEmitter from 'events';
|
|
|
7
7
|
|
|
8
8
|
const MOBILE_USER_AGENT = 'MonitorAndControl.App.Mobile/35 CFNetwork/3860.100.1 Darwin/25.0.0';
|
|
9
9
|
const CLIENT_ID = 'homemobile';
|
|
10
|
-
const REDIRECT_URI = 'melcloudhome
|
|
10
|
+
const REDIRECT_URI = 'https://auth.melcloudhome.com/signin-oidc-meu';
|
|
11
11
|
const SCOPE = 'openid profile email offline_access IdentityServerApi';
|
|
12
12
|
const TOKEN_ENDPOINT = 'https://auth.melcloudhome.com/connect/token';
|
|
13
13
|
const AUTHORIZE_ENDPOINT = 'https://auth.melcloudhome.com/connect/authorize';
|
|
@@ -44,7 +44,7 @@ class MelCloudHomeToken extends EventEmitter {
|
|
|
44
44
|
try {
|
|
45
45
|
const tokenData = new URLSearchParams({
|
|
46
46
|
grant_type: 'authorization_code',
|
|
47
|
-
code:
|
|
47
|
+
code: code,
|
|
48
48
|
redirect_uri: REDIRECT_URI,
|
|
49
49
|
client_id: CLIENT_ID,
|
|
50
50
|
code_verifier: codeVerifier,
|
|
@@ -108,12 +108,6 @@ class MelCloudHomeToken extends EventEmitter {
|
|
|
108
108
|
if (response.status === 302 && response.headers.location) {
|
|
109
109
|
// Login success — mamy redirect z "code="
|
|
110
110
|
const redirectUrl = response.headers.location;
|
|
111
|
-
|
|
112
|
-
const getResp = await this.client.get('https://melcloudhome.com/dashboard', {
|
|
113
|
-
headers: {
|
|
114
|
-
'Accept': 'text/html',
|
|
115
|
-
}
|
|
116
|
-
});
|
|
117
111
|
if (this.logWarn) this.emit('warn', `Redirect URL: ${getResp}`);
|
|
118
112
|
if (this.logWarn) this.emit('warn', `Response headers: ${getResp.headers}`);
|
|
119
113
|
|
|
@@ -121,7 +115,6 @@ class MelCloudHomeToken extends EventEmitter {
|
|
|
121
115
|
if (match) {
|
|
122
116
|
const code = match[1];
|
|
123
117
|
if (this.logWarn) this.emit('warn', `Redirect URL found code: ${code}`);
|
|
124
|
-
this.code = code
|
|
125
118
|
return code;
|
|
126
119
|
} else {
|
|
127
120
|
if (this.logWarn) this.emit('warn', `Redirect URL found, but no "code=" param: ${redirectUrl}`);
|