iobroker.parcel 0.0.27 → 0.0.30

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.
Files changed (4) hide show
  1. package/README.md +4 -0
  2. package/io-package.json +306 -300
  3. package/main.js +89 -56
  4. package/package.json +11 -12
package/README.md CHANGED
@@ -63,6 +63,10 @@ Den Datenpunkt parcel.0.dhl.briefe....image ein "String img src" element als Obj
63
63
 
64
64
  ## Changelog
65
65
 
66
+ ### 0.0.30
67
+
68
+ - Fix hermes login
69
+
66
70
  ### 0.0.25
67
71
 
68
72
  - Fix amazon UI parsing
package/io-package.json CHANGED
@@ -1,306 +1,312 @@
1
1
  {
2
- "common": {
3
- "name": "parcel",
4
- "version": "0.0.27",
5
- "news": {
6
- "0.0.27": {
7
- "en": "Fix DHL Refresh token",
8
- "de": "DHL Refresh token gefixt"
9
- },
10
- "0.0.26": {
11
- "en": "Fix DHL Login",
12
- "de": "DHL Login gefixt"
13
- },
14
- "0.0.25": {
15
- "en": "Fix new Amazon UI parsing",
16
- "de": "Neues Amazon UI parsing gefixt"
17
- },
18
- "0.0.23": {
19
- "en": "Disable Pictures of Briefankündigung",
20
- "de": "Bilder der Briefankündigung deaktiviert"
21
- },
22
- "0.0.22": {
23
- "en": "Fix Amazon Login"
24
- },
25
- "0.0.21": {
26
- "en": "Fix Brief images and pushover user"
27
- },
28
- "0.0.20": {
29
- "en": "Fix GLS Parcel"
30
- },
31
- "0.0.18": {
32
- "en": "Fix UPS/GLS login"
33
- },
34
- "0.0.15": {
35
- "en": "Fix DPD states and remove canvas dependency"
36
- },
37
- "0.0.13": {
38
- "en": "Fix Amazon delivery state, add telegram user"
39
- },
40
- "0.0.12": {
41
- "en": "Add delivery status"
42
- },
43
- "0.0.11": {
44
- "en": "Briefankündigung wird gestoppt, falls sie nicht funktioniert"
45
- },
46
- "0.0.10": {
47
- "en": "in Zustellung DP, DPD Bugfix, detailierte DPs für Amazon, Option für keine Benachrichtigung bei Adapterstart"
48
- },
49
- "0.0.8": {
50
- "en": "Hermes hinzugefügt"
51
- },
52
- "0.0.7": {
53
- "en": "Datenpunkt für in Zustellung hinzugefügt, Fix für wiederholende Benachrichtigungen"
54
- },
55
- "0.0.6": {
56
- "en": "initial release",
57
- "de": "Erstveröffentlichung",
58
- "ru": "Начальная версия",
59
- "pt": "lançamento inicial",
60
- "nl": "Eerste uitgave",
61
- "fr": "Première version",
62
- "it": "Versione iniziale",
63
- "es": "Versión inicial",
64
- "pl": "Pierwsze wydanie",
65
- "zh-cn": "首次出版"
66
- }
67
- },
68
- "title": "Parcel tracking",
69
- "titleLang": {
70
- "en": "Parcel tracking",
71
- "de": "Paket Sendungsverfolgung",
72
- "ru": "Отслеживание посылок",
73
- "pt": "Rastreamento de encomendas",
74
- "nl": "Pakket volgen",
75
- "fr": "Suivi colis",
76
- "it": "Tracciamento del pacco",
77
- "es": "Seguimiento de paquetes",
78
- "pl": "Śledzenie przesyłek",
79
- "zh-cn": "包裹追踪"
80
- },
81
- "desc": {
82
- "en": "Parcel tracking",
83
- "de": "Paket Sendungsverfolgung",
84
- "ru": "Отслеживание посылок",
85
- "pt": "Rastreamento de encomendas",
86
- "nl": "Pakket volgen",
87
- "fr": "Suivi colis",
88
- "it": "Tracciamento del pacco",
89
- "es": "Seguimiento de paquetes",
90
- "pl": "Śledzenie przesyłek",
91
- "zh-cn": "包裹追踪"
92
- },
93
- "authors": ["TA2k <tombox2020@gmail.com>"],
94
- "keywords": [
95
- "parcel",
96
- "tracking",
97
- "paketverfolgung",
98
- "sendungsverfolgung",
99
- "dhl",
100
- "gls",
101
- "ups",
102
- "hermes",
103
- "paket",
104
- "17Track",
105
- "Amazon",
106
- "dpd",
107
- "briefe"
108
- ],
109
- "license": "MIT",
110
- "platform": "Javascript/Node.js",
111
- "main": "main.js",
112
- "icon": "parcel.png",
113
- "enabled": true,
114
- "extIcon": "https://raw.githubusercontent.com/TA2k/ioBroker.parcel/master/admin/parcel.png",
115
- "readme": "https://github.com/TA2k/ioBroker.parcel/blob/master/README.md",
116
- "loglevel": "info",
117
- "mode": "daemon",
118
- "type": "misc-data",
119
- "compact": true,
120
- "connectionType": "cloud",
121
- "dataSource": "poll",
122
- "materialize": true,
123
- "plugins": {
124
- "sentry": {
125
- "dsn": "https://6296452769de44959c1809642564a7e3@sentry.iobroker.net/171"
126
- }
127
- },
128
- "dependencies": [
129
- {
130
- "js-controller": ">=3.2.0"
131
- }
132
- ],
133
- "globalDependencies": [
134
- {
135
- "admin": ">=4.0.9"
136
- }
137
- ]
2
+ "common": {
3
+ "name": "parcel",
4
+ "version": "0.0.30",
5
+ "news": {
6
+ "0.0.30": {
7
+ "en": "Fix Hermes Login"
8
+ },
9
+ "0.0.28": {
10
+ "en": "Fix Amazon Login"
11
+ },
12
+ "0.0.27": {
13
+ "en": "Fix DHL Refresh token",
14
+ "de": "DHL Refresh token gefixt"
15
+ },
16
+ "0.0.26": {
17
+ "en": "Fix DHL Login",
18
+ "de": "DHL Login gefixt"
19
+ },
20
+ "0.0.25": {
21
+ "en": "Fix new Amazon UI parsing",
22
+ "de": "Neues Amazon UI parsing gefixt"
23
+ },
24
+ "0.0.23": {
25
+ "en": "Disable Pictures of Briefankündigung",
26
+ "de": "Bilder der Briefankündigung deaktiviert"
27
+ },
28
+ "0.0.22": {
29
+ "en": "Fix Amazon Login"
30
+ },
31
+ "0.0.21": {
32
+ "en": "Fix Brief images and pushover user"
33
+ },
34
+ "0.0.20": {
35
+ "en": "Fix GLS Parcel"
36
+ },
37
+ "0.0.18": {
38
+ "en": "Fix UPS/GLS login"
39
+ },
40
+ "0.0.15": {
41
+ "en": "Fix DPD states and remove canvas dependency"
42
+ },
43
+ "0.0.13": {
44
+ "en": "Fix Amazon delivery state, add telegram user"
45
+ },
46
+ "0.0.12": {
47
+ "en": "Add delivery status"
48
+ },
49
+ "0.0.11": {
50
+ "en": "Briefankündigung wird gestoppt, falls sie nicht funktioniert"
51
+ },
52
+ "0.0.10": {
53
+ "en": "in Zustellung DP, DPD Bugfix, detailierte DPs für Amazon, Option für keine Benachrichtigung bei Adapterstart"
54
+ },
55
+ "0.0.8": {
56
+ "en": "Hermes hinzugefügt"
57
+ },
58
+ "0.0.7": {
59
+ "en": "Datenpunkt für in Zustellung hinzugefügt, Fix für wiederholende Benachrichtigungen"
60
+ },
61
+ "0.0.6": {
62
+ "en": "initial release",
63
+ "de": "Erstveröffentlichung",
64
+ "ru": "Начальная версия",
65
+ "pt": "lançamento inicial",
66
+ "nl": "Eerste uitgave",
67
+ "fr": "Première version",
68
+ "it": "Versione iniziale",
69
+ "es": "Versión inicial",
70
+ "pl": "Pierwsze wydanie",
71
+ "zh-cn": "首次出版"
72
+ }
138
73
  },
139
- "encryptedNative": [
140
- "dhlpassword",
141
- "amzpassword",
142
- "dpdpassword",
143
- "t17password",
144
- "upspassword",
145
- "hermespassword",
146
- "postchpassword",
147
- "postatpassword",
148
- "glspassword"
149
- ],
150
- "protectedNative": [
151
- "dhlpassword",
152
- "amzpassword",
153
- "dpdpassword",
154
- "t17password",
155
- "upspassword",
156
- "hermespassword",
157
- "postchpassword",
158
- "postatpassword",
159
- "glspassword"
74
+ "title": "Parcel tracking",
75
+ "titleLang": {
76
+ "en": "Parcel tracking",
77
+ "de": "Paket Sendungsverfolgung",
78
+ "ru": "Отслеживание посылок",
79
+ "pt": "Rastreamento de encomendas",
80
+ "nl": "Pakket volgen",
81
+ "fr": "Suivi colis",
82
+ "it": "Tracciamento del pacco",
83
+ "es": "Seguimiento de paquetes",
84
+ "pl": "Śledzenie przesyłek",
85
+ "zh-cn": "包裹追踪"
86
+ },
87
+ "desc": {
88
+ "en": "Parcel tracking",
89
+ "de": "Paket Sendungsverfolgung",
90
+ "ru": "Отслеживание посылок",
91
+ "pt": "Rastreamento de encomendas",
92
+ "nl": "Pakket volgen",
93
+ "fr": "Suivi colis",
94
+ "it": "Tracciamento del pacco",
95
+ "es": "Seguimiento de paquetes",
96
+ "pl": "Śledzenie przesyłek",
97
+ "zh-cn": "包裹追踪"
98
+ },
99
+ "authors": ["TA2k <tombox2020@gmail.com>"],
100
+ "keywords": [
101
+ "parcel",
102
+ "tracking",
103
+ "paketverfolgung",
104
+ "sendungsverfolgung",
105
+ "dhl",
106
+ "gls",
107
+ "ups",
108
+ "hermes",
109
+ "paket",
110
+ "17Track",
111
+ "Amazon",
112
+ "dpd",
113
+ "briefe"
160
114
  ],
161
- "native": {
162
- "amzusername": "",
163
- "amzpassword": "",
164
- "glsusername": "",
165
- "glspassword": "",
166
- "upsusername": "",
167
- "upspassword": "",
168
- "hermespassword": "",
169
- "hermesusername": "",
170
- "postchusername": "",
171
- "postchpassword": "",
172
- "postatusername": "",
173
- "postatpassword": "",
174
- "amzotp": "",
175
- "t17username": "",
176
- "t17password": "",
177
- "dpdusername": "",
178
- "dpdpassword": "",
179
- "dhlusername": "",
180
- "dhlpassword": "",
181
- "dhlMfa": "",
182
- "17trackKey": "",
183
- "sendToActive": false,
184
- "noFirstStartSend": false,
185
- "sendToInstance": "telegram.0",
186
- "sendToUser": "",
187
- "interval": 10
115
+ "license": "MIT",
116
+ "platform": "Javascript/Node.js",
117
+ "main": "main.js",
118
+ "icon": "parcel.png",
119
+ "enabled": true,
120
+ "extIcon": "https://raw.githubusercontent.com/TA2k/ioBroker.parcel/master/admin/parcel.png",
121
+ "readme": "https://github.com/TA2k/ioBroker.parcel/blob/master/README.md",
122
+ "loglevel": "info",
123
+ "mode": "daemon",
124
+ "type": "misc-data",
125
+ "compact": true,
126
+ "connectionType": "cloud",
127
+ "dataSource": "poll",
128
+ "materialize": true,
129
+ "plugins": {
130
+ "sentry": {
131
+ "dsn": "https://6296452769de44959c1809642564a7e3@sentry.iobroker.net/171"
132
+ }
188
133
  },
189
- "objects": [],
190
- "instanceObjects": [
191
- {
192
- "_id": "info",
193
- "type": "channel",
194
- "common": {
195
- "name": "Information"
196
- },
197
- "native": {}
198
- },
199
- {
200
- "_id": "allProviderJson",
201
- "type": "state",
202
- "common": {
203
- "role": "json",
204
- "name": "Tracking List of all Providers",
205
- "type": "string",
206
- "read": true,
207
- "write": false
208
- },
209
- "native": {}
210
- },
211
- {
212
- "_id": "allProviderObjects",
213
- "type": "state",
214
- "common": {
215
- "role": "json",
216
- "name": "Tracking Dictionary of all Providers",
217
- "type": "string",
218
- "read": true,
219
- "write": false
220
- },
221
- "native": {}
222
- },
223
- {
224
- "_id": "inDelivery",
225
- "type": "state",
226
- "common": {
227
- "role": "json",
228
- "name": "Today in delivery/Heute in Zustellung",
229
- "type": "string",
230
- "read": true,
231
- "write": false
232
- },
233
- "native": {}
234
- },
235
- {
236
- "_id": "inDeliveryCount",
237
- "type": "state",
238
- "common": {
239
- "role": "value",
240
- "name": "Number of in delivery/Anzahl in Zustellung",
241
- "type": "number",
242
- "read": true,
243
- "write": false
244
- },
245
- "native": {}
246
- },
247
- {
248
- "_id": "auth",
249
- "type": "channel",
250
- "common": {
251
- "name": "Auth Information"
252
- },
253
- "native": {}
254
- },
255
- {
256
- "_id": "auth.dhlMfaToken",
257
- "type": "state",
258
- "common": {
259
- "role": "state",
260
- "name": "DHL Mfa Token",
261
- "type": "string",
262
- "read": true,
263
- "write": false
264
- },
265
- "native": {}
266
- },
267
- {
268
- "_id": "auth.cookie",
269
- "type": "state",
270
- "common": {
271
- "role": "state",
272
- "name": "Cookie state",
273
- "type": "string",
274
- "read": true,
275
- "write": false
276
- },
277
- "native": {}
278
- },
279
- {
280
- "_id": "info.connection",
281
- "type": "state",
282
- "common": {
283
- "role": "indicator.connected",
284
- "name": "Device or service connected",
285
- "type": "boolean",
286
- "read": true,
287
- "write": false,
288
- "def": false
289
- },
290
- "native": {}
291
- },
292
- {
293
- "_id": "refresh",
294
- "type": "state",
295
- "common": {
296
- "role": "boolean",
297
- "name": "Force data refresh",
298
- "type": "boolean",
299
- "read": true,
300
- "write": true,
301
- "def": false
302
- },
303
- "native": {}
304
- }
134
+ "dependencies": [
135
+ {
136
+ "js-controller": ">=3.2.0"
137
+ }
138
+ ],
139
+ "globalDependencies": [
140
+ {
141
+ "admin": ">=4.0.9"
142
+ }
305
143
  ]
144
+ },
145
+ "encryptedNative": [
146
+ "dhlpassword",
147
+ "amzpassword",
148
+ "dpdpassword",
149
+ "t17password",
150
+ "upspassword",
151
+ "hermespassword",
152
+ "postchpassword",
153
+ "postatpassword",
154
+ "glspassword"
155
+ ],
156
+ "protectedNative": [
157
+ "dhlpassword",
158
+ "amzpassword",
159
+ "dpdpassword",
160
+ "t17password",
161
+ "upspassword",
162
+ "hermespassword",
163
+ "postchpassword",
164
+ "postatpassword",
165
+ "glspassword"
166
+ ],
167
+ "native": {
168
+ "amzusername": "",
169
+ "amzpassword": "",
170
+ "glsusername": "",
171
+ "glspassword": "",
172
+ "upsusername": "",
173
+ "upspassword": "",
174
+ "hermespassword": "",
175
+ "hermesusername": "",
176
+ "postchusername": "",
177
+ "postchpassword": "",
178
+ "postatusername": "",
179
+ "postatpassword": "",
180
+ "amzotp": "",
181
+ "t17username": "",
182
+ "t17password": "",
183
+ "dpdusername": "",
184
+ "dpdpassword": "",
185
+ "dhlusername": "",
186
+ "dhlpassword": "",
187
+ "dhlMfa": "",
188
+ "17trackKey": "",
189
+ "sendToActive": false,
190
+ "noFirstStartSend": false,
191
+ "sendToInstance": "telegram.0",
192
+ "sendToUser": "",
193
+ "interval": 10
194
+ },
195
+ "objects": [],
196
+ "instanceObjects": [
197
+ {
198
+ "_id": "info",
199
+ "type": "channel",
200
+ "common": {
201
+ "name": "Information"
202
+ },
203
+ "native": {}
204
+ },
205
+ {
206
+ "_id": "allProviderJson",
207
+ "type": "state",
208
+ "common": {
209
+ "role": "json",
210
+ "name": "Tracking List of all Providers",
211
+ "type": "string",
212
+ "read": true,
213
+ "write": false
214
+ },
215
+ "native": {}
216
+ },
217
+ {
218
+ "_id": "allProviderObjects",
219
+ "type": "state",
220
+ "common": {
221
+ "role": "json",
222
+ "name": "Tracking Dictionary of all Providers",
223
+ "type": "string",
224
+ "read": true,
225
+ "write": false
226
+ },
227
+ "native": {}
228
+ },
229
+ {
230
+ "_id": "inDelivery",
231
+ "type": "state",
232
+ "common": {
233
+ "role": "json",
234
+ "name": "Today in delivery/Heute in Zustellung",
235
+ "type": "string",
236
+ "read": true,
237
+ "write": false
238
+ },
239
+ "native": {}
240
+ },
241
+ {
242
+ "_id": "inDeliveryCount",
243
+ "type": "state",
244
+ "common": {
245
+ "role": "value",
246
+ "name": "Number of in delivery/Anzahl in Zustellung",
247
+ "type": "number",
248
+ "read": true,
249
+ "write": false
250
+ },
251
+ "native": {}
252
+ },
253
+ {
254
+ "_id": "auth",
255
+ "type": "channel",
256
+ "common": {
257
+ "name": "Auth Information"
258
+ },
259
+ "native": {}
260
+ },
261
+ {
262
+ "_id": "auth.dhlMfaToken",
263
+ "type": "state",
264
+ "common": {
265
+ "role": "state",
266
+ "name": "DHL Mfa Token",
267
+ "type": "string",
268
+ "read": true,
269
+ "write": false
270
+ },
271
+ "native": {}
272
+ },
273
+ {
274
+ "_id": "auth.cookie",
275
+ "type": "state",
276
+ "common": {
277
+ "role": "state",
278
+ "name": "Cookie state",
279
+ "type": "string",
280
+ "read": true,
281
+ "write": false
282
+ },
283
+ "native": {}
284
+ },
285
+ {
286
+ "_id": "info.connection",
287
+ "type": "state",
288
+ "common": {
289
+ "role": "indicator.connected",
290
+ "name": "Device or service connected",
291
+ "type": "boolean",
292
+ "read": true,
293
+ "write": false,
294
+ "def": false
295
+ },
296
+ "native": {}
297
+ },
298
+ {
299
+ "_id": "refresh",
300
+ "type": "state",
301
+ "common": {
302
+ "role": "boolean",
303
+ "name": "Force data refresh",
304
+ "type": "boolean",
305
+ "read": true,
306
+ "write": true,
307
+ "def": false
308
+ },
309
+ "native": {}
310
+ }
311
+ ]
306
312
  }
package/main.js CHANGED
@@ -140,38 +140,37 @@ class Parcel extends utils.Adapter {
140
140
  }, this.config.interval * 60 * 1000);
141
141
  this.refreshTokenInterval = setInterval(() => {
142
142
  this.refreshToken();
143
- }, 3500 * 1000);
143
+ }, 29 * 60 * 1000);
144
144
  } else {
145
145
  this.log.warn("No login session found");
146
146
  }
147
147
  }
148
148
  async loginDhlNew() {
149
- const validCookies = await this.requestClient({
150
- method: "get",
151
- url: "https://www.dhl.de/int-stammdaten/public/customerMasterData",
152
- headers: {
153
- accept: "application/json",
154
- "content-type": "application/json",
155
- "x-api-key": "a0d5b9049ba8918871e6e20bd5c49974",
156
- "accept-language": "de-de",
157
- "user-agent": "DHLPaket_PROD/1367 CFNetwork/1240.0.4 Darwin/20.6.0",
158
- },
159
- })
160
- .then((res) => {
161
- this.log.debug(res.data);
162
- return true;
163
- })
164
- .catch((err) => {
165
- return false;
166
- });
149
+ // const validCookies = await this.requestClient({
150
+ // method: "get",
151
+ // url: "https://www.dhl.de/int-stammdaten/public/customerMasterData",
152
+ // headers: {
153
+ // accept: "application/json",
154
+ // "content-type": "application/json",
155
+ // "x-api-key": "a0d5b9049ba8918871e6e20bd5c49974",
156
+ // "accept-language": "de-de",
157
+ // "user-agent": "DHLPaket_PROD/1367 CFNetwork/1240.0.4 Darwin/20.6.0",
158
+ // },
159
+ // })
160
+ // .then((res) => {
161
+ // this.log.debug(res.data);
162
+ // return true;
163
+ // })
164
+ // .catch((err) => {
165
+ // return false;
166
+ // });
167
167
  // if (validCookies) {
168
168
  // this.log.info("Valid dhl cookies found");
169
169
 
170
170
  // this.setState("info.connection", true, true);
171
171
  // return;
172
172
  // }
173
- const mfaTokenState = await this.getStateAsync("auth.dhlMfaToken");
174
- const mfaToken = mfaTokenState ? mfaTokenState.val : null;
173
+
175
174
  const [code_verifier, codeChallenge] = this.getCodeChallenge();
176
175
 
177
176
  const transactionId = this.randomString(40);
@@ -181,7 +180,8 @@ class Parcel extends utils.Adapter {
181
180
  url: "https://login.dhl.de/af5f9bb6-27ad-4af4-9445-008e7a5cddb8/login/authorize",
182
181
  params: {
183
182
  redirect_uri: "dhllogin://de.deutschepost.dhl/login",
184
- state: "eyJycyI6dHJ1ZSwicnYiOmZhbHNlLCJmaWQiOiJhcHAtbG9naW4tbWVoci1mb290ZXIiLCJoaWQiOiJhcHAtbG9naW4tbWVoci1oZWFkZXIiLCJycCI6ZmFsc2V9",
183
+ state:
184
+ "eyJycyI6dHJ1ZSwicnYiOmZhbHNlLCJmaWQiOiJhcHAtbG9naW4tbWVoci1mb290ZXIiLCJoaWQiOiJhcHAtbG9naW4tbWVoci1oZWFkZXIiLCJycCI6ZmFsc2V9",
185
185
  client_id: "83471082-5c13-4fce-8dcb-19d2a3fca413",
186
186
  response_type: "code",
187
187
  scope: "openid offline_access",
@@ -301,7 +301,8 @@ class Parcel extends utils.Adapter {
301
301
  redirect_uri: "dhllogin://de.deutschepost.dhl/login",
302
302
  response_type: "code",
303
303
  scope: "openid",
304
- state: "eyJycyI6dHJ1ZSwicnYiOmZhbHNlLCJmaWQiOiJhcHAtbG9naW4tbWVoci1mb290ZXIiLCJoaWQiOiJhcHAtbG9naW4tbWVoci1oZWFkZXIiLCJycCI6ZmFsc2V9",
304
+ state:
305
+ "eyJycyI6dHJ1ZSwicnYiOmZhbHNlLCJmaWQiOiJhcHAtbG9naW4tbWVoci1mb290ZXIiLCJoaWQiOiJhcHAtbG9naW4tbWVoci1oZWFkZXIiLCJycCI6ZmFsc2V9",
305
306
  ui_locales: 'de-DE",',
306
307
  },
307
308
  headers: {
@@ -349,7 +350,8 @@ class Parcel extends utils.Adapter {
349
350
  redirect_uri: "dhllogin://de.deutschepost.dhl/login",
350
351
  response_type: "code",
351
352
  scope: "openid",
352
- state: "eyJycyI6dHJ1ZSwicnYiOmZhbHNlLCJmaWQiOiJhcHAtbG9naW4tbWVoci1mb290ZXIiLCJoaWQiOiJhcHAtbG9naW4tbWVoci1oZWFkZXIiLCJycCI6ZmFsc2V9",
353
+ state:
354
+ "eyJycyI6dHJ1ZSwicnYiOmZhbHNlLCJmaWQiOiJhcHAtbG9naW4tbWVoci1mb290ZXIiLCJoaWQiOiJhcHAtbG9naW4tbWVoci1oZWFkZXIiLCJycCI6ZmFsc2V9",
353
355
  ui_locales: "de-DE",
354
356
  },
355
357
  headers: {
@@ -607,7 +609,8 @@ class Parcel extends utils.Adapter {
607
609
  "sec-ch-ua-mobile": "?0",
608
610
  "sec-ch-ua-platform": '"macOS"',
609
611
  "upgrade-insecure-requests": "1",
610
- "user-agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.20 Safari/537.36",
612
+ "user-agent":
613
+ "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.20 Safari/537.36",
611
614
  accept:
612
615
  "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9",
613
616
  "sec-fetch-site": "same-site",
@@ -653,7 +656,8 @@ class Parcel extends utils.Adapter {
653
656
  accept: "application/json, text/plain, */*",
654
657
  "content-type": "application/x-www-form-urlencoded",
655
658
  "sec-ch-ua-mobile": "?0",
656
- "user-agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.20 Safari/537.36",
659
+ "user-agent":
660
+ "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.20 Safari/537.36",
657
661
  "sec-ch-ua-platform": '"macOS"',
658
662
  origin: "https://login.aliexpress.com",
659
663
  "sec-fetch-site": "same-site",
@@ -683,7 +687,9 @@ class Parcel extends utils.Adapter {
683
687
  })
684
688
  .then(async (res) => {
685
689
  // this.log.debug(JSON.stringify(res.data));
686
- res.data.indexOf("Session has expired") !== -1 ? this.log.error("Session has expired") : this.log.info("Login to Aliexpress successful");
690
+ res.data.indexOf("Session has expired") !== -1
691
+ ? this.log.error("Session has expired")
692
+ : this.log.info("Login to Aliexpress successful");
687
693
  })
688
694
  .catch(async (error) => {
689
695
  error.response && this.log.error(JSON.stringify(error.response.data));
@@ -742,6 +748,24 @@ class Parcel extends utils.Adapter {
742
748
  }
743
749
 
744
750
  async loginAmz() {
751
+ await this.setObjectNotExistsAsync("amazon", {
752
+ type: "device",
753
+ common: {
754
+ name: "Amazon Tracking",
755
+ },
756
+ native: {},
757
+ });
758
+ await this.setObjectNotExistsAsync("amazon.json", {
759
+ type: "state",
760
+ common: {
761
+ name: "Json Sendungen",
762
+ write: false,
763
+ read: true,
764
+ type: "string",
765
+ role: "json",
766
+ },
767
+ native: {},
768
+ });
745
769
  let body = await this.requestClient({
746
770
  method: "get",
747
771
  url: "https://www.amazon.de/ap/signin?_encoding=UTF8&accountStatusPolicy=P1&openid.assoc_handle=deflex&openid.claimed_id=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0%2Fidentifier_select&openid.identity=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0%2Fidentifier_select&openid.mode=checkid_setup&openid.ns=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0&openid.ns.pape=http%3A%2F%2Fspecs.openid.net%2Fextensions%2Fpape%2F1.0&openid.pape.max_auth_age=0&openid.return_to=https%3A%2F%2Fwww.amazon.de%2Fgp%2Fcss%2Forder-history%3Fie%3DUTF8%26ref_%3Dnav_orders_first&pageId=webcs-yourorder&showRmrMe=1",
@@ -758,7 +782,10 @@ class Parcel extends utils.Adapter {
758
782
  return res.data;
759
783
  })
760
784
  .catch((error) => {
761
- this.log.error("Amazon login failed");
785
+ this.log.error("Amazon first login step failed");
786
+ this.log.error(
787
+ "https://www.amazon.de/ap/signin?_encoding=UTF8&accountStatusPolicy=P1&openid.assoc_handle=deflex&openid.claimed_id=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0%2Fidentifier_select&openid.identity=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0%2Fidentifier_select&openid.mode=checkid_setup&openid.ns=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0&openid.ns.pape=http%3A%2F%2Fspecs.openid.net%2Fextensions%2Fpape%2F1.0&openid.pape.max_auth_age=0&openid.return_to=https%3A%2F%2Fwww.amazon.de%2Fgp%2Fcss%2Forder-history%3Fie%3DUTF8%26ref_%3Dnav_orders_first&pageId=webcs-yourorder&showRmrMe=1",
788
+ );
762
789
  this.log.error(error);
763
790
  if (error.response) {
764
791
  this.log.error(JSON.stringify(error.response.data));
@@ -787,14 +814,20 @@ class Parcel extends utils.Adapter {
787
814
  return res.data;
788
815
  })
789
816
  .catch((error) => {
817
+ this.log.error("Failed to post with username load https://www.amazon.de/ap/signin");
790
818
  this.log.error(error);
791
819
  if (error.response) {
792
820
  this.log.error(JSON.stringify(error.response.data));
793
821
  }
822
+ this.log.info(
823
+ "Delete amazon cookie please restart the adapter to trigger relogin. If this is not working please manualy delete parcel.0.auth.cookie",
824
+ );
825
+ delete this.cookieJar.store.idx["amazon.de"];
794
826
  });
795
827
  form = this.extractHidden(body);
796
828
  }
797
829
  form.password = this.config.amzpassword;
830
+ form.rememberMe = "true";
798
831
  await this.requestClient({
799
832
  method: "post",
800
833
  url: "https://www.amazon.de/ap/signin",
@@ -817,24 +850,7 @@ class Parcel extends utils.Adapter {
817
850
  this.sessions["amz"] = true;
818
851
  this.setState("info.connection", true, true);
819
852
  this.setState("auth.cookie", JSON.stringify(this.cookieJar.toJSON()), true);
820
- await this.setObjectNotExistsAsync("amazon", {
821
- type: "device",
822
- common: {
823
- name: "Amazon Tracking",
824
- },
825
- native: {},
826
- });
827
- await this.setObjectNotExistsAsync("amazon.json", {
828
- type: "state",
829
- common: {
830
- name: "Json Sendungen",
831
- write: false,
832
- read: true,
833
- type: "string",
834
- role: "json",
835
- },
836
- native: {},
837
- });
853
+
838
854
  return;
839
855
  }
840
856
  if (res.data.indexOf("auth-mfa-otpcode") !== -1) {
@@ -878,6 +894,7 @@ class Parcel extends utils.Adapter {
878
894
  this.setState("info.connection", false, true);
879
895
  })
880
896
  .catch(async (error) => {
897
+ this.log.error("MFA: Failed to post https://www.amazon.de/ap/signin");
881
898
  if (error.response) {
882
899
  this.setState("info.connection", false, true);
883
900
  this.log.error(JSON.stringify(error.response.data));
@@ -901,6 +918,7 @@ class Parcel extends utils.Adapter {
901
918
  return;
902
919
  })
903
920
  .catch(async (error) => {
921
+ this.log.error("Failed to post with password to https://www.amazon.de/ap/signin");
904
922
  if (error.response) {
905
923
  this.setState("info.connection", false, true);
906
924
  this.log.error(JSON.stringify(error.response.data));
@@ -924,7 +942,8 @@ class Parcel extends utils.Adapter {
924
942
  url: "https://www.dpd.com/de/de/mydpd-anmelden-und-registrieren/",
925
943
  headers: {
926
944
  "content-type": "application/x-www-form-urlencoded",
927
- "user-agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.66 Safari/537.36",
945
+ "user-agent":
946
+ "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.66 Safari/537.36",
928
947
  accept:
929
948
  "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9",
930
949
  "accept-language": "de,en;q=0.9",
@@ -1070,12 +1089,12 @@ class Parcel extends utils.Adapter {
1070
1089
  async loginHermes() {
1071
1090
  await this.requestClient({
1072
1091
  method: "post",
1073
- url: "https://mobile-api.myhermes.de/mobile-api-web/v2/users/login",
1092
+ url: "https://mobile-app-api.a0930.prd.hc.de/api/v11/users/login",
1074
1093
  headers: {
1075
- Host: "mobile-api.myhermes.de",
1076
1094
  accept: "application/json",
1095
+ "api-key": "acefe97f-89fc-4f4e-9543-fc6b90f68928",
1077
1096
  "content-type": "application/json; charset=utf-8",
1078
- "user-agent": "Hermes/33 CFNetwork/1240.0.4 Darwin/20.6.0",
1097
+ "user-agent": "Hermes - ios - 11.1.2 (2386)",
1079
1098
  "accept-language": "de-de",
1080
1099
  },
1081
1100
  data: { username: this.config.hermesusername, password: this.config.hermespassword },
@@ -1495,10 +1514,11 @@ class Parcel extends utils.Adapter {
1495
1514
  hermes: [
1496
1515
  {
1497
1516
  path: "hermes",
1498
- url: "https://mobile-api.myhermes.de/mobile-api-web/v2/shipments",
1517
+ url: "https://mobile-app-api.a0930.prd.hc.de/api/v11/shipments",
1499
1518
  header: {
1500
1519
  accept: "application/json",
1501
- "user-agent": "Hermes/33 CFNetwork/1240.0.4 Darwin/20.6.0",
1520
+ "api-key": "acefe97f-89fc-4f4e-9543-fc6b90f68928",
1521
+ "user-agent": "Hermes - ios - 11.1.2 (2386)",
1502
1522
  "accept-language": "de-de",
1503
1523
  authorization: "Bearer " + this.hermesAuthToken,
1504
1524
  },
@@ -2098,16 +2118,24 @@ class Parcel extends utils.Adapter {
2098
2118
  // this.log.debug(JSON.stringify(res.data));
2099
2119
 
2100
2120
  const dom = new JSDOM(res.data);
2121
+
2122
+ if (res.data.includes("auth-workflow")) {
2123
+ this.log.debug("Amazon Login required");
2124
+ this.loginAmz();
2125
+ return;
2126
+ }
2101
2127
  const document = dom.window.document;
2102
2128
  const elements = [];
2103
2129
  const orders = document.querySelectorAll(".order-card.js-order-card");
2104
2130
 
2105
2131
  for (const order of orders) {
2106
2132
  const descHandle = order.querySelector(
2107
- ".a-fixed-right-grid-col.a-col-left .a-fixed-left-grid-col.a-col-right div:first-child .a-link-normal"
2133
+ ".a-fixed-right-grid-col.a-col-left .a-fixed-left-grid-col.a-col-right div:first-child .a-link-normal",
2108
2134
  );
2109
2135
  const desc = descHandle ? descHandle.textContent.replace(/\n */g, "") : "";
2110
- let url = order.querySelector(".track-package-button a") ? order.querySelector(".track-package-button a").getAttribute("href") : "";
2136
+ let url = order.querySelector(".track-package-button a")
2137
+ ? order.querySelector(".track-package-button a").getAttribute("href")
2138
+ : "";
2111
2139
  if (!url) {
2112
2140
  const allLinks = order.querySelectorAll(".a-button-inner a");
2113
2141
  for (const link of allLinks) {
@@ -2128,6 +2156,7 @@ class Parcel extends utils.Adapter {
2128
2156
  return elements;
2129
2157
  })
2130
2158
  .catch((error) => {
2159
+ this.log.error("Failed to get Amazon Orders");
2131
2160
  this.log.error(error);
2132
2161
  if (error.response) {
2133
2162
  this.log.error(JSON.stringify(error.response.data));
@@ -2138,6 +2167,9 @@ class Parcel extends utils.Adapter {
2138
2167
  return;
2139
2168
  }
2140
2169
  this.log.debug("Found " + orders.length + " Amazon Orders");
2170
+ if (orders.length === 0) {
2171
+ // this.log.debug(res.data);
2172
+ }
2141
2173
  for (const order of orders) {
2142
2174
  if (order.url.indexOf("http") === -1) {
2143
2175
  order.url = "https://www.amazon.de" + order.url;
@@ -2293,11 +2325,12 @@ class Parcel extends utils.Adapter {
2293
2325
  if (id === "hermes") {
2294
2326
  await this.requestClient({
2295
2327
  method: "post",
2296
- url: "https://mobile-api.myhermes.de/mobile-api-web/v2/users/refreshtoken",
2328
+ url: "https://mobile-app-api.a0930.prd.hc.de/api/v11/users/refreshtoken",
2297
2329
  headers: {
2298
2330
  "Content-Type": "application/json; charset=utf-8",
2299
2331
  Accept: "application/json",
2300
- "User-Agent": "Hermes/33 CFNetwork/1240.0.4 Darwin/20.6.0",
2332
+ "api-key": "acefe97f-89fc-4f4e-9543-fc6b90f68928",
2333
+ "User-Agent": "Hermes - ios - 11.1.2 (2386)",
2301
2334
  "Accept-Language": "de-de",
2302
2335
  },
2303
2336
  data: `{"refreshToken":"${this.sessions["hermes"].refreshToken}"}`,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "iobroker.parcel",
3
- "version": "0.0.27",
3
+ "version": "0.0.30",
4
4
  "description": "Parcel tracking",
5
5
  "author": {
6
6
  "name": "TA2k",
@@ -26,32 +26,31 @@
26
26
  },
27
27
  "dependencies": {
28
28
  "@iobroker/adapter-core": "^2.6.8",
29
- "axios": "^1.3.5",
29
+ "axios": "^1.4.0",
30
30
  "http-cookie-agent": "^5.0.2",
31
- "jsdom": "^21.1.1",
31
+ "jsdom": "^21.1.2",
32
32
  "json-bigint": "^1.0.0",
33
- "qs": "^6.11.1",
34
- "tough-cookie": "^4.1.2",
33
+ "qs": "^6.11.2",
34
+ "tough-cookie": "^4.1.3",
35
35
  "uuid": "^9.0.0"
36
36
  },
37
37
  "devDependencies": {
38
38
  "@iobroker/testing": "^4.1.0",
39
- "@types/chai": "^4.3.4",
39
+ "@types/chai": "^4.3.5",
40
40
  "@types/chai-as-promised": "^7.1.5",
41
- "@types/gulp": "^4.0.10",
42
41
  "@types/mocha": "^10.0.1",
43
- "@types/node": "^18.15.11",
42
+ "@types/node": "^18.16.16",
44
43
  "@types/proxyquire": "^1.3.28",
45
- "@types/sinon": "^10.0.13",
44
+ "@types/sinon": "^10.0.15",
46
45
  "@types/sinon-chai": "^3.2.9",
47
46
  "chai": "^4.3.7",
48
47
  "chai-as-promised": "^7.1.1",
49
- "eslint": "^8.38.0",
48
+ "eslint": "^8.42.0",
50
49
  "mocha": "^10.2.0",
51
50
  "proxyquire": "^2.1.3",
52
- "sinon": "^15.0.3",
51
+ "sinon": "^15.1.0",
53
52
  "sinon-chai": "^3.7.0",
54
- "typescript": "~5.0.4"
53
+ "typescript": "~5.1.3"
55
54
  },
56
55
  "main": "main.js",
57
56
  "files": [