homebridge-melcloud-control 4.0.0-beta.247 → 4.0.0-beta.248
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 +5 -5
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.248",
|
|
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
|
@@ -75,7 +75,7 @@ class MelCloudHomeToken {
|
|
|
75
75
|
|
|
76
76
|
// --- Get login page ---
|
|
77
77
|
async getLoginPage(authUrl) {
|
|
78
|
-
|
|
78
|
+
console.log('Getting login page...');
|
|
79
79
|
const resp = await this.httpsRequest(authUrl, {
|
|
80
80
|
method: 'GET',
|
|
81
81
|
headers: {
|
|
@@ -93,7 +93,7 @@ class MelCloudHomeToken {
|
|
|
93
93
|
|
|
94
94
|
// --- Submit login and handle form_post ---
|
|
95
95
|
async submitLogin(form, email, password, cookies, loginPageUrl) {
|
|
96
|
-
|
|
96
|
+
console.log('Submitting login credentials...');
|
|
97
97
|
|
|
98
98
|
// Step 1: Collect all hidden inputs
|
|
99
99
|
const formData = new URLSearchParams();
|
|
@@ -149,7 +149,7 @@ class MelCloudHomeToken {
|
|
|
149
149
|
|
|
150
150
|
// --- Exchange code for tokens ---
|
|
151
151
|
async exchangeCodeForTokens(code, codeVerifier) {
|
|
152
|
-
|
|
152
|
+
console.log('Exchanging authorization code for tokens...');
|
|
153
153
|
|
|
154
154
|
const tokenData = new URLSearchParams({
|
|
155
155
|
grant_type: 'authorization_code',
|
|
@@ -175,7 +175,7 @@ class MelCloudHomeToken {
|
|
|
175
175
|
|
|
176
176
|
// --- Main flow ---
|
|
177
177
|
async getTokensWithCredentials(email, password) {
|
|
178
|
-
|
|
178
|
+
console.log('Obtaining OAuth tokens automatically...');
|
|
179
179
|
|
|
180
180
|
const pkce = this.generatePKCE();
|
|
181
181
|
const state = this.generateState();
|
|
@@ -197,7 +197,7 @@ class MelCloudHomeToken {
|
|
|
197
197
|
|
|
198
198
|
// 3️⃣ Exchange code for tokens
|
|
199
199
|
const tokens = await this.exchangeCodeForTokens(authCode, pkce.verifier);
|
|
200
|
-
|
|
200
|
+
console.log('✓ Successfully obtained OAuth tokens');
|
|
201
201
|
return tokens;
|
|
202
202
|
}
|
|
203
203
|
}
|