homebridge-melcloud-control 4.0.0-beta.296 → 4.0.0-beta.297
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/melcloud.js +1 -1
- package/src/melcloudhometoken.js +2 -3
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.297",
|
|
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/melcloud.js
CHANGED
|
@@ -305,7 +305,7 @@ class MelCloud extends EventEmitter {
|
|
|
305
305
|
const code = await melCloudHomeToken.extractCodeFromHtml(html);
|
|
306
306
|
|
|
307
307
|
console.log(code);
|
|
308
|
-
return
|
|
308
|
+
return
|
|
309
309
|
// Check for form_post response (HTML with hidden form)
|
|
310
310
|
const formCodeMatch = html.match(/name="code"\s+value="([^"]+)"/);
|
|
311
311
|
const formStateMatch = html.match(/name="state"\s+value="([^"]+)"/);
|
package/src/melcloudhometoken.js
CHANGED
|
@@ -36,9 +36,8 @@ class MelCloudHomeToken {
|
|
|
36
36
|
async extractCodeFromHtml(html) {
|
|
37
37
|
let code = null;
|
|
38
38
|
|
|
39
|
-
//
|
|
40
|
-
const
|
|
41
|
-
const urlMatch = url1.match(/[?&]code=([^&]+)/);
|
|
39
|
+
// Sprawdzenie, czy code jest w URL
|
|
40
|
+
const urlMatch = html.match(/[?&]code=([^&]+)/);
|
|
42
41
|
if (urlMatch) {
|
|
43
42
|
console.log('Authorization code found in URL');
|
|
44
43
|
return urlMatch[1];
|