iobroker.parcel 0.0.25 → 0.0.26
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 +5 -1
- package/main.js +315 -15
- package/package.json +9 -9
package/io-package.json
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"common": {
|
|
3
3
|
"name": "parcel",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.26",
|
|
5
5
|
"news": {
|
|
6
|
+
"0.0.26": {
|
|
7
|
+
"en": "Fix DHL Login",
|
|
8
|
+
"de": "DHL Login gefixt"
|
|
9
|
+
},
|
|
6
10
|
"0.0.25": {
|
|
7
11
|
"en": "Fix new Amazon UI parsing",
|
|
8
12
|
"de": "Neues Amazon UI parsing gefixt"
|
package/main.js
CHANGED
|
@@ -20,6 +20,7 @@ Module.prototype.require = function () {
|
|
|
20
20
|
const utils = require("@iobroker/adapter-core");
|
|
21
21
|
const axios = require("axios");
|
|
22
22
|
const qs = require("qs");
|
|
23
|
+
const crypto = require("crypto");
|
|
23
24
|
const Json2iob = require("./lib/json2iob");
|
|
24
25
|
const getPwd = require("./lib/rsaKey");
|
|
25
26
|
const tough = require("tough-cookie");
|
|
@@ -87,8 +88,9 @@ class Parcel extends utils.Adapter {
|
|
|
87
88
|
|
|
88
89
|
if (this.config.dhlusername && this.config.dhlpassword) {
|
|
89
90
|
this.log.info("Login to DHL");
|
|
90
|
-
await this.
|
|
91
|
+
await this.loginDhlNew();
|
|
91
92
|
}
|
|
93
|
+
|
|
92
94
|
if (this.config.dpdusername && this.config.dpdpassword) {
|
|
93
95
|
this.log.info("Login to DPD");
|
|
94
96
|
await this.loginDPD();
|
|
@@ -143,6 +145,294 @@ class Parcel extends utils.Adapter {
|
|
|
143
145
|
this.log.warn("No login session found");
|
|
144
146
|
}
|
|
145
147
|
}
|
|
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
|
+
});
|
|
167
|
+
if (validCookies) {
|
|
168
|
+
this.log.info("Valid dhl cookies found");
|
|
169
|
+
|
|
170
|
+
this.setState("info.connection", true, true);
|
|
171
|
+
return;
|
|
172
|
+
}
|
|
173
|
+
const mfaTokenState = await this.getStateAsync("auth.dhlMfaToken");
|
|
174
|
+
const mfaToken = mfaTokenState ? mfaTokenState.val : null;
|
|
175
|
+
const [code_verifier, codeChallenge] = this.getCodeChallenge();
|
|
176
|
+
const transactionId = this.randomString(40);
|
|
177
|
+
const initUrl = await this.requestClient({
|
|
178
|
+
method: "get",
|
|
179
|
+
maxBodyLength: Infinity,
|
|
180
|
+
url: "https://login.dhl.de/af5f9bb6-27ad-4af4-9445-008e7a5cddb8/login/authorize",
|
|
181
|
+
params: {
|
|
182
|
+
redirect_uri: "dhllogin://de.deutschepost.dhl/login",
|
|
183
|
+
state: "eyJycyI6dHJ1ZSwicnYiOmZhbHNlLCJmaWQiOiJhcHAtbG9naW4tbWVoci1mb290ZXIiLCJoaWQiOiJhcHAtbG9naW4tbWVoci1oZWFkZXIiLCJycCI6ZmFsc2V9",
|
|
184
|
+
client_id: "83471082-5c13-4fce-8dcb-19d2a3fca413",
|
|
185
|
+
response_type: "code",
|
|
186
|
+
scope: "openid offline_access",
|
|
187
|
+
claims:
|
|
188
|
+
'{"id_token":{"email":null,"post_number":null,"twofa":null,"service_mask":null,"deactivate_account":null,"last_login":null,"customer_type":null,"display_name":null}}',
|
|
189
|
+
nonce: "",
|
|
190
|
+
login_hint: "",
|
|
191
|
+
prompt: "login",
|
|
192
|
+
ui_locales: "de-DE",
|
|
193
|
+
code_challenge: codeChallenge,
|
|
194
|
+
code_challenge_method: 'S256"',
|
|
195
|
+
},
|
|
196
|
+
headers: {
|
|
197
|
+
Host: "login.dhl.de",
|
|
198
|
+
Accept: "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
|
|
199
|
+
|
|
200
|
+
"User-Agent":
|
|
201
|
+
"Mozilla/5.0 (iPhone; CPU iPhone OS 14_8 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.1.2 Mobile/15E148 Safari/604.1",
|
|
202
|
+
"Accept-Language": "de-de",
|
|
203
|
+
Connection: "keep-alive",
|
|
204
|
+
},
|
|
205
|
+
})
|
|
206
|
+
.then(async (res) => {
|
|
207
|
+
// this.log.debug(res.data);
|
|
208
|
+
return res.request.path;
|
|
209
|
+
})
|
|
210
|
+
.catch((error) => {
|
|
211
|
+
this.log.error(error);
|
|
212
|
+
error.response && this.log.error(JSON.stringify(error.response.data));
|
|
213
|
+
});
|
|
214
|
+
const initParams = qs.parse(initUrl.split("?")[1]);
|
|
215
|
+
const signin = await this.requestClient({
|
|
216
|
+
method: "post",
|
|
217
|
+
maxBodyLength: Infinity,
|
|
218
|
+
url: "https://login-api.dhl.de/widget/traditional_signin.jsonp",
|
|
219
|
+
headers: {
|
|
220
|
+
Host: "login-api.dhl.de",
|
|
221
|
+
"Content-Type": "application/x-www-form-urlencoded",
|
|
222
|
+
Origin: "https://login.dhl.de",
|
|
223
|
+
Connection: "keep-alive",
|
|
224
|
+
Accept: "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
|
|
225
|
+
"User-Agent":
|
|
226
|
+
"Mozilla/5.0 (iPhone; CPU iPhone OS 14_8 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.1.2 Mobile/15E148 Safari/604.1",
|
|
227
|
+
Referer: "https://login.dhl.de/",
|
|
228
|
+
"Accept-Language": "de-de",
|
|
229
|
+
},
|
|
230
|
+
data: {
|
|
231
|
+
utf8: "✓",
|
|
232
|
+
capture_screen: "signIn",
|
|
233
|
+
js_version: "d445bf4",
|
|
234
|
+
capture_transactionId: transactionId,
|
|
235
|
+
form: "signInForm",
|
|
236
|
+
flow: "ciam_flow_001",
|
|
237
|
+
client_id: "f8s9584t9f9kz5wg9agkp259hc924uq9",
|
|
238
|
+
redirect_uri: "https://login.dhl.de" + initUrl,
|
|
239
|
+
response_type: "token",
|
|
240
|
+
flow_version: "20230309140056615616",
|
|
241
|
+
settings_version: "",
|
|
242
|
+
locale: "de-DE",
|
|
243
|
+
recaptchaVersion: "2",
|
|
244
|
+
emailOrPostNumber: this.config.dhlusername,
|
|
245
|
+
currentPassword: this.config.dhlpassword,
|
|
246
|
+
},
|
|
247
|
+
})
|
|
248
|
+
.then(async (res) => {
|
|
249
|
+
this.log.debug(res.data);
|
|
250
|
+
return true;
|
|
251
|
+
})
|
|
252
|
+
.catch((error) => {
|
|
253
|
+
this.log.error(error);
|
|
254
|
+
error.response && this.log.error(JSON.stringify(error.response.data));
|
|
255
|
+
});
|
|
256
|
+
if (!signin) {
|
|
257
|
+
this.log.error("DHL Signin failed");
|
|
258
|
+
return;
|
|
259
|
+
}
|
|
260
|
+
const preSession = await this.requestClient({
|
|
261
|
+
method: "get",
|
|
262
|
+
maxBodyLength: Infinity,
|
|
263
|
+
url: "https://login-api.dhl.de/widget/get_result.jsonp?transactionId=" + transactionId + "&cache=" + Date.now(),
|
|
264
|
+
headers: {
|
|
265
|
+
Host: "login-api.dhl.de",
|
|
266
|
+
Connection: "keep-alive",
|
|
267
|
+
Accept: "*/*",
|
|
268
|
+
"User-Agent":
|
|
269
|
+
"Mozilla/5.0 (iPhone; CPU iPhone OS 14_8 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.1.2 Mobile/15E148 Safari/604.1",
|
|
270
|
+
"Accept-Language": "de-de",
|
|
271
|
+
Referer: "https://login.dhl.de/",
|
|
272
|
+
},
|
|
273
|
+
})
|
|
274
|
+
.then(async (res) => {
|
|
275
|
+
this.log.debug(res.data);
|
|
276
|
+
return JSON.parse(res.data.split(")(")[1].split(");")[0]);
|
|
277
|
+
})
|
|
278
|
+
.catch((error) => {
|
|
279
|
+
this.log.error(error);
|
|
280
|
+
error.response && this.log.error(JSON.stringify(error.response.data));
|
|
281
|
+
});
|
|
282
|
+
const accessToken2 = await this.requestClient({
|
|
283
|
+
method: "post",
|
|
284
|
+
maxBodyLength: Infinity,
|
|
285
|
+
url: "https://login.dhl.de/af5f9bb6-27ad-4af4-9445-008e7a5cddb8/auth-ui/token-url",
|
|
286
|
+
params: {
|
|
287
|
+
__aic_csrf: initParams.__aic_csrf,
|
|
288
|
+
claims:
|
|
289
|
+
'{"id_token":{"customer_type":null,"deactivate_account":null,"display_name":null,"email":null,"last_login":null,"post_number":null,"service_mask":null,"twofa":null}}',
|
|
290
|
+
client_id: "83471082-5c13-4fce-8dcb-19d2a3fca413",
|
|
291
|
+
code_challenge: codeChallenge,
|
|
292
|
+
code_challenge_method: "S256",
|
|
293
|
+
login_hint: "",
|
|
294
|
+
nonce: "",
|
|
295
|
+
prompt: "login",
|
|
296
|
+
redirect_uri: "dhllogin://de.deutschepost.dhl/login",
|
|
297
|
+
response_type: "code",
|
|
298
|
+
scope: "openid",
|
|
299
|
+
state: "eyJycyI6dHJ1ZSwicnYiOmZhbHNlLCJmaWQiOiJhcHAtbG9naW4tbWVoci1mb290ZXIiLCJoaWQiOiJhcHAtbG9naW4tbWVoci1oZWFkZXIiLCJycCI6ZmFsc2V9",
|
|
300
|
+
ui_locales: 'de-DE",',
|
|
301
|
+
},
|
|
302
|
+
headers: {
|
|
303
|
+
Host: "login.dhl.de",
|
|
304
|
+
"Content-Type": "application/x-www-form-urlencoded",
|
|
305
|
+
Origin: "https://login.dhl.de",
|
|
306
|
+
Connection: "keep-alive",
|
|
307
|
+
Accept: "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
|
|
308
|
+
"User-Agent":
|
|
309
|
+
"Mozilla/5.0 (iPhone; CPU iPhone OS 14_8 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.1.2 Mobile/15E148 Safari/604.1",
|
|
310
|
+
"Accept-Language": "de-de",
|
|
311
|
+
},
|
|
312
|
+
data: {
|
|
313
|
+
screen: "signIn",
|
|
314
|
+
authenticated: "True",
|
|
315
|
+
registering: "False",
|
|
316
|
+
accessToken: preSession.result.accessToken,
|
|
317
|
+
_csrf_token: this.cookieJar.store.idx["login.dhl.de"]["/"]._csrf_token.value,
|
|
318
|
+
},
|
|
319
|
+
})
|
|
320
|
+
.then(async (res) => {
|
|
321
|
+
// this.log.debug(res.data);
|
|
322
|
+
|
|
323
|
+
return res.data.split("existingToken: '")[1].split("'")[0];
|
|
324
|
+
})
|
|
325
|
+
.catch((error) => {
|
|
326
|
+
this.log.error(error);
|
|
327
|
+
error.response && this.log.error(JSON.stringify(error.response.data));
|
|
328
|
+
});
|
|
329
|
+
const idtoken = await this.requestClient({
|
|
330
|
+
method: "post",
|
|
331
|
+
maxBodyLength: Infinity,
|
|
332
|
+
url: "https://login.dhl.de/af5f9bb6-27ad-4af4-9445-008e7a5cddb8/auth-ui/token-url",
|
|
333
|
+
maxRedirects: 0,
|
|
334
|
+
params: {
|
|
335
|
+
__aic_csrf: initParams.__aic_csrf,
|
|
336
|
+
claims:
|
|
337
|
+
'{"id_token":{"customer_type":null,"deactivate_account":null,"display_name":null,"email":null,"last_login":null,"post_number":null,"service_mask":null,"twofa":null}}',
|
|
338
|
+
client_id: "83471082-5c13-4fce-8dcb-19d2a3fca413",
|
|
339
|
+
code_challenge: codeChallenge,
|
|
340
|
+
code_challenge_method: "S256",
|
|
341
|
+
login_hint: "",
|
|
342
|
+
nonce: "",
|
|
343
|
+
prompt: "login",
|
|
344
|
+
redirect_uri: "dhllogin://de.deutschepost.dhl/login",
|
|
345
|
+
response_type: "code",
|
|
346
|
+
scope: "openid",
|
|
347
|
+
state: "eyJycyI6dHJ1ZSwicnYiOmZhbHNlLCJmaWQiOiJhcHAtbG9naW4tbWVoci1mb290ZXIiLCJoaWQiOiJhcHAtbG9naW4tbWVoci1oZWFkZXIiLCJycCI6ZmFsc2V9",
|
|
348
|
+
ui_locales: "de-DE",
|
|
349
|
+
},
|
|
350
|
+
headers: {
|
|
351
|
+
Host: "login.dhl.de",
|
|
352
|
+
"Content-Type": "application/x-www-form-urlencoded",
|
|
353
|
+
Origin: "https://login.dhl.de",
|
|
354
|
+
Connection: "keep-alive",
|
|
355
|
+
Accept: "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
|
|
356
|
+
"User-Agent":
|
|
357
|
+
"Mozilla/5.0 (iPhone; CPU iPhone OS 14_8 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.1.2 Mobile/15E148 Safari/604.1",
|
|
358
|
+
"Accept-Language": "de-de",
|
|
359
|
+
},
|
|
360
|
+
data: {
|
|
361
|
+
screen: "loginSuccess",
|
|
362
|
+
accessToken: accessToken2,
|
|
363
|
+
_csrf_token: this.cookieJar.store.idx["login.dhl.de"]["/"]._csrf_token.value,
|
|
364
|
+
},
|
|
365
|
+
})
|
|
366
|
+
.then(async (res) => {
|
|
367
|
+
this.log.debug(res.data);
|
|
368
|
+
return res.data;
|
|
369
|
+
})
|
|
370
|
+
.catch((error) => {
|
|
371
|
+
if (error.response && error.response.status === 302) {
|
|
372
|
+
return error.response.headers.location.split("id_token_hint=")[1].split("&")[0];
|
|
373
|
+
}
|
|
374
|
+
this.log.error(error);
|
|
375
|
+
error.response && this.log.error(JSON.stringify(error.response.data));
|
|
376
|
+
});
|
|
377
|
+
const codeUrl = await this.requestClient({
|
|
378
|
+
method: "get",
|
|
379
|
+
maxBodyLength: Infinity,
|
|
380
|
+
url:
|
|
381
|
+
'https://login.dhl.de/af5f9bb6-27ad-4af4-9445-008e7a5cddb8/login/authorize?claims={"id_token":{"customer_type":null,"deactivate_account":null,"display_name":null,"email":null,"last_login":null,"post_number":null,"service_mask":null,"twofa":null}}&client_id=83471082-5c13-4fce-8dcb-19d2a3fca413&code_challenge=' +
|
|
382
|
+
codeChallenge +
|
|
383
|
+
"&code_challenge_method=S256&prompt=none&redirect_uri=dhllogin://de.deutschepost.dhl/login&response_type=code&scope=openid&state=eyJycyI6dHJ1ZSwicnYiOmZhbHNlLCJmaWQiOiJhcHAtbG9naW4tbWVoci1mb290ZXIiLCJoaWQiOiJhcHAtbG9naW4tbWVoci1oZWFkZXIiLCJycCI6ZmFsc2V9&ui_locales=de-DE&id_token_hint=" +
|
|
384
|
+
idtoken,
|
|
385
|
+
})
|
|
386
|
+
.then(async (res) => {
|
|
387
|
+
this.log.debug(JSON.stringify(res.data));
|
|
388
|
+
})
|
|
389
|
+
.catch((error) => {
|
|
390
|
+
if (error.message.includes("Unsupported protocol")) {
|
|
391
|
+
return qs.parse(error.request._options.query);
|
|
392
|
+
}
|
|
393
|
+
this.log.error(error);
|
|
394
|
+
if (error.response) {
|
|
395
|
+
this.log.error(JSON.stringify(error.response.data));
|
|
396
|
+
}
|
|
397
|
+
});
|
|
398
|
+
await this.requestClient({
|
|
399
|
+
method: "post",
|
|
400
|
+
url: "https://login.dhl.de/af5f9bb6-27ad-4af4-9445-008e7a5cddb8/login/token",
|
|
401
|
+
headers: {
|
|
402
|
+
Host: "login.dhl.de",
|
|
403
|
+
"Content-Type": "application/x-www-form-urlencoded",
|
|
404
|
+
Accept: "application/json, text/plain, */*",
|
|
405
|
+
Origin: "https://login.dhl.de",
|
|
406
|
+
Connection: "keep-alive",
|
|
407
|
+
Authorization: "Basic ODM0NzEwODItNWMxMy00ZmNlLThkY2ItMTlkMmEzZmNhNDEzOg==",
|
|
408
|
+
"User-Agent": "DHLPaket_PROD/1367 CFNetwork/1240.0.4 Darwin/20.6.0",
|
|
409
|
+
"Accept-Language": "de-de",
|
|
410
|
+
},
|
|
411
|
+
data: {
|
|
412
|
+
redirect_uri: "dhllogin://de.deutschepost.dhl/login",
|
|
413
|
+
grant_type: "authorization_code",
|
|
414
|
+
code_verifier: code_verifier,
|
|
415
|
+
code: codeUrl.code,
|
|
416
|
+
},
|
|
417
|
+
})
|
|
418
|
+
.then(async (res) => {
|
|
419
|
+
this.log.debug(JSON.stringify(res.data));
|
|
420
|
+
this.log.info("Login to DHL successful");
|
|
421
|
+
this.sessions["dhl"] = res.data;
|
|
422
|
+
await this.cookieJar.setCookie("dhli=" + res.data.id_token + "; path=/; domain=dhl.de", "https:/dhl.de");
|
|
423
|
+
await this.cookieJar.setCookie("dhli=" + res.data.id_token + "; path=/; domain=www.dhl.de", "https:/www.dhl.de");
|
|
424
|
+
this.setState("info.connection", true, true);
|
|
425
|
+
this.setState("auth.cookie", JSON.stringify(this.cookieJar.toJSON()), true);
|
|
426
|
+
await this.createDHLStates();
|
|
427
|
+
return true;
|
|
428
|
+
})
|
|
429
|
+
.catch((error) => {
|
|
430
|
+
this.log.error(error);
|
|
431
|
+
if (error.response) {
|
|
432
|
+
this.log.error(JSON.stringify(error.response.data));
|
|
433
|
+
}
|
|
434
|
+
});
|
|
435
|
+
}
|
|
146
436
|
async loginDHL() {
|
|
147
437
|
const mfaTokenState = await this.getStateAsync("auth.dhlMfaToken");
|
|
148
438
|
await this.requestClient({
|
|
@@ -1715,6 +2005,7 @@ class Parcel extends utils.Adapter {
|
|
|
1715
2005
|
IN_TRANSIT: this.delivery_status.IN_TRANSIT,
|
|
1716
2006
|
OUT_FOR_DELIVERY: this.delivery_status.OUT_FOR_DELIVERY,
|
|
1717
2007
|
DELIVERED: this.delivery_status.DELIVERED,
|
|
2008
|
+
PICKED_UP: this.delivery_status.DELIVERED,
|
|
1718
2009
|
};
|
|
1719
2010
|
if (amz_status[sendung.detailedState.shortStatus] !== undefined) {
|
|
1720
2011
|
return amz_status[sendung.detailedState.shortStatus];
|
|
@@ -1799,7 +2090,7 @@ class Parcel extends utils.Adapter {
|
|
|
1799
2090
|
withCredentials: true,
|
|
1800
2091
|
})
|
|
1801
2092
|
.then(async (res) => {
|
|
1802
|
-
this.log.debug(JSON.stringify(res.data));
|
|
2093
|
+
// this.log.debug(JSON.stringify(res.data));
|
|
1803
2094
|
|
|
1804
2095
|
const dom = new JSDOM(res.data);
|
|
1805
2096
|
const document = dom.window.document;
|
|
@@ -1857,7 +2148,7 @@ class Parcel extends utils.Adapter {
|
|
|
1857
2148
|
},
|
|
1858
2149
|
})
|
|
1859
2150
|
.then(async (res) => {
|
|
1860
|
-
this.log.debug(JSON.stringify(res.data));
|
|
2151
|
+
// this.log.debug(JSON.stringify(res.data));
|
|
1861
2152
|
const dom = new JSDOM(res.data);
|
|
1862
2153
|
const document = dom.window.document;
|
|
1863
2154
|
const statusHandle =
|
|
@@ -1878,7 +2169,7 @@ class Parcel extends utils.Adapter {
|
|
|
1878
2169
|
stopsStatus = stateObject.mapTracking.calloutMessage;
|
|
1879
2170
|
}
|
|
1880
2171
|
} catch (error) {
|
|
1881
|
-
this.log.error(
|
|
2172
|
+
this.log.error(error);
|
|
1882
2173
|
}
|
|
1883
2174
|
}
|
|
1884
2175
|
|
|
@@ -2085,17 +2376,26 @@ class Parcel extends utils.Adapter {
|
|
|
2085
2376
|
|
|
2086
2377
|
return matches;
|
|
2087
2378
|
}
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
|
|
2098
|
-
|
|
2379
|
+
randomString(length) {
|
|
2380
|
+
let result = "";
|
|
2381
|
+
const characters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
|
2382
|
+
const charactersLength = characters.length;
|
|
2383
|
+
for (let i = 0; i < length; i++) {
|
|
2384
|
+
result += characters.charAt(Math.floor(Math.random() * charactersLength));
|
|
2385
|
+
}
|
|
2386
|
+
return result;
|
|
2387
|
+
}
|
|
2388
|
+
getCodeChallenge() {
|
|
2389
|
+
let hash = "";
|
|
2390
|
+
let result = "";
|
|
2391
|
+
const chars = "0123456789abcdef";
|
|
2392
|
+
result = "";
|
|
2393
|
+
for (let i = 64; i > 0; --i) result += chars[Math.floor(Math.random() * chars.length)];
|
|
2394
|
+
hash = crypto.createHash("sha256").update(result).digest("base64");
|
|
2395
|
+
hash = hash.replace(/\+/g, "-").replace(/\//g, "_").replace(/=/g, "");
|
|
2396
|
+
|
|
2397
|
+
return [result, hash];
|
|
2398
|
+
}
|
|
2099
2399
|
/**
|
|
2100
2400
|
* Is called when adapter shuts down - callback has to be called under any circumstances!
|
|
2101
2401
|
* @param {() => void} callback
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "iobroker.parcel",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.26",
|
|
4
4
|
"description": "Parcel tracking",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "TA2k",
|
|
@@ -25,12 +25,12 @@
|
|
|
25
25
|
"url": "https://github.com/TA2k/ioBroker.parcel"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@iobroker/adapter-core": "^2.6.
|
|
29
|
-
"axios": "^1.
|
|
28
|
+
"@iobroker/adapter-core": "^2.6.8",
|
|
29
|
+
"axios": "^1.3.5",
|
|
30
30
|
"http-cookie-agent": "^5.0.2",
|
|
31
|
-
"jsdom": "^
|
|
31
|
+
"jsdom": "^21.1.1",
|
|
32
32
|
"json-bigint": "^1.0.0",
|
|
33
|
-
"qs": "^6.11.
|
|
33
|
+
"qs": "^6.11.1",
|
|
34
34
|
"tough-cookie": "^4.1.2",
|
|
35
35
|
"uuid": "^9.0.0"
|
|
36
36
|
},
|
|
@@ -40,18 +40,18 @@
|
|
|
40
40
|
"@types/chai-as-promised": "^7.1.5",
|
|
41
41
|
"@types/gulp": "^4.0.10",
|
|
42
42
|
"@types/mocha": "^10.0.1",
|
|
43
|
-
"@types/node": "^18.11
|
|
43
|
+
"@types/node": "^18.15.11",
|
|
44
44
|
"@types/proxyquire": "^1.3.28",
|
|
45
45
|
"@types/sinon": "^10.0.13",
|
|
46
46
|
"@types/sinon-chai": "^3.2.9",
|
|
47
47
|
"chai": "^4.3.7",
|
|
48
48
|
"chai-as-promised": "^7.1.1",
|
|
49
|
-
"eslint": "^8.
|
|
49
|
+
"eslint": "^8.38.0",
|
|
50
50
|
"mocha": "^10.2.0",
|
|
51
51
|
"proxyquire": "^2.1.3",
|
|
52
|
-
"sinon": "^15.0.
|
|
52
|
+
"sinon": "^15.0.3",
|
|
53
53
|
"sinon-chai": "^3.7.0",
|
|
54
|
-
"typescript": "~
|
|
54
|
+
"typescript": "~5.0.4"
|
|
55
55
|
},
|
|
56
56
|
"main": "main.js",
|
|
57
57
|
"files": [
|