iobroker.bmw 2.5.2 → 2.5.3

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/io-package.json CHANGED
@@ -1,8 +1,11 @@
1
1
  {
2
2
  "common": {
3
3
  "name": "bmw",
4
- "version": "2.5.2",
4
+ "version": "2.5.3",
5
5
  "news": {
6
+ "2.5.3": {
7
+ "en": "Fix login"
8
+ },
6
9
  "2.5.2": {
7
10
  "en": "Bugfixes"
8
11
  },
package/main.js CHANGED
@@ -9,10 +9,10 @@
9
9
  const utils = require("@iobroker/adapter-core");
10
10
  const axios = require("axios");
11
11
 
12
+ const { HttpsCookieAgent } = require("http-cookie-agent");
12
13
  const crypto = require("crypto");
13
14
  const qs = require("qs");
14
15
  const { extractKeys } = require("./lib/extractKeys");
15
- const axiosCookieJarSupport = require("axios-cookiejar-support").default;
16
16
  const tough = require("tough-cookie");
17
17
  class Bmw extends utils.Adapter {
18
18
  /**
@@ -38,9 +38,15 @@ class Bmw extends utils.Adapter {
38
38
  this.log.info("Set interval to minimum 0.5");
39
39
  this.config.interval = 0.5;
40
40
  }
41
- axiosCookieJarSupport(axios);
42
- this.cookieJar = new tough.CookieJar();
43
- this.requestClient = axios.create();
41
+ this.cookieJar = new tough.CookieJar(null, { ignoreError: true });
42
+
43
+ this.requestClient = axios.create({
44
+ jar: this.cookieJar,
45
+ withCredentials: true,
46
+ httpsAgent: new HttpsCookieAgent({
47
+ jar: this.cookieJar,
48
+ }),
49
+ });
44
50
  this.updateInterval = null;
45
51
  this.reLoginTimeout = null;
46
52
  this.refreshTokenTimeout = null;
@@ -136,6 +142,7 @@ class Bmw extends utils.Adapter {
136
142
  data: qs.stringify(data),
137
143
  jar: this.cookieJar,
138
144
  withCredentials: true,
145
+ maxRedirects: 0,
139
146
  })
140
147
  .then((res) => {
141
148
  this.log.debug(JSON.stringify(res.data));
@@ -143,16 +150,18 @@ class Bmw extends utils.Adapter {
143
150
  })
144
151
  .catch((error) => {
145
152
  let code = "";
146
- if (error.response && error.response.status === 400) {
153
+ if (error.response && error.response.status >= 400) {
147
154
  this.log.error(JSON.stringify(error.response.data));
148
155
  return;
149
156
  }
150
- if (error.config) {
151
- this.log.debug(JSON.stringify(error.config.url));
152
- code = qs.parse(error.config.url.split("?")[1]).code;
157
+ if (error.response.status === 302) {
158
+ this.log.debug(JSON.stringify(error.response.headers.location));
159
+ code = qs.parse(error.response.headers.location.split("?")[1]).code;
153
160
  this.log.debug(code);
154
161
  return code;
155
162
  }
163
+ this.log.error(error);
164
+ return;
156
165
  });
157
166
  await this.requestClient({
158
167
  method: "post",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "iobroker.bmw",
3
- "version": "2.5.2",
3
+ "version": "2.5.3",
4
4
  "description": "Adapter for BMW",
5
5
  "author": {
6
6
  "name": "TA2k",
@@ -17,17 +17,18 @@
17
17
  },
18
18
  "dependencies": {
19
19
  "@iobroker/adapter-core": "^2.6.0",
20
- "axios": "^0.24.0",
21
- "axios-cookiejar-support": "^1.0.1",
20
+ "axios": "^0.26.1",
21
+ "http-cookie-agent": "^1.0.5",
22
22
  "json-bigint": "^1.0.0",
23
23
  "qs": "^6.10.3",
24
24
  "tough-cookie": "^4.0.0"
25
25
  },
26
26
  "devDependencies": {
27
- "@iobroker/testing": "^2.5.6",
27
+ "@alcalzone/release-script": "^2.2.2",
28
+ "@iobroker/adapter-dev": "^1.0.0",
29
+ "@iobroker/testing": "^2.5.4",
28
30
  "@types/chai": "^4.3.0",
29
31
  "@types/chai-as-promised": "^7.1.5",
30
- "@types/gulp": "^4.0.9",
31
32
  "@types/mocha": "^9.1.0",
32
33
  "@types/node": "^14.18.12",
33
34
  "@types/proxyquire": "^1.3.28",
@@ -35,12 +36,12 @@
35
36
  "@types/sinon-chai": "^3.2.8",
36
37
  "chai": "^4.3.6",
37
38
  "chai-as-promised": "^7.1.1",
38
- "eslint": "^7.32.0",
39
+ "eslint": "^8.10.0",
39
40
  "mocha": "^9.2.1",
40
41
  "proxyquire": "^2.1.3",
41
- "sinon": "^12.0.1",
42
+ "sinon": "^13.0.1",
42
43
  "sinon-chai": "^3.7.0",
43
- "typescript": "~4.4.4"
44
+ "typescript": "~4.5.5"
44
45
  },
45
46
  "main": "main.js",
46
47
  "scripts": {