iobroker.parcel 0.2.7 → 0.2.8
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/LICENSE +1 -1
- package/README.md +6 -2
- package/admin/words.js +1 -0
- package/io-package.json +30 -60
- package/lib/dhldecrypt.js +0 -1
- package/lib/rsaKey.js +54 -53
- package/main.js +185 -55
- package/package.json +72 -64
package/LICENSE
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
MIT License
|
|
2
2
|
|
|
3
|
-
Copyright (c) 2022 TA2k <tombox2020@gmail.com>
|
|
3
|
+
Copyright (c) 2022-2030 TA2k <tombox2020@gmail.com>
|
|
4
4
|
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
package/README.md
CHANGED
|
@@ -62,14 +62,18 @@ Den Datenpunkt parcel.0.dhl.briefe....image ein "String img src" element als Obj
|
|
|
62
62
|
<https://forum.iobroker.net/topic/51795/test-adapter-parcel-paketverfolgung-dhl-v0-0-1>
|
|
63
63
|
|
|
64
64
|
## Changelog
|
|
65
|
+
### 0.2.8 (2024-10-18)
|
|
66
|
+
|
|
67
|
+
- fix amazon login
|
|
65
68
|
|
|
66
69
|
### 0.0.30
|
|
67
70
|
|
|
68
71
|
- Fix hermes login
|
|
69
|
-
|
|
72
|
+
|
|
70
73
|
### 0.0.25
|
|
71
74
|
|
|
72
75
|
- Fix amazon UI parsing
|
|
76
|
+
|
|
73
77
|
### 0.0.19
|
|
74
78
|
|
|
75
79
|
- Fix GLS Parcel
|
|
@@ -86,7 +90,7 @@ Den Datenpunkt parcel.0.dhl.briefe....image ein "String img src" element als Obj
|
|
|
86
90
|
|
|
87
91
|
MIT License
|
|
88
92
|
|
|
89
|
-
Copyright (c) 2022 TA2k <tombox2020@gmail.com>
|
|
93
|
+
Copyright (c) 2022-2030 TA2k <tombox2020@gmail.com>
|
|
90
94
|
|
|
91
95
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
92
96
|
of this software and associated documentation files (the "Software"), to deal
|
package/admin/words.js
CHANGED
package/io-package.json
CHANGED
|
@@ -1,8 +1,34 @@
|
|
|
1
1
|
{
|
|
2
2
|
"common": {
|
|
3
3
|
"name": "parcel",
|
|
4
|
-
"version": "0.2.
|
|
4
|
+
"version": "0.2.8",
|
|
5
5
|
"news": {
|
|
6
|
+
"0.2.8": {
|
|
7
|
+
"en": "fix amazon login",
|
|
8
|
+
"de": "fix amazon login",
|
|
9
|
+
"ru": "исправить логин амазон",
|
|
10
|
+
"pt": "corrigir amazon login",
|
|
11
|
+
"nl": "fix amazon login",
|
|
12
|
+
"fr": "correction de la connexion amazon",
|
|
13
|
+
"it": "fix amazon login",
|
|
14
|
+
"es": "fijar amazon login",
|
|
15
|
+
"pl": "naprawić logowanie amazon",
|
|
16
|
+
"uk": "виправити amazon увійти",
|
|
17
|
+
"zh-cn": "修补amazon 登录"
|
|
18
|
+
},
|
|
19
|
+
"0.2.8-beta.0": {
|
|
20
|
+
"en": "improve amazon login",
|
|
21
|
+
"de": "amazon login verbessern",
|
|
22
|
+
"ru": "улучшить логин amazon",
|
|
23
|
+
"pt": "melhorar o login amazon",
|
|
24
|
+
"nl": "amazon login verbeteren",
|
|
25
|
+
"fr": "améliorer la connexion amazon",
|
|
26
|
+
"it": "migliorare amazon login",
|
|
27
|
+
"es": "mejorar amazon login",
|
|
28
|
+
"pl": "poprawić logowanie amazon",
|
|
29
|
+
"uk": "поліпшити логін amazon",
|
|
30
|
+
"zh-cn": "改进amazon 登录"
|
|
31
|
+
},
|
|
6
32
|
"0.2.7": {
|
|
7
33
|
"en": "Fix for UPS Login",
|
|
8
34
|
"de": "Fix für UPS Login"
|
|
@@ -22,64 +48,6 @@
|
|
|
22
48
|
"0.1.6": {
|
|
23
49
|
"en": "Fix DHL and UPS",
|
|
24
50
|
"de": "DHL und UPS gefixt"
|
|
25
|
-
},
|
|
26
|
-
"0.1.5": {
|
|
27
|
-
"en": "Improve failed Amazon Login",
|
|
28
|
-
"de": "Verbesserter Amazon Login im Fehlerfall"
|
|
29
|
-
},
|
|
30
|
-
"0.1.2": {
|
|
31
|
-
"en": "Fix Amazon Status",
|
|
32
|
-
"de": "Amazon Status gefixt"
|
|
33
|
-
},
|
|
34
|
-
"0.1.1": {
|
|
35
|
-
"en": "Fix State creating warnings",
|
|
36
|
-
"de": "Warnung beim erstellen von Objekten behoben"
|
|
37
|
-
},
|
|
38
|
-
"0.1.0": {
|
|
39
|
-
"en": "Fix Hermes login"
|
|
40
|
-
},
|
|
41
|
-
"0.0.32": {
|
|
42
|
-
"en": "Fix Amazon relogin"
|
|
43
|
-
},
|
|
44
|
-
"0.0.30": {
|
|
45
|
-
"en": "Fix Hermes Login"
|
|
46
|
-
},
|
|
47
|
-
"0.0.28": {
|
|
48
|
-
"en": "Fix Amazon Login"
|
|
49
|
-
},
|
|
50
|
-
"0.0.27": {
|
|
51
|
-
"en": "Fix DHL Refresh token",
|
|
52
|
-
"de": "DHL Refresh token gefixt"
|
|
53
|
-
},
|
|
54
|
-
"0.0.26": {
|
|
55
|
-
"en": "Fix DHL Login",
|
|
56
|
-
"de": "DHL Login gefixt"
|
|
57
|
-
},
|
|
58
|
-
"0.0.25": {
|
|
59
|
-
"en": "Fix new Amazon UI parsing",
|
|
60
|
-
"de": "Neues Amazon UI parsing gefixt"
|
|
61
|
-
},
|
|
62
|
-
"0.0.23": {
|
|
63
|
-
"en": "Disable Pictures of Briefankündigung",
|
|
64
|
-
"de": "Bilder der Briefankündigung deaktiviert"
|
|
65
|
-
},
|
|
66
|
-
"0.0.22": {
|
|
67
|
-
"en": "Fix Amazon Login"
|
|
68
|
-
},
|
|
69
|
-
"0.0.21": {
|
|
70
|
-
"en": "Fix Brief images and pushover user"
|
|
71
|
-
},
|
|
72
|
-
"0.0.20": {
|
|
73
|
-
"en": "Fix GLS Parcel"
|
|
74
|
-
},
|
|
75
|
-
"0.0.18": {
|
|
76
|
-
"en": "Fix UPS/GLS login"
|
|
77
|
-
},
|
|
78
|
-
"0.0.15": {
|
|
79
|
-
"en": "Fix DPD states and remove canvas dependency"
|
|
80
|
-
},
|
|
81
|
-
"0.0.13": {
|
|
82
|
-
"en": "Fix Amazon delivery state, add telegram user"
|
|
83
51
|
}
|
|
84
52
|
},
|
|
85
53
|
"title": "Parcel tracking",
|
|
@@ -107,7 +75,9 @@
|
|
|
107
75
|
"pl": "Śledzenie przesyłek",
|
|
108
76
|
"zh-cn": "包裹追踪"
|
|
109
77
|
},
|
|
110
|
-
"authors": [
|
|
78
|
+
"authors": [
|
|
79
|
+
"TA2k <tombox2020@gmail.com>"
|
|
80
|
+
],
|
|
111
81
|
"keywords": [
|
|
112
82
|
"parcel",
|
|
113
83
|
"tracking",
|
package/lib/dhldecrypt.js
CHANGED
package/lib/rsaKey.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
1
2
|
const crypto = require('crypto');
|
|
2
3
|
const RSAKey = (function () {
|
|
3
4
|
function a(a, b, c) {
|
|
@@ -13,14 +14,14 @@ const RSAKey = (function () {
|
|
|
13
14
|
}
|
|
14
15
|
function c(a, b, c, d, e, f) {
|
|
15
16
|
for (; --f >= 0; ) {
|
|
16
|
-
|
|
17
|
+
const g = b * this[a++] + c[d] + e;
|
|
17
18
|
(e = Math.floor(g / 67108864)), (c[d++] = 67108863 & g);
|
|
18
19
|
}
|
|
19
20
|
return e;
|
|
20
21
|
}
|
|
21
22
|
function d(a, b, c, d, e, f) {
|
|
22
|
-
for (
|
|
23
|
-
|
|
23
|
+
for (let g = 32767 & b, h = b >> 15; --f >= 0; ) {
|
|
24
|
+
let i = 32767 & this[a],
|
|
24
25
|
j = this[a++] >> 15,
|
|
25
26
|
k = h * i + j * g;
|
|
26
27
|
(i = g * i + ((32767 & k) << 15) + c[d] + (1073741823 & e)),
|
|
@@ -30,8 +31,8 @@ const RSAKey = (function () {
|
|
|
30
31
|
return e;
|
|
31
32
|
}
|
|
32
33
|
function e(a, b, c, d, e, f) {
|
|
33
|
-
for (
|
|
34
|
-
|
|
34
|
+
for (let g = 16383 & b, h = b >> 14; --f >= 0; ) {
|
|
35
|
+
let i = 16383 & this[a],
|
|
35
36
|
j = this[a++] >> 14,
|
|
36
37
|
k = h * i + j * g;
|
|
37
38
|
(i = g * i + ((16383 & k) << 14) + c[d] + e), (e = (i >> 28) + (k >> 14) + h * j), (c[d++] = 268435455 & i);
|
|
@@ -42,22 +43,22 @@ const RSAKey = (function () {
|
|
|
42
43
|
return ka.charAt(a);
|
|
43
44
|
}
|
|
44
45
|
function g(a, b) {
|
|
45
|
-
|
|
46
|
+
const c = la[a.charCodeAt(b)];
|
|
46
47
|
return null == c ? -1 : c;
|
|
47
48
|
}
|
|
48
49
|
function h(a) {
|
|
49
|
-
for (
|
|
50
|
+
for (let b = this.t - 1; b >= 0; --b) a[b] = this[b];
|
|
50
51
|
(a.t = this.t), (a.s = this.s);
|
|
51
52
|
}
|
|
52
53
|
function i(a) {
|
|
53
54
|
(this.t = 1), (this.s = 0 > a ? -1 : 0), a > 0 ? (this[0] = a) : -1 > a ? (this[0] = a + this.DV) : (this.t = 0);
|
|
54
55
|
}
|
|
55
56
|
function j(a) {
|
|
56
|
-
|
|
57
|
+
const c = b();
|
|
57
58
|
return c.fromInt(a), c;
|
|
58
59
|
}
|
|
59
60
|
function k(b, c) {
|
|
60
|
-
|
|
61
|
+
let d;
|
|
61
62
|
if (16 == c) d = 4;
|
|
62
63
|
else if (8 == c) d = 3;
|
|
63
64
|
else if (256 == c) d = 8;
|
|
@@ -69,7 +70,7 @@ const RSAKey = (function () {
|
|
|
69
70
|
}
|
|
70
71
|
(this.t = 0), (this.s = 0);
|
|
71
72
|
for (var e = b.length, f = !1, h = 0; --e >= 0; ) {
|
|
72
|
-
|
|
73
|
+
const i = 8 == d ? 255 & b[e] : g(b, e);
|
|
73
74
|
0 > i
|
|
74
75
|
? '-' == b.charAt(e) && (f = !0)
|
|
75
76
|
: ((f = !1),
|
|
@@ -86,11 +87,11 @@ const RSAKey = (function () {
|
|
|
86
87
|
f && a.ZERO.subTo(this, this);
|
|
87
88
|
}
|
|
88
89
|
function l() {
|
|
89
|
-
for (
|
|
90
|
+
for (let a = this.s & this.DM; this.t > 0 && this[this.t - 1] == a; ) --this.t;
|
|
90
91
|
}
|
|
91
92
|
function m(a) {
|
|
92
93
|
if (this.s < 0) return '-' + this.negate().toString(a);
|
|
93
|
-
|
|
94
|
+
let b;
|
|
94
95
|
if (16 == a) b = 4;
|
|
95
96
|
else if (8 == a) b = 3;
|
|
96
97
|
else if (2 == a) b = 1;
|
|
@@ -99,7 +100,7 @@ const RSAKey = (function () {
|
|
|
99
100
|
if (4 != a) return this.toRadix(a);
|
|
100
101
|
b = 2;
|
|
101
102
|
}
|
|
102
|
-
|
|
103
|
+
let c,
|
|
103
104
|
d = (1 << b) - 1,
|
|
104
105
|
e = !1,
|
|
105
106
|
g = '',
|
|
@@ -115,22 +116,22 @@ const RSAKey = (function () {
|
|
|
115
116
|
return e ? g : '0';
|
|
116
117
|
}
|
|
117
118
|
function n() {
|
|
118
|
-
|
|
119
|
+
const c = b();
|
|
119
120
|
return a.ZERO.subTo(this, c), c;
|
|
120
121
|
}
|
|
121
122
|
function o() {
|
|
122
123
|
return this.s < 0 ? this.negate() : this;
|
|
123
124
|
}
|
|
124
125
|
function p(a) {
|
|
125
|
-
|
|
126
|
+
let b = this.s - a.s;
|
|
126
127
|
if (0 != b) return b;
|
|
127
|
-
|
|
128
|
+
let c = this.t;
|
|
128
129
|
if (((b = c - a.t), 0 != b)) return this.s < 0 ? -b : b;
|
|
129
130
|
for (; --c >= 0; ) if (0 != (b = this[c] - a[c])) return b;
|
|
130
131
|
return 0;
|
|
131
132
|
}
|
|
132
133
|
function q(a) {
|
|
133
|
-
|
|
134
|
+
let b,
|
|
134
135
|
c = 1;
|
|
135
136
|
return (
|
|
136
137
|
0 != (b = a >>> 16) && ((a = b), (c += 16)),
|
|
@@ -145,17 +146,17 @@ const RSAKey = (function () {
|
|
|
145
146
|
return this.t <= 0 ? 0 : this.DB * (this.t - 1) + q(this[this.t - 1] ^ (this.s & this.DM));
|
|
146
147
|
}
|
|
147
148
|
function s(a, b) {
|
|
148
|
-
|
|
149
|
+
let c;
|
|
149
150
|
for (c = this.t - 1; c >= 0; --c) b[c + a] = this[c];
|
|
150
151
|
for (c = a - 1; c >= 0; --c) b[c] = 0;
|
|
151
152
|
(b.t = this.t + a), (b.s = this.s);
|
|
152
153
|
}
|
|
153
154
|
function t(a, b) {
|
|
154
|
-
for (
|
|
155
|
+
for (let c = a; c < this.t; ++c) b[c - a] = this[c];
|
|
155
156
|
(b.t = Math.max(this.t - a, 0)), (b.s = this.s);
|
|
156
157
|
}
|
|
157
158
|
function u(a, b) {
|
|
158
|
-
|
|
159
|
+
let c,
|
|
159
160
|
d = a % this.DB,
|
|
160
161
|
e = this.DB - d,
|
|
161
162
|
f = (1 << e) - 1,
|
|
@@ -167,13 +168,13 @@ const RSAKey = (function () {
|
|
|
167
168
|
}
|
|
168
169
|
function v(a, b) {
|
|
169
170
|
b.s = this.s;
|
|
170
|
-
|
|
171
|
+
const c = Math.floor(a / this.DB);
|
|
171
172
|
if (c >= this.t) return void (b.t = 0);
|
|
172
|
-
|
|
173
|
+
const d = a % this.DB,
|
|
173
174
|
e = this.DB - d,
|
|
174
175
|
f = (1 << d) - 1;
|
|
175
176
|
b[0] = this[c] >> d;
|
|
176
|
-
for (
|
|
177
|
+
for (let g = c + 1; g < this.t; ++g) (b[g - c - 1] |= (this[g] & f) << e), (b[g - c] = this[g] >> d);
|
|
177
178
|
d > 0 && (b[this.t - c - 1] |= (this.s & f) << e), (b.t = this.t - c), b.clamp();
|
|
178
179
|
}
|
|
179
180
|
function w(a, b) {
|
|
@@ -188,7 +189,7 @@ const RSAKey = (function () {
|
|
|
188
189
|
(b.s = 0 > d ? -1 : 0), -1 > d ? (b[c++] = this.DV + d) : d > 0 && (b[c++] = d), (b.t = c), b.clamp();
|
|
189
190
|
}
|
|
190
191
|
function x(b, c) {
|
|
191
|
-
|
|
192
|
+
let d = this.abs(),
|
|
192
193
|
e = b.abs(),
|
|
193
194
|
f = d.t;
|
|
194
195
|
for (c.t = f + e.t; --f >= 0; ) c[f] = 0;
|
|
@@ -198,26 +199,26 @@ const RSAKey = (function () {
|
|
|
198
199
|
function y(a) {
|
|
199
200
|
for (var b = this.abs(), c = (a.t = 2 * b.t); --c >= 0; ) a[c] = 0;
|
|
200
201
|
for (c = 0; c < b.t - 1; ++c) {
|
|
201
|
-
|
|
202
|
+
const d = b.am(c, b[c], a, 2 * c, 0, 1);
|
|
202
203
|
(a[c + b.t] += b.am(c + 1, 2 * b[c], a, 2 * c + 1, d, b.t - c - 1)) >= b.DV && ((a[c + b.t] -= b.DV), (a[c + b.t + 1] = 1));
|
|
203
204
|
}
|
|
204
205
|
a.t > 0 && (a[a.t - 1] += b.am(c, b[c], a, 2 * c, 0, 1)), (a.s = 0), a.clamp();
|
|
205
206
|
}
|
|
206
207
|
function z(c, d, e) {
|
|
207
|
-
|
|
208
|
+
const f = c.abs();
|
|
208
209
|
if (!(f.t <= 0)) {
|
|
209
|
-
|
|
210
|
+
const g = this.abs();
|
|
210
211
|
if (g.t < f.t) return null != d && d.fromInt(0), void (null != e && this.copyTo(e));
|
|
211
212
|
null == e && (e = b());
|
|
212
|
-
|
|
213
|
+
const h = b(),
|
|
213
214
|
i = this.s,
|
|
214
215
|
j = c.s,
|
|
215
216
|
k = this.DB - q(f[f.t - 1]);
|
|
216
217
|
k > 0 ? (f.lShiftTo(k, h), g.lShiftTo(k, e)) : (f.copyTo(h), g.copyTo(e));
|
|
217
|
-
|
|
218
|
+
const l = h.t,
|
|
218
219
|
m = h[l - 1];
|
|
219
220
|
if (0 != m) {
|
|
220
|
-
|
|
221
|
+
let n = m * (1 << this.F1) + (l > 1 ? h[l - 2] >> this.F2 : 0),
|
|
221
222
|
o = this.FV / n,
|
|
222
223
|
p = (1 << this.F1) / n,
|
|
223
224
|
r = 1 << this.F2,
|
|
@@ -227,7 +228,7 @@ const RSAKey = (function () {
|
|
|
227
228
|
for (h.dlShiftTo(t, u), e.compareTo(u) >= 0 && ((e[e.t++] = 1), e.subTo(u, e)), a.ONE.dlShiftTo(l, u), u.subTo(h, h); h.t < l; )
|
|
228
229
|
h[h.t++] = 0;
|
|
229
230
|
for (; --t >= 0; ) {
|
|
230
|
-
|
|
231
|
+
let v = e[--s] == m ? this.DM : Math.floor(e[s] * o + (e[s - 1] + r) * p);
|
|
231
232
|
if ((e[s] += h.am(0, v, e, t, 0, l)) < v) for (h.dlShiftTo(t, u), e.subTo(u, e); e[s] < --v; ) e.subTo(u, e);
|
|
232
233
|
}
|
|
233
234
|
null != d && (e.drShiftTo(l, d), i != j && a.ZERO.subTo(d, d)),
|
|
@@ -239,7 +240,7 @@ const RSAKey = (function () {
|
|
|
239
240
|
}
|
|
240
241
|
}
|
|
241
242
|
function A(c) {
|
|
242
|
-
|
|
243
|
+
const d = b();
|
|
243
244
|
return this.abs().divRemTo(c, null, d), this.s < 0 && d.compareTo(a.ZERO) > 0 && c.subTo(d, d), d;
|
|
244
245
|
}
|
|
245
246
|
function B(a) {
|
|
@@ -262,9 +263,9 @@ const RSAKey = (function () {
|
|
|
262
263
|
}
|
|
263
264
|
function H() {
|
|
264
265
|
if (this.t < 1) return 0;
|
|
265
|
-
|
|
266
|
+
const a = this[0];
|
|
266
267
|
if (0 == (1 & a)) return 0;
|
|
267
|
-
|
|
268
|
+
let b = 3 & a;
|
|
268
269
|
return (
|
|
269
270
|
(b = (b * (2 - (15 & a) * b)) & 15),
|
|
270
271
|
(b = (b * (2 - (255 & a) * b)) & 255),
|
|
@@ -282,17 +283,17 @@ const RSAKey = (function () {
|
|
|
282
283
|
(this.mt2 = 2 * a.t);
|
|
283
284
|
}
|
|
284
285
|
function J(c) {
|
|
285
|
-
|
|
286
|
+
const d = b();
|
|
286
287
|
return c.abs().dlShiftTo(this.m.t, d), d.divRemTo(this.m, null, d), c.s < 0 && d.compareTo(a.ZERO) > 0 && this.m.subTo(d, d), d;
|
|
287
288
|
}
|
|
288
289
|
function K(a) {
|
|
289
|
-
|
|
290
|
+
const c = b();
|
|
290
291
|
return a.copyTo(c), this.reduce(c), c;
|
|
291
292
|
}
|
|
292
293
|
function L(a) {
|
|
293
294
|
for (; a.t <= this.mt2; ) a[a.t++] = 0;
|
|
294
|
-
for (
|
|
295
|
-
|
|
295
|
+
for (let b = 0; b < this.m.t; ++b) {
|
|
296
|
+
let c = 32767 & a[b],
|
|
296
297
|
d = (c * this.mpl + (((c * this.mph + (a[b] >> 15) * this.mpl) & this.um) << 15)) & a.DM;
|
|
297
298
|
for (c = b + this.m.t, a[c] += this.m.am(0, d, a, b, 0, this.m.t); a[c] >= a.DV; ) (a[c] -= a.DV), a[++c]++;
|
|
298
299
|
}
|
|
@@ -309,34 +310,34 @@ const RSAKey = (function () {
|
|
|
309
310
|
}
|
|
310
311
|
function P(c, d) {
|
|
311
312
|
if (c > 4294967295 || 1 > c) return a.ONE;
|
|
312
|
-
|
|
313
|
+
let e = b(),
|
|
313
314
|
f = b(),
|
|
314
315
|
g = d.convert(this),
|
|
315
316
|
h = q(c) - 1;
|
|
316
317
|
for (g.copyTo(e); --h >= 0; )
|
|
317
318
|
if ((d.sqrTo(e, f), (c & (1 << h)) > 0)) d.mulTo(f, g, e);
|
|
318
319
|
else {
|
|
319
|
-
|
|
320
|
+
const i = e;
|
|
320
321
|
(e = f), (f = i);
|
|
321
322
|
}
|
|
322
323
|
return d.revert(e);
|
|
323
324
|
}
|
|
324
325
|
function Q(a, b) {
|
|
325
|
-
|
|
326
|
+
let c;
|
|
326
327
|
return (c = 256 > a || b.isEven() ? new B(b) : new I(b)), this.exp(a, c);
|
|
327
328
|
}
|
|
328
329
|
function R() {
|
|
329
330
|
(this.i = 0), (this.j = 0), (this.S = new Array());
|
|
330
331
|
}
|
|
331
332
|
function S(a) {
|
|
332
|
-
|
|
333
|
+
let b, c, d;
|
|
333
334
|
for (b = 0; 256 > b; ++b) this.S[b] = b;
|
|
334
335
|
for (c = 0, b = 0; 256 > b; ++b)
|
|
335
336
|
(c = (c + this.S[b] + a[b % a.length]) & 255), (d = this.S[b]), (this.S[b] = this.S[c]), (this.S[c] = d);
|
|
336
337
|
(this.i = 0), (this.j = 0);
|
|
337
338
|
}
|
|
338
339
|
function T() {
|
|
339
|
-
|
|
340
|
+
let a;
|
|
340
341
|
return (
|
|
341
342
|
(this.i = (this.i + 1) & 255),
|
|
342
343
|
(this.j = (this.j + this.S[this.i]) & 255),
|
|
@@ -367,7 +368,7 @@ const RSAKey = (function () {
|
|
|
367
368
|
return ma.next();
|
|
368
369
|
}
|
|
369
370
|
function Y(a) {
|
|
370
|
-
|
|
371
|
+
let b;
|
|
371
372
|
for (b = 0; b < a.length; ++b) a[b] = X();
|
|
372
373
|
}
|
|
373
374
|
function Z() {}
|
|
@@ -377,7 +378,7 @@ const RSAKey = (function () {
|
|
|
377
378
|
function _(b, c) {
|
|
378
379
|
if (c < b.length + 11) return alert('Message too long for RSA'), null;
|
|
379
380
|
for (var d = new Array(), e = b.length - 1; e >= 0 && c > 0; ) {
|
|
380
|
-
|
|
381
|
+
const f = b.charCodeAt(e--);
|
|
381
382
|
128 > f
|
|
382
383
|
? (d[--c] = f)
|
|
383
384
|
: f > 127 && 2048 > f
|
|
@@ -385,7 +386,7 @@ const RSAKey = (function () {
|
|
|
385
386
|
: ((d[--c] = (63 & f) | 128), (d[--c] = ((f >> 6) & 63) | 128), (d[--c] = (f >> 12) | 224));
|
|
386
387
|
}
|
|
387
388
|
d[--c] = 0;
|
|
388
|
-
for (
|
|
389
|
+
for (let g = new Z(), h = new Array(); c > 2; ) {
|
|
389
390
|
for (h[0] = 0; 0 == h[0]; ) g.nextBytes(h);
|
|
390
391
|
d[--c] = h[0];
|
|
391
392
|
}
|
|
@@ -410,18 +411,18 @@ const RSAKey = (function () {
|
|
|
410
411
|
return a.modPowInt(this.e, this.n);
|
|
411
412
|
}
|
|
412
413
|
function da(a) {
|
|
413
|
-
|
|
414
|
+
const b = _(a, (this.n.bitLength() + 7) >> 3);
|
|
414
415
|
if (null == b) return null;
|
|
415
|
-
|
|
416
|
+
const c = this.doPublic(b);
|
|
416
417
|
if (null == c) return null;
|
|
417
|
-
|
|
418
|
+
const d = c.toString(16);
|
|
418
419
|
return 0 == (1 & d.length) ? d : '0' + d;
|
|
419
420
|
}
|
|
420
|
-
|
|
421
|
+
let ea,
|
|
421
422
|
fa = 0xdeadbeefcafe,
|
|
422
423
|
ga = 15715070 == (16777215 & fa);
|
|
423
424
|
(a.prototype.am = e), (ea = 28), (a.prototype.DB = ea), (a.prototype.DM = (1 << ea) - 1), (a.prototype.DV = 1 << ea);
|
|
424
|
-
|
|
425
|
+
const ha = 52;
|
|
425
426
|
(a.prototype.FV = Math.pow(2, ha)), (a.prototype.F1 = ha - ea), (a.prototype.F2 = 2 * ea - ha);
|
|
426
427
|
var ia,
|
|
427
428
|
ja,
|
|
@@ -472,9 +473,9 @@ const RSAKey = (function () {
|
|
|
472
473
|
pa = 256;
|
|
473
474
|
if (null == na) {
|
|
474
475
|
(na = new Array()), (oa = 0);
|
|
475
|
-
|
|
476
|
+
let qa;
|
|
476
477
|
if (crypto && crypto.getRandomValues) {
|
|
477
|
-
|
|
478
|
+
const ra = new Uint8Array(32);
|
|
478
479
|
for (crypto.getRandomValues(ra), qa = 0; 32 > qa; ++qa) na[oa++] = ra[qa];
|
|
479
480
|
}
|
|
480
481
|
|
package/main.js
CHANGED
|
@@ -7,16 +7,6 @@
|
|
|
7
7
|
// The adapter-core module gives you access to the core ioBroker functions
|
|
8
8
|
// you need to create an adapter
|
|
9
9
|
|
|
10
|
-
//disable canvas because of missing rebuild
|
|
11
|
-
const Module = require('module');
|
|
12
|
-
const originalRequire = Module.prototype.require;
|
|
13
|
-
Module.prototype.require = function () {
|
|
14
|
-
if (arguments[0] === 'canvas') {
|
|
15
|
-
return { createCanvas: null, createImageData: null, loadImage: null };
|
|
16
|
-
}
|
|
17
|
-
return originalRequire.apply(this, arguments);
|
|
18
|
-
};
|
|
19
|
-
|
|
20
10
|
const utils = require('@iobroker/adapter-core');
|
|
21
11
|
const axios = require('axios').default;
|
|
22
12
|
const qs = require('qs');
|
|
@@ -88,6 +78,10 @@ class Parcel extends utils.Adapter {
|
|
|
88
78
|
withCredentials: true,
|
|
89
79
|
httpsAgent: new HttpsCookieAgent({ cookies: { jar: this.cookieJar } }),
|
|
90
80
|
});
|
|
81
|
+
if (this.config.amzusername && this.config.amzpassword) {
|
|
82
|
+
this.log.info('Login to Amazon');
|
|
83
|
+
await this.loginAmz();
|
|
84
|
+
}
|
|
91
85
|
|
|
92
86
|
if (this.config.dhlusername && this.config.dhlpassword) {
|
|
93
87
|
this.log.info('Login to DHL');
|
|
@@ -112,10 +106,6 @@ class Parcel extends utils.Adapter {
|
|
|
112
106
|
this.login17TApi();
|
|
113
107
|
this.setState('info.connection', true, true);
|
|
114
108
|
}
|
|
115
|
-
if (this.config.amzusername && this.config.amzpassword) {
|
|
116
|
-
this.log.info('Login to Amazon');
|
|
117
|
-
await this.loginAmz();
|
|
118
|
-
}
|
|
119
109
|
|
|
120
110
|
if (this.config.glsusername && this.config.glspassword) {
|
|
121
111
|
this.log.info('Login to GLS');
|
|
@@ -183,7 +173,8 @@ class Parcel extends utils.Adapter {
|
|
|
183
173
|
url: 'https://login.dhl.de/af5f9bb6-27ad-4af4-9445-008e7a5cddb8/login/authorize',
|
|
184
174
|
params: {
|
|
185
175
|
redirect_uri: 'dhllogin://de.deutschepost.dhl/login',
|
|
186
|
-
state:
|
|
176
|
+
state:
|
|
177
|
+
'eyJycyI6dHJ1ZSwicnYiOmZhbHNlLCJmaWQiOiJhcHAtbG9naW4tbWVoci1mb290ZXIiLCJoaWQiOiJhcHAtbG9naW4tbWVoci1oZWFkZXIiLCJycCI6ZmFsc2V9',
|
|
187
178
|
client_id: '83471082-5c13-4fce-8dcb-19d2a3fca413',
|
|
188
179
|
response_type: 'code',
|
|
189
180
|
scope: 'openid offline_access',
|
|
@@ -303,7 +294,8 @@ class Parcel extends utils.Adapter {
|
|
|
303
294
|
redirect_uri: 'dhllogin://de.deutschepost.dhl/login',
|
|
304
295
|
response_type: 'code',
|
|
305
296
|
scope: 'openid',
|
|
306
|
-
state:
|
|
297
|
+
state:
|
|
298
|
+
'eyJycyI6dHJ1ZSwicnYiOmZhbHNlLCJmaWQiOiJhcHAtbG9naW4tbWVoci1mb290ZXIiLCJoaWQiOiJhcHAtbG9naW4tbWVoci1oZWFkZXIiLCJycCI6ZmFsc2V9',
|
|
307
299
|
ui_locales: 'de-DE",',
|
|
308
300
|
},
|
|
309
301
|
headers: {
|
|
@@ -351,7 +343,8 @@ class Parcel extends utils.Adapter {
|
|
|
351
343
|
redirect_uri: 'dhllogin://de.deutschepost.dhl/login',
|
|
352
344
|
response_type: 'code',
|
|
353
345
|
scope: 'openid',
|
|
354
|
-
state:
|
|
346
|
+
state:
|
|
347
|
+
'eyJycyI6dHJ1ZSwicnYiOmZhbHNlLCJmaWQiOiJhcHAtbG9naW4tbWVoci1mb290ZXIiLCJoaWQiOiJhcHAtbG9naW4tbWVoci1oZWFkZXIiLCJycCI6ZmFsc2V9',
|
|
355
348
|
ui_locales: 'de-DE',
|
|
356
349
|
},
|
|
357
350
|
headers: {
|
|
@@ -609,7 +602,8 @@ class Parcel extends utils.Adapter {
|
|
|
609
602
|
'sec-ch-ua-mobile': '?0',
|
|
610
603
|
'sec-ch-ua-platform': '"macOS"',
|
|
611
604
|
'upgrade-insecure-requests': '1',
|
|
612
|
-
'user-agent':
|
|
605
|
+
'user-agent':
|
|
606
|
+
'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',
|
|
613
607
|
accept:
|
|
614
608
|
'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',
|
|
615
609
|
'sec-fetch-site': 'same-site',
|
|
@@ -653,7 +647,8 @@ class Parcel extends utils.Adapter {
|
|
|
653
647
|
accept: 'application/json, text/plain, */*',
|
|
654
648
|
'content-type': 'application/x-www-form-urlencoded',
|
|
655
649
|
'sec-ch-ua-mobile': '?0',
|
|
656
|
-
'user-agent':
|
|
650
|
+
'user-agent':
|
|
651
|
+
'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
652
|
'sec-ch-ua-platform': '"macOS"',
|
|
658
653
|
origin: 'https://login.aliexpress.com',
|
|
659
654
|
'sec-fetch-site': 'same-site',
|
|
@@ -683,7 +678,9 @@ class Parcel extends utils.Adapter {
|
|
|
683
678
|
})
|
|
684
679
|
.then(async (res) => {
|
|
685
680
|
// this.log.debug(JSON.stringify(res.data));
|
|
686
|
-
res.data.indexOf('Session has expired') !== -1
|
|
681
|
+
res.data.indexOf('Session has expired') !== -1
|
|
682
|
+
? this.log.error('Session has expired')
|
|
683
|
+
: this.log.info('Login to Aliexpress successful');
|
|
687
684
|
})
|
|
688
685
|
.catch(async (error) => {
|
|
689
686
|
error.response && this.log.error(JSON.stringify(error.response.data));
|
|
@@ -763,11 +760,16 @@ class Parcel extends utils.Adapter {
|
|
|
763
760
|
});
|
|
764
761
|
let body = await this.requestClient({
|
|
765
762
|
method: 'get',
|
|
763
|
+
maxBodyLength: Infinity,
|
|
766
764
|
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',
|
|
767
765
|
headers: {
|
|
768
|
-
accept: '
|
|
769
|
-
'
|
|
770
|
-
'
|
|
766
|
+
accept: 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
|
|
767
|
+
'accept-charset': 'utf-8',
|
|
768
|
+
'sec-fetch-site': 'none',
|
|
769
|
+
'accept-language': 'en-US',
|
|
770
|
+
'cache-control': 'no-store',
|
|
771
|
+
'sec-fetch-mode': 'navigate',
|
|
772
|
+
'user-agent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 16_7_7 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148',
|
|
771
773
|
},
|
|
772
774
|
})
|
|
773
775
|
.then(async (res) => {
|
|
@@ -777,31 +779,77 @@ class Parcel extends utils.Adapter {
|
|
|
777
779
|
.catch((error) => {
|
|
778
780
|
this.log.error('Amazon first login step failed');
|
|
779
781
|
this.log.error(
|
|
780
|
-
'https://www.amazon.de/ap/signin?
|
|
782
|
+
'https://www.amazon.de/ap/signin?openid.return_to=https://www.amazon.de/ap/maplanding&openid.oa2.code_challenge_method=S256&openid.assoc_handle=amzn_mshop_ios_v2_de&openid.identity=http://specs.openid.net/auth/2.0/identifier_select&pageId=amzn_mshop_ios_v2_de&openid.ns.oa2=http://www.amazon.com/ap/ext/oauth/2&openid.claimed_id=http://specs.openid.net/auth/2.0/identifier_select&openid.mode=checkid_setup&openid.oa2.client_id=device:42334146314239333737364334463941393135443746313136363446434238302341334e5748585451344542435a53&openid.oa2.code_challenge=ig2YgHP3AoncuKG0ks5pgr1HUhzwvlST-tuIY2Chi2M&openid.ns.pape=http://specs.openid.net/extensions/pape/1.0&openid.oa2.scope=device_auth_access&openid.ns=http://specs.openid.net/auth/2.0&openid.pape.max_auth_age=0&openid.oa2.response_type=code',
|
|
781
783
|
);
|
|
782
784
|
this.log.error(error);
|
|
783
785
|
if (error.response) {
|
|
784
786
|
this.log.error(JSON.stringify(error.response.data));
|
|
785
787
|
}
|
|
786
788
|
});
|
|
789
|
+
if (body.indexOf('untrusted-app-sign-in-continue-button-announce') !== -1) {
|
|
790
|
+
this.log.info('Amazon untrustet app warning detected');
|
|
791
|
+
const form = this.extractHidden(body);
|
|
792
|
+
delete form['sessionChallengeAck'];
|
|
793
|
+
delete form['ue_back'];
|
|
794
|
+
delete form['undefined'];
|
|
795
|
+
body = await this.requestClient({
|
|
796
|
+
method: 'post',
|
|
797
|
+
maxBodyLength: Infinity,
|
|
798
|
+
url: 'https://www.amazon.de/ap/signin',
|
|
799
|
+
headers: {
|
|
800
|
+
accept:
|
|
801
|
+
'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.7',
|
|
802
|
+
'accept-language': 'de',
|
|
803
|
+
'cache-control': 'no-cache',
|
|
804
|
+
'content-type': 'application/x-www-form-urlencoded',
|
|
805
|
+
},
|
|
806
|
+
data: form,
|
|
807
|
+
})
|
|
808
|
+
.then(async (res) => {
|
|
809
|
+
this.log.debug(JSON.stringify(res.data));
|
|
810
|
+
if (res.data.indexOf('/errors/validateCaptcha') !== -1) {
|
|
811
|
+
this.log.error('Captcha detected');
|
|
812
|
+
return;
|
|
813
|
+
}
|
|
814
|
+
return res.data;
|
|
815
|
+
})
|
|
816
|
+
.catch((error) => {
|
|
817
|
+
this.log.error('Amazon untrustet app warning failed');
|
|
818
|
+
this.log.error(error);
|
|
819
|
+
if (error.response) {
|
|
820
|
+
this.log.error(JSON.stringify(error.response.data));
|
|
821
|
+
}
|
|
822
|
+
});
|
|
823
|
+
}
|
|
787
824
|
let form = this.extractHidden(body);
|
|
788
825
|
if (form.email !== this.config.amzusername) {
|
|
789
826
|
form.email = this.config.amzusername;
|
|
790
827
|
body = await this.requestClient({
|
|
791
828
|
method: 'post',
|
|
829
|
+
maxBodyLength: Infinity,
|
|
792
830
|
url: 'https://www.amazon.de/ap/signin',
|
|
793
831
|
headers: {
|
|
794
|
-
accept: 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
|
|
795
832
|
'content-type': 'application/x-www-form-urlencoded',
|
|
833
|
+
accept: 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
|
|
834
|
+
'sec-fetch-site': 'same-origin',
|
|
835
|
+
'accept-language': 'de-DE,de;q=0.9',
|
|
836
|
+
'sec-fetch-mode': 'navigate',
|
|
796
837
|
origin: 'https://www.amazon.de',
|
|
797
|
-
'
|
|
798
|
-
|
|
799
|
-
|
|
838
|
+
'user-agent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 16_7_7 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148',
|
|
839
|
+
referer:
|
|
840
|
+
'https://www.amazon.de/ap/signin?openid.return_to=https://www.amazon.de/ap/maplanding&openid.oa2.code_challenge_method=S256&openid.assoc_handle=amzn_mshop_ios_v2_de&openid.identity=http://specs.openid.net/auth/2.0/identifier_select&pageId=amzn_mshop_ios_v2_de&openid.ns.oa2=http://www.amazon.com/ap/ext/oauth/2&openid.claimed_id=http://specs.openid.net/auth/2.0/identifier_select&openid.mode=checkid_setup&openid.oa2.client_id=device:42334146314239333737364334463941393135443746313136363446434238302341334e5748585451344542435a53&openid.oa2.code_challenge=ig2YgHP3AoncuKG0ks5pgr1HUhzwvlST-tuIY2Chi2M&openid.ns.pape=http://specs.openid.net/extensions/pape/1.0&openid.oa2.scope=device_auth_access&openid.ns=http://specs.openid.net/auth/2.0&openid.pape.max_auth_age=0&openid.oa2.response_type=code',
|
|
841
|
+
'sec-fetch-dest': 'document',
|
|
800
842
|
},
|
|
801
843
|
data: qs.stringify(form),
|
|
802
844
|
})
|
|
803
845
|
.then(async (res) => {
|
|
804
|
-
this.log.
|
|
846
|
+
this.log.silly(JSON.stringify(res.data));
|
|
847
|
+
this.log.debug('Username successfully posted');
|
|
848
|
+
const form = this.extractHidden(res.data);
|
|
849
|
+
if (Object.keys(form).length <= 3) {
|
|
850
|
+
this.log.error('Password form too short');
|
|
851
|
+
this.log.error(res.data);
|
|
852
|
+
}
|
|
805
853
|
return res.data;
|
|
806
854
|
})
|
|
807
855
|
.catch((error) => {
|
|
@@ -811,14 +859,19 @@ class Parcel extends utils.Adapter {
|
|
|
811
859
|
this.log.error(JSON.stringify(error.response.data));
|
|
812
860
|
}
|
|
813
861
|
this.log.info(
|
|
814
|
-
'Delete amazon cookie please restart the adapter to trigger relogin. If this is not working please manualy delete parcel.0.auth.cookie'
|
|
862
|
+
'Delete amazon cookie please restart the adapter to trigger relogin. If this is not working please manualy delete parcel.0.auth.cookie',
|
|
815
863
|
);
|
|
816
864
|
delete this.cookieJar.store.idx['amazon.de'];
|
|
817
865
|
});
|
|
818
866
|
form = this.extractHidden(body);
|
|
819
867
|
}
|
|
820
|
-
form
|
|
868
|
+
delete form['='];
|
|
869
|
+
delete form['undefined'];
|
|
870
|
+
this.log.debug('Post form : ' + JSON.stringify(form));
|
|
871
|
+
|
|
821
872
|
form.rememberMe = 'true';
|
|
873
|
+
form.password = this.config.amzpassword;
|
|
874
|
+
this.log.debug('Post with password');
|
|
822
875
|
await this.requestClient({
|
|
823
876
|
method: 'post',
|
|
824
877
|
url: 'https://www.amazon.de/ap/signin',
|
|
@@ -830,10 +883,11 @@ class Parcel extends utils.Adapter {
|
|
|
830
883
|
'user-agent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 14_8 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148',
|
|
831
884
|
referer: 'https://www.amazon.de/ap/signin',
|
|
832
885
|
},
|
|
833
|
-
data:
|
|
886
|
+
data: form,
|
|
834
887
|
})
|
|
835
888
|
.then(async (res) => {
|
|
836
|
-
this.log.
|
|
889
|
+
this.log.silly(JSON.stringify(res.data));
|
|
890
|
+
this.log.debug('Password successfully posted');
|
|
837
891
|
if (res.data.indexOf('js-yo-main-content') !== -1) {
|
|
838
892
|
this.log.info('Relogin to Amazon successful');
|
|
839
893
|
this.sessions['amz'] = true;
|
|
@@ -845,6 +899,10 @@ class Parcel extends utils.Adapter {
|
|
|
845
899
|
if (res.data.indexOf('auth-mfa-otpcode') !== -1) {
|
|
846
900
|
this.log.info('Found MFA token login');
|
|
847
901
|
const form = this.extractHidden(res.data);
|
|
902
|
+
// delete form['ue_back'];
|
|
903
|
+
// delete form['sessionChallengeAck'];
|
|
904
|
+
delete form['undefined'];
|
|
905
|
+
form.deviceId = form.deviceId || '';
|
|
848
906
|
form.otpCode = this.config.amzotp;
|
|
849
907
|
form.rememberDevice = true;
|
|
850
908
|
|
|
@@ -852,17 +910,22 @@ class Parcel extends utils.Adapter {
|
|
|
852
910
|
method: 'post',
|
|
853
911
|
url: 'https://www.amazon.de/ap/signin',
|
|
854
912
|
headers: {
|
|
855
|
-
accept: 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
|
|
856
913
|
'content-type': 'application/x-www-form-urlencoded',
|
|
914
|
+
accept: 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
|
|
915
|
+
'sec-fetch-site': 'same-origin',
|
|
916
|
+
'accept-language': 'de-DE,de;q=0.9',
|
|
917
|
+
'sec-fetch-mode': 'navigate',
|
|
857
918
|
origin: 'https://www.amazon.de',
|
|
858
|
-
'
|
|
859
|
-
|
|
860
|
-
referer: 'https://
|
|
919
|
+
'user-agent':
|
|
920
|
+
'Mozilla/5.0 (iPhone; CPU iPhone OS 16_7_7 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148',
|
|
921
|
+
referer: 'https://' + res.request.host + res.request.path,
|
|
922
|
+
'sec-fetch-dest': 'document',
|
|
861
923
|
},
|
|
862
924
|
data: qs.stringify(form),
|
|
863
925
|
})
|
|
864
926
|
.then(async (res) => {
|
|
865
|
-
this.log.
|
|
927
|
+
this.log.silly(JSON.stringify(res.data));
|
|
928
|
+
this.log.debug('MFA successfully posted');
|
|
866
929
|
if (res.data.indexOf('js-yo-main-content') !== -1) {
|
|
867
930
|
this.log.info('Login to Amazon successful');
|
|
868
931
|
this.sessions['amz'] = true;
|
|
@@ -877,7 +940,9 @@ class Parcel extends utils.Adapter {
|
|
|
877
940
|
});
|
|
878
941
|
return;
|
|
879
942
|
}
|
|
880
|
-
this.log.error(
|
|
943
|
+
this.log.error(
|
|
944
|
+
'MFA: Login to Amazon failed. Enter correct MFA Code from SMS or App. Or check you account and login manually to Amazon',
|
|
945
|
+
);
|
|
881
946
|
this.setState('info.connection', false, true);
|
|
882
947
|
})
|
|
883
948
|
.catch(async (error) => {
|
|
@@ -895,11 +960,11 @@ class Parcel extends utils.Adapter {
|
|
|
895
960
|
this.log.error('Login to Amazon failed, please login to Amazon manually and check the login');
|
|
896
961
|
if (res.data.indexOf('captcha-placeholder') !== -1) {
|
|
897
962
|
this.log.warn(
|
|
898
|
-
'Captcha required. Please login into your account to check the state of the account. If this is not wokring please pause the adapter for 24h.'
|
|
963
|
+
'Captcha required. Please login into your account to check the state of the account. If this is not wokring please pause the adapter for 24h.',
|
|
899
964
|
);
|
|
900
965
|
}
|
|
901
966
|
this.log.info(
|
|
902
|
-
'Amazon cookie are removed. Please restart the adapter to trigger a relogin. If this is not working please manually delete parcel.0.auth.cookie'
|
|
967
|
+
'Amazon cookie are removed. Please restart the adapter to trigger a relogin. If this is not working please manually delete parcel.0.auth.cookie',
|
|
903
968
|
);
|
|
904
969
|
delete this.cookieJar.store.idx['amazon.de'];
|
|
905
970
|
this.log.info('Start relogin');
|
|
@@ -911,7 +976,40 @@ class Parcel extends utils.Adapter {
|
|
|
911
976
|
this.log.error('Zurücksetzen des Passworts erforderlich');
|
|
912
977
|
return;
|
|
913
978
|
}
|
|
979
|
+
if (res.data.indexOf('auth-select-device-form"') !== -1) {
|
|
980
|
+
this.log.info('SMS code or call form found. If you do not receive a SMS then login to Amazon and trigger the SMS code');
|
|
981
|
+
const form = this.extractHidden(res.data);
|
|
982
|
+
await this.requestClient({
|
|
983
|
+
method: 'post',
|
|
984
|
+
url: 'https://www.amazon.de/ap/mfa/new-otp?ie=UTF8',
|
|
985
|
+
headers: {
|
|
986
|
+
accept: 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
|
|
987
|
+
'content-type': 'application/x-www-form-urlencoded',
|
|
988
|
+
origin: 'https://www.amazon.de',
|
|
989
|
+
'accept-language': 'de-de',
|
|
990
|
+
'user-agent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 14_8 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148',
|
|
991
|
+
referer: 'https://www.amazon.de/ap/mfa/new-otp?ie=UTF8',
|
|
992
|
+
},
|
|
993
|
+
data: form,
|
|
994
|
+
})
|
|
995
|
+
.then(async (res) => {
|
|
996
|
+
this.log.silly(JSON.stringify(res.data));
|
|
997
|
+
this.log.debug('SMS code or call form successfully posted');
|
|
998
|
+
})
|
|
999
|
+
.catch(async (error) => {
|
|
1000
|
+
this.log.error('Failed to post SMS code or call form');
|
|
1001
|
+
if (error.response) {
|
|
1002
|
+
this.log.error(JSON.stringify(error.response.data));
|
|
1003
|
+
}
|
|
1004
|
+
});
|
|
1005
|
+
return;
|
|
1006
|
+
}
|
|
1007
|
+
if (res.data.indexOf('Löse das Rätsel, um dein Konto zu schützen') !== -1) {
|
|
1008
|
+
this.log.info('Captcha detected. Please login to Amazon and solve the captcha');
|
|
1009
|
+
return;
|
|
1010
|
+
}
|
|
914
1011
|
this.log.error('Unknown Error: Login to Amazon failed, please login to Amazon and check your credentials');
|
|
1012
|
+
this.log.info(res.data);
|
|
915
1013
|
this.setState('info.connection', false, true);
|
|
916
1014
|
return;
|
|
917
1015
|
})
|
|
@@ -938,7 +1036,8 @@ class Parcel extends utils.Adapter {
|
|
|
938
1036
|
url: 'https://www.dpd.com/de/de/mydpd-anmelden-und-registrieren/',
|
|
939
1037
|
headers: {
|
|
940
1038
|
'content-type': 'application/x-www-form-urlencoded',
|
|
941
|
-
'user-agent':
|
|
1039
|
+
'user-agent':
|
|
1040
|
+
'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',
|
|
942
1041
|
accept:
|
|
943
1042
|
'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',
|
|
944
1043
|
'accept-language': 'de,en;q=0.9',
|
|
@@ -1591,6 +1690,7 @@ class Parcel extends utils.Adapter {
|
|
|
1591
1690
|
} catch (error) {
|
|
1592
1691
|
this.log.warn('Hermes response incomplete cannot parse result');
|
|
1593
1692
|
this.log.debug(res.data);
|
|
1693
|
+
this.log.debug(error);
|
|
1594
1694
|
data = { sendungen: [] };
|
|
1595
1695
|
}
|
|
1596
1696
|
}
|
|
@@ -1667,6 +1767,7 @@ class Parcel extends utils.Adapter {
|
|
|
1667
1767
|
this.setState('inDeliveryCountJson', JSON.stringify(inDeliveryJson), true);
|
|
1668
1768
|
}
|
|
1669
1769
|
async cleanupProvider(id, data) {
|
|
1770
|
+
//eslint-disable-next-line
|
|
1670
1771
|
if (id === 'dhl' && data.hasOwnProperty('grantToken')) {
|
|
1671
1772
|
await this.delObjectAsync('dhl.briefe', { recursive: true });
|
|
1672
1773
|
await this.setObjectNotExistsAsync('dhl.briefe.json', {
|
|
@@ -1710,7 +1811,11 @@ class Parcel extends utils.Adapter {
|
|
|
1710
1811
|
status = sendung.sendungsdetails.sendungsverlauf.kurzStatus;
|
|
1711
1812
|
}
|
|
1712
1813
|
if (sendung.sendungsdetails && sendung.sendungsdetails.liveTracking) {
|
|
1713
|
-
|
|
1814
|
+
let stopps = 0;
|
|
1815
|
+
if (sendung.sendungsdetails.liveTracking && sendung.sendungsdetails.liveTracking.countdown) {
|
|
1816
|
+
stopps = sendung.sendungsdetails.liveTracking.countdown;
|
|
1817
|
+
}
|
|
1818
|
+
status = status + ' ' + stopps + ' Stopps';
|
|
1714
1819
|
}
|
|
1715
1820
|
if (sendung.sendungsdetails && sendung.sendungsdetails.zustellung && sendung.sendungsdetails.zustellung.zustellzeitfensterBis) {
|
|
1716
1821
|
const bisDate = new Date(sendung.sendungsdetails.zustellung.zustellzeitfensterBis).toLocaleTimeString('de-DE');
|
|
@@ -1731,6 +1836,7 @@ class Parcel extends utils.Adapter {
|
|
|
1731
1836
|
}
|
|
1732
1837
|
sendungsObject.direction = sendung.sendungsinfo.sendungsrichtung;
|
|
1733
1838
|
this.mergedJsonObject[sendung.id] = sendungsObject;
|
|
1839
|
+
|
|
1734
1840
|
return sendungsObject;
|
|
1735
1841
|
});
|
|
1736
1842
|
this.mergedJson = this.mergedJson.concat(sendungsArray);
|
|
@@ -1920,7 +2026,12 @@ class Parcel extends utils.Adapter {
|
|
|
1920
2026
|
const sendungen = this.mergedJsonObject;
|
|
1921
2027
|
const ids = Object.keys(sendungen);
|
|
1922
2028
|
for (const id of ids) {
|
|
1923
|
-
if (
|
|
2029
|
+
if (
|
|
2030
|
+
this.alreadySentMessages[id + sendungen[id].source] === sendungen[id].status ||
|
|
2031
|
+
sendungen[id].status === '' ||
|
|
2032
|
+
sendungen[id].status === 'undefined' ||
|
|
2033
|
+
sendungen[id].status === 'null'
|
|
2034
|
+
) {
|
|
1924
2035
|
continue;
|
|
1925
2036
|
}
|
|
1926
2037
|
|
|
@@ -1947,7 +2058,7 @@ class Parcel extends utils.Adapter {
|
|
|
1947
2058
|
});
|
|
1948
2059
|
} else if (sendInstance.includes('telegram')) {
|
|
1949
2060
|
let url = '';
|
|
1950
|
-
|
|
2061
|
+
const trackingId = sendungen[id].tracking || id;
|
|
1951
2062
|
if (sendungen[id].source === 'DHL') {
|
|
1952
2063
|
url = 'https://www.dhl.de/de/privatkunden/dhl-sendungsverfolgung.html?piececode=' + trackingId;
|
|
1953
2064
|
}
|
|
@@ -2221,7 +2332,8 @@ class Parcel extends utils.Adapter {
|
|
|
2221
2332
|
'sec-fetch-site': 'same-origin',
|
|
2222
2333
|
'sec-fetch-user': '?1',
|
|
2223
2334
|
'upgrade-insecure-requests': '1',
|
|
2224
|
-
'user-agent':
|
|
2335
|
+
'user-agent':
|
|
2336
|
+
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36',
|
|
2225
2337
|
'viewport-width': '1264',
|
|
2226
2338
|
},
|
|
2227
2339
|
})
|
|
@@ -2307,13 +2419,27 @@ class Parcel extends utils.Adapter {
|
|
|
2307
2419
|
this.log.debug(res.data);
|
|
2308
2420
|
return;
|
|
2309
2421
|
}
|
|
2422
|
+
if (status.includes('Erstattung') && Object.keys(stateObject).length === 0) {
|
|
2423
|
+
this.log.debug('No detail status found for ' + order.url);
|
|
2424
|
+
this.log.debug(res.data);
|
|
2425
|
+
return;
|
|
2426
|
+
}
|
|
2427
|
+
const id = document.querySelector('.pt-delivery-card-trackingId')
|
|
2428
|
+
? document.querySelector('.pt-delivery-card-trackingId').textContent.replace('Trackingnummer ', '')
|
|
2429
|
+
: '';
|
|
2430
|
+
|
|
2431
|
+
const name = document.querySelector('.carrierRelatedInfo-mfn-providerTitle')
|
|
2432
|
+
? document.querySelector('.carrierRelatedInfo-mfn-providerTitle').textContent.replace(/\\n */g, '')
|
|
2433
|
+
: '';
|
|
2434
|
+
if (id === '' && Object.keys(stateObject).length === 0) {
|
|
2435
|
+
this.log.debug('No detail status found for ' + order.url);
|
|
2436
|
+
this.log.debug(res.data);
|
|
2437
|
+
return;
|
|
2438
|
+
}
|
|
2439
|
+
|
|
2310
2440
|
return {
|
|
2311
|
-
id:
|
|
2312
|
-
|
|
2313
|
-
: '',
|
|
2314
|
-
name: document.querySelector('.carrierRelatedInfo-mfn-providerTitle')
|
|
2315
|
-
? document.querySelector('.carrierRelatedInfo-mfn-providerTitle').textContent.replace(/\\n */g, '')
|
|
2316
|
-
: '',
|
|
2441
|
+
id: id,
|
|
2442
|
+
name: name,
|
|
2317
2443
|
status: status,
|
|
2318
2444
|
detailedState: stateObject,
|
|
2319
2445
|
};
|
|
@@ -2362,7 +2488,8 @@ class Parcel extends utils.Adapter {
|
|
|
2362
2488
|
'Sec-Fetch-Site': 'none',
|
|
2363
2489
|
'Sec-Fetch-User': '?1',
|
|
2364
2490
|
'Upgrade-Insecure-Requests': '1',
|
|
2365
|
-
'User-Agent':
|
|
2491
|
+
'User-Agent':
|
|
2492
|
+
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36',
|
|
2366
2493
|
'device-memory': '8',
|
|
2367
2494
|
downlink: '10',
|
|
2368
2495
|
dpr: '2',
|
|
@@ -2395,10 +2522,12 @@ class Parcel extends utils.Adapter {
|
|
|
2395
2522
|
|
|
2396
2523
|
for (const order of orders) {
|
|
2397
2524
|
const descHandle = order.querySelector(
|
|
2398
|
-
'.a-fixed-right-grid-col.a-col-left .a-fixed-left-grid-col.a-col-right div:first-child .a-link-normal'
|
|
2525
|
+
'.a-fixed-right-grid-col.a-col-left .a-fixed-left-grid-col.a-col-right div:first-child .a-link-normal',
|
|
2399
2526
|
);
|
|
2400
2527
|
const desc = descHandle ? descHandle.textContent.replace(/\n */g, '') : '';
|
|
2401
|
-
let url = order.querySelector('.track-package-button a')
|
|
2528
|
+
let url = order.querySelector('.track-package-button a')
|
|
2529
|
+
? order.querySelector('.track-package-button a').getAttribute('href')
|
|
2530
|
+
: '';
|
|
2402
2531
|
if (!url) {
|
|
2403
2532
|
const allLinks = order.querySelectorAll('.a-button-inner a');
|
|
2404
2533
|
for (const link of allLinks) {
|
|
@@ -2601,6 +2730,7 @@ class Parcel extends utils.Adapter {
|
|
|
2601
2730
|
this.refreshTokenInterval && clearInterval(this.refreshTokenInterval);
|
|
2602
2731
|
callback();
|
|
2603
2732
|
} catch (e) {
|
|
2733
|
+
this.log.error('Error onUnload: ' + e);
|
|
2604
2734
|
callback();
|
|
2605
2735
|
}
|
|
2606
2736
|
}
|
package/package.json
CHANGED
|
@@ -1,66 +1,74 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
"
|
|
44
|
-
"
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
"
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
},
|
|
62
|
-
"
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
"
|
|
2
|
+
"name": "iobroker.parcel",
|
|
3
|
+
"version": "0.2.8",
|
|
4
|
+
"description": "Parcel tracking",
|
|
5
|
+
"author": {
|
|
6
|
+
"name": "TA2k",
|
|
7
|
+
"email": "tombox2020@gmail.com"
|
|
8
|
+
},
|
|
9
|
+
"homepage": "https://github.com/TA2k/ioBroker.parcel",
|
|
10
|
+
"license": "MIT",
|
|
11
|
+
"keywords": [
|
|
12
|
+
"parcel",
|
|
13
|
+
"tracking",
|
|
14
|
+
"dhl",
|
|
15
|
+
"briefe",
|
|
16
|
+
"dpd",
|
|
17
|
+
"gls",
|
|
18
|
+
"hermes",
|
|
19
|
+
"ups",
|
|
20
|
+
"amazon",
|
|
21
|
+
"paket"
|
|
22
|
+
],
|
|
23
|
+
"repository": {
|
|
24
|
+
"type": "git",
|
|
25
|
+
"url": "https://github.com/TA2k/ioBroker.parcel"
|
|
26
|
+
},
|
|
27
|
+
"dependencies": {
|
|
28
|
+
"@iobroker/adapter-core": "^3.2.2",
|
|
29
|
+
"axios": "^1.7.7",
|
|
30
|
+
"http-cookie-agent": "^6.0.6",
|
|
31
|
+
"jsdom": "^25.0.1",
|
|
32
|
+
"json2iob": "^2.6.12",
|
|
33
|
+
"qs": "^6.13.0",
|
|
34
|
+
"tough-cookie": "^5.0.0",
|
|
35
|
+
"uuid": "^10.0.0"
|
|
36
|
+
},
|
|
37
|
+
"devDependencies": {
|
|
38
|
+
"@alcalzone/release-script": "^3.8.0",
|
|
39
|
+
"@alcalzone/release-script-plugin-iobroker": "^3.7.2",
|
|
40
|
+
"@alcalzone/release-script-plugin-license": "^3.7.0",
|
|
41
|
+
"@alcalzone/release-script-plugin-manual-review": "^3.7.0",
|
|
42
|
+
"@eslint/eslintrc": "^3.1.0",
|
|
43
|
+
"@eslint/js": "^9.12.0",
|
|
44
|
+
"@iobroker/testing": "^5.0.0",
|
|
45
|
+
"@types/node": "^22.7.6",
|
|
46
|
+
"eslint": "^9.12.0",
|
|
47
|
+
"globals": "^15.11.0",
|
|
48
|
+
"typescript": "~5.6.3"
|
|
49
|
+
},
|
|
50
|
+
"main": "main.js",
|
|
51
|
+
"files": [
|
|
52
|
+
"admin{,/!(src)/**}/!(tsconfig|tsconfig.*).json",
|
|
53
|
+
"admin{,/!(src)/**}/*.{html,css,png,svg,jpg,js}",
|
|
54
|
+
"lib/",
|
|
55
|
+
"www/",
|
|
56
|
+
"io-package.json",
|
|
57
|
+
"LICENSE",
|
|
58
|
+
"main.js"
|
|
59
|
+
],
|
|
60
|
+
"scripts": {
|
|
61
|
+
"test:js": "mocha --config test/mocharc.custom.json \"{!(node_modules|test)/**/*.test.js,*.test.js,test/**/test!(PackageFiles|Startup).js}\"",
|
|
62
|
+
"test:package": "mocha test/package --exit",
|
|
63
|
+
"test:unit": "mocha test/unit --exit",
|
|
64
|
+
"test:integration": "mocha test/integration --exit",
|
|
65
|
+
"test": "npm run test:js && npm run test:package",
|
|
66
|
+
"check": "tsc --noEmit -p tsconfig.check.json",
|
|
67
|
+
"lint": "eslint",
|
|
68
|
+
"release": "release-script --all"
|
|
69
|
+
},
|
|
70
|
+
"bugs": {
|
|
71
|
+
"url": "https://github.com/TA2k/ioBroker.parcel/issues"
|
|
72
|
+
},
|
|
73
|
+
"readmeFilename": "README.md"
|
|
66
74
|
}
|