iobroker.parcel 0.2.6 → 0.2.7
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/admin/index_m.html +221 -218
- package/io-package.json +44 -1
- package/lib/dhldecrypt.js +4 -0
- package/main.js +51 -32
- package/package.json +5 -17
package/admin/index_m.html
CHANGED
|
@@ -1,229 +1,232 @@
|
|
|
1
1
|
<html>
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
<head>
|
|
3
|
+
<!-- Load ioBroker scripts and styles-->
|
|
4
|
+
<link rel="stylesheet" type="text/css" href="../../css/adapter.css" />
|
|
5
|
+
<link rel="stylesheet" type="text/css" href="../../lib/css/materialize.css" />
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
<script type="text/javascript" src="../../lib/js/jquery-3.2.1.min.js"></script>
|
|
8
|
+
<script type="text/javascript" src="../../socket.io/socket.io.js"></script>
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
<script type="text/javascript" src="../../js/translate.js"></script>
|
|
11
|
+
<script type="text/javascript" src="../../lib/js/materialize.js"></script>
|
|
12
|
+
<script type="text/javascript" src="../../js/adapter-settings.js"></script>
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
<!-- Load our own files -->
|
|
15
|
+
<link rel="stylesheet" type="text/css" href="style.css" />
|
|
16
|
+
<script type="text/javascript" src="words.js"></script>
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
18
|
+
<script type="text/javascript">
|
|
19
|
+
// This will be called by the admin adapter when the settings page loads
|
|
20
|
+
function load(settings, onChange) {
|
|
21
|
+
// example: select elements with id=key and class=value and insert value
|
|
22
|
+
if (!settings) return;
|
|
23
|
+
$('.value').each(function () {
|
|
24
|
+
var $key = $(this);
|
|
25
|
+
var id = $key.attr('id');
|
|
26
|
+
if ($key.attr('type') === 'checkbox') {
|
|
27
|
+
// do not call onChange direct, because onChange could expect some arguments
|
|
28
|
+
$key.prop('checked', settings[id]).on('change', () => onChange());
|
|
29
|
+
} else {
|
|
30
|
+
// do not call onChange direct, because onChange could expect some arguments
|
|
31
|
+
$key
|
|
32
|
+
.val(settings[id])
|
|
33
|
+
.on('change', () => onChange())
|
|
34
|
+
.on('keyup', () => onChange());
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
onChange(false);
|
|
38
|
+
// reinitialize all the Materialize labels on the page if you are dynamically adding inputs:
|
|
39
|
+
if (M) M.updateTextFields();
|
|
40
|
+
}
|
|
40
41
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
42
|
+
// This will be called by the admin adapter when the user presses the save button
|
|
43
|
+
function save(callback) {
|
|
44
|
+
// example: select elements with class=value and build settings object
|
|
45
|
+
var obj = {};
|
|
46
|
+
$('.value').each(function () {
|
|
47
|
+
var $this = $(this);
|
|
48
|
+
if ($this.attr('type') === 'checkbox') {
|
|
49
|
+
obj[$this.attr('id')] = $this.prop('checked');
|
|
50
|
+
} else if ($this.attr('type') === 'number') {
|
|
51
|
+
obj[$this.attr('id')] = parseFloat($this.val());
|
|
52
|
+
} else {
|
|
53
|
+
obj[$this.attr('id')] = $this.val();
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
callback(obj);
|
|
57
|
+
}
|
|
58
|
+
</script>
|
|
59
|
+
</head>
|
|
59
60
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
61
|
+
<body>
|
|
62
|
+
<div class="m adapter-container">
|
|
63
|
+
<div class="row">
|
|
64
|
+
<div class="col s12 m4 l2">
|
|
65
|
+
<img src="parcel.png" class="logo" />
|
|
66
|
+
</div>
|
|
67
|
+
</div>
|
|
67
68
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
69
|
+
<!-- Put your content here -->
|
|
70
|
+
<div class="row">
|
|
71
|
+
<div class="col"><h5>Allgemein</h5></div>
|
|
72
|
+
</div>
|
|
73
|
+
<div class="row">
|
|
74
|
+
<div class="col s6 input-field">
|
|
75
|
+
<input type="number" class="value" id="interval" />
|
|
76
|
+
<label for="interval" class="translate"
|
|
77
|
+
>Update interval in minutes (Unter 10min kann bei DHL zu einer Benachrichtigung führen)</label
|
|
78
|
+
>
|
|
79
|
+
</div>
|
|
80
|
+
<div class="col s6 input-field">
|
|
81
|
+
<div>
|
|
82
|
+
<input type="checkbox" class="value" id="sendToActive" />
|
|
83
|
+
<label for="sendToActive" class="translate">Benachrichtigung bei Änderungen senden</label>
|
|
84
|
+
</div>
|
|
85
|
+
<div>
|
|
86
|
+
<input type="text" class="value" id="sendToInstance" />
|
|
87
|
+
<label for="sendToInstance" class="translate">Instanz zum senden verwenden (Kommagetrennt für mehrere)</label>
|
|
88
|
+
</div>
|
|
89
|
+
<div>
|
|
90
|
+
<input type="text" class="value" id="sendToUser" />
|
|
91
|
+
<label for="sendToUser" class="translate">User an den gesendet werden soll (Kommagetrennt für mehrere)</label>
|
|
92
|
+
</div>
|
|
93
|
+
<div>
|
|
94
|
+
<input type="checkbox" class="value" id="noFirstStartSend" />
|
|
95
|
+
<label for="noFirstStartSend" class="translate">Benachrichtigung beim Adapterstart unterdrücken</label>
|
|
96
|
+
</div>
|
|
97
|
+
</div>
|
|
98
|
+
</div>
|
|
96
99
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
100
|
+
<div class="row">
|
|
101
|
+
<div class="col"><h5>DHL</h5></div>
|
|
102
|
+
</div>
|
|
103
|
+
<div class="row">
|
|
104
|
+
<div class="col s6 input-field">
|
|
105
|
+
<input type="text" class="value" id="dhlusername" />
|
|
106
|
+
<label for="dhlusername" class="translate">App Email</label>
|
|
107
|
+
</div>
|
|
108
|
+
</div>
|
|
109
|
+
<div class="row">
|
|
110
|
+
<div class="col s6 input-field">
|
|
111
|
+
<input type="password" class="value" id="dhlpassword" />
|
|
112
|
+
<label for="dhlpassword" class="translate">App Password</label>
|
|
113
|
+
</div>
|
|
114
|
+
</div>
|
|
115
|
+
<div class="row">
|
|
116
|
+
<div class="col s6 input-field">
|
|
117
|
+
<input type="text" class="value" id="dhlMfa" />
|
|
118
|
+
<label for="dhlMfa" class="translate">SMS/Mail Pin nach erstem Start</label>
|
|
119
|
+
</div>
|
|
120
|
+
</div>
|
|
121
|
+
<div class="row">
|
|
122
|
+
<div class="col"><h5>Amazon</h5></div>
|
|
123
|
+
</div>
|
|
124
|
+
<div class="row">
|
|
125
|
+
<div class="col s6 input-field">
|
|
126
|
+
<input type="text" class="value" id="amzusername" />
|
|
127
|
+
<label for="amzusername" class="translate">Amazon Email</label>
|
|
128
|
+
</div>
|
|
129
|
+
</div>
|
|
127
130
|
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
131
|
+
<div class="row">
|
|
132
|
+
<div class="col s6 input-field">
|
|
133
|
+
<input type="password" class="value" id="amzpassword" />
|
|
134
|
+
<label for="amzpassword" class="translate">Amazon Password</label>
|
|
135
|
+
</div>
|
|
136
|
+
</div>
|
|
137
|
+
<div class="row">
|
|
138
|
+
<div class="col s6 input-field">
|
|
139
|
+
<input type="text" class="value" id="amzotp" />
|
|
140
|
+
<label for="amzotp" class="translate">Amazon OTP Token vor dem Login eingeben. 2FA Aktivierung ist Empfohlen.</label>
|
|
141
|
+
</div>
|
|
142
|
+
</div>
|
|
143
|
+
<div class="row">
|
|
144
|
+
<div class="col"><h5>DPD</h5></div>
|
|
145
|
+
</div>
|
|
146
|
+
<div class="row">
|
|
147
|
+
<div class="col s6 input-field">
|
|
148
|
+
<input type="text" class="value" id="dpdusername" />
|
|
149
|
+
<label for="dpdusername" class="translate">App Email</label>
|
|
150
|
+
</div>
|
|
151
|
+
</div>
|
|
152
|
+
<div class="row">
|
|
153
|
+
<div class="col s6 input-field">
|
|
154
|
+
<input type="password" class="value" id="dpdpassword" />
|
|
155
|
+
<label for="dpdpassword" class="translate">App Password</label>
|
|
156
|
+
</div>
|
|
157
|
+
</div>
|
|
158
|
+
<div class="row">
|
|
159
|
+
<div class="col"><h5>GLS</h5></div>
|
|
160
|
+
</div>
|
|
161
|
+
<div class="row">
|
|
162
|
+
<div class="col s6 input-field">
|
|
163
|
+
<input type="text" class="value" id="glsusername" />
|
|
164
|
+
<label for="glsusername" class="translate">App Email</label>
|
|
165
|
+
</div>
|
|
166
|
+
</div>
|
|
167
|
+
<div class="row">
|
|
168
|
+
<div class="col s6 input-field">
|
|
169
|
+
<input type="password" class="value" id="glspassword" />
|
|
170
|
+
<label for="glspassword" class="translate">App Password</label>
|
|
171
|
+
</div>
|
|
172
|
+
</div>
|
|
173
|
+
<div class="row">
|
|
174
|
+
<div class="col"><h5>Hermes</h5></div>
|
|
175
|
+
</div>
|
|
176
|
+
<div class="row">
|
|
177
|
+
<div class="col s6 input-field">
|
|
178
|
+
<input type="text" class="value" id="hermesusername" />
|
|
179
|
+
<label for="hermesusername" class="translate">App Username</label>
|
|
180
|
+
</div>
|
|
181
|
+
</div>
|
|
182
|
+
<div class="row">
|
|
183
|
+
<div class="col s6 input-field">
|
|
184
|
+
<input type="password" class="value" id="hermespassword" />
|
|
185
|
+
<label for="hermespassword" class="translate">App Password</label>
|
|
186
|
+
</div>
|
|
187
|
+
</div>
|
|
188
|
+
<div class="row">
|
|
189
|
+
<div class="col"><h5>UPS</h5></div>
|
|
190
|
+
</div>
|
|
191
|
+
<div class="row">
|
|
192
|
+
<div class="col s6 input-field">
|
|
193
|
+
<input type="text" class="value" id="upsusername" />
|
|
194
|
+
<label for="upsusername" class="translate">App Username</label>
|
|
195
|
+
</div>
|
|
196
|
+
</div>
|
|
197
|
+
<div class="row">
|
|
198
|
+
<div class="col s6 input-field">
|
|
199
|
+
<input type="password" class="value" id="upspassword" />
|
|
200
|
+
<label for="upspassword" class="translate">App Password</label>
|
|
201
|
+
</div>
|
|
202
|
+
</div>
|
|
203
|
+
<div class="row">
|
|
204
|
+
<div class="col"><h5>17Track Normal User</h5></div>
|
|
205
|
+
</div>
|
|
206
|
+
<div class="row">
|
|
207
|
+
<div class="col s6 input-field">
|
|
208
|
+
<input type="text" class="value" id="t17username" />
|
|
209
|
+
<label for="t17username" class="translate">App Email</label>
|
|
210
|
+
</div>
|
|
211
|
+
</div>
|
|
212
|
+
<div class="row">
|
|
213
|
+
<div class="col s6 input-field">
|
|
214
|
+
<input type="password" class="value" id="t17password" />
|
|
215
|
+
<label for="t17password" class="translate">App Password</label>
|
|
216
|
+
</div>
|
|
217
|
+
</div>
|
|
218
|
+
<div class="row">
|
|
219
|
+
<div class="col">
|
|
220
|
+
<div><h5>17Track</h5></div>
|
|
221
|
+
<a href="https://api.17track.net/en/admin/settings" target="_blank">Register HERE to receive a API Key</a>
|
|
222
|
+
</div>
|
|
223
|
+
</div>
|
|
224
|
+
<div class="row">
|
|
225
|
+
<div class="col s6 input-field">
|
|
226
|
+
<input type="text" class="value" id="17trackKey" />
|
|
227
|
+
<label for="17trackKey" class="translate">17Track API Key</label>
|
|
228
|
+
</div>
|
|
229
|
+
</div>
|
|
230
|
+
</div>
|
|
231
|
+
</body>
|
|
229
232
|
</html>
|
package/io-package.json
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"common": {
|
|
3
3
|
"name": "parcel",
|
|
4
|
-
"version": "0.2.
|
|
4
|
+
"version": "0.2.7",
|
|
5
5
|
"news": {
|
|
6
|
+
"0.2.7": {
|
|
7
|
+
"en": "Fix for UPS Login",
|
|
8
|
+
"de": "Fix für UPS Login"
|
|
9
|
+
},
|
|
6
10
|
"0.2.6": {
|
|
7
11
|
"en": "Improve DHL Status and add link to shipment in the telegram notification",
|
|
8
12
|
"de": "Verbesserung des DHL Status und Link zur Sendung in der Telegram Benachrichtigung hinzugefügt"
|
|
@@ -236,6 +240,32 @@
|
|
|
236
240
|
},
|
|
237
241
|
"native": {}
|
|
238
242
|
},
|
|
243
|
+
{
|
|
244
|
+
"_id": "notDelivered",
|
|
245
|
+
"type": "state",
|
|
246
|
+
"common": {
|
|
247
|
+
"role": "json",
|
|
248
|
+
"name": "Not yet delivered/Noch nicht zugestellt",
|
|
249
|
+
"type": "string",
|
|
250
|
+
"read": true,
|
|
251
|
+
"write": false,
|
|
252
|
+
"def": "{}"
|
|
253
|
+
},
|
|
254
|
+
"native": {}
|
|
255
|
+
},
|
|
256
|
+
{
|
|
257
|
+
"_id": "notDeliveredCount",
|
|
258
|
+
"type": "state",
|
|
259
|
+
"common": {
|
|
260
|
+
"role": "value",
|
|
261
|
+
"name": "Number of not yet delivered/Anzahl noch nicht zugestellt",
|
|
262
|
+
"type": "number",
|
|
263
|
+
"read": true,
|
|
264
|
+
"write": false,
|
|
265
|
+
"def": 0
|
|
266
|
+
},
|
|
267
|
+
"native": {}
|
|
268
|
+
},
|
|
239
269
|
{
|
|
240
270
|
"_id": "inDelivery",
|
|
241
271
|
"type": "state",
|
|
@@ -248,6 +278,19 @@
|
|
|
248
278
|
},
|
|
249
279
|
"native": {}
|
|
250
280
|
},
|
|
281
|
+
{
|
|
282
|
+
"_id": "inDeliveryCountJson",
|
|
283
|
+
"type": "state",
|
|
284
|
+
"common": {
|
|
285
|
+
"role": "json",
|
|
286
|
+
"name": "Number of in Delivery of all Providers",
|
|
287
|
+
"type": "string",
|
|
288
|
+
"read": true,
|
|
289
|
+
"write": false,
|
|
290
|
+
"def": "{}"
|
|
291
|
+
},
|
|
292
|
+
"native": {}
|
|
293
|
+
},
|
|
251
294
|
{
|
|
252
295
|
"_id": "inDeliveryCount",
|
|
253
296
|
"type": "state",
|
package/lib/dhldecrypt.js
CHANGED
|
@@ -16,6 +16,10 @@ async function decryptAdviceWebCrypto(url, requestClient) {
|
|
|
16
16
|
withCredentials: true,
|
|
17
17
|
method: 'GET',
|
|
18
18
|
responseType: 'arraybuffer',
|
|
19
|
+
headers: {
|
|
20
|
+
'User-Agent':
|
|
21
|
+
'Mozilla/5.0 (Linux; Android 10; SM-G975F) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.120 Mobile Safari/537.36',
|
|
22
|
+
},
|
|
19
23
|
})
|
|
20
24
|
.then(async function (response) {
|
|
21
25
|
const uuid = getUuidFromUrl(url);
|
package/main.js
CHANGED
|
@@ -49,6 +49,7 @@ class Parcel extends utils.Adapter {
|
|
|
49
49
|
this.sessions = {};
|
|
50
50
|
this.mergedJson = [];
|
|
51
51
|
this.inDelivery = [];
|
|
52
|
+
this.notDelivered = [];
|
|
52
53
|
this.mergedJsonObject = {};
|
|
53
54
|
this.images = {};
|
|
54
55
|
this.alreadySentMessages = {};
|
|
@@ -182,8 +183,7 @@ class Parcel extends utils.Adapter {
|
|
|
182
183
|
url: 'https://login.dhl.de/af5f9bb6-27ad-4af4-9445-008e7a5cddb8/login/authorize',
|
|
183
184
|
params: {
|
|
184
185
|
redirect_uri: 'dhllogin://de.deutschepost.dhl/login',
|
|
185
|
-
state:
|
|
186
|
-
'eyJycyI6dHJ1ZSwicnYiOmZhbHNlLCJmaWQiOiJhcHAtbG9naW4tbWVoci1mb290ZXIiLCJoaWQiOiJhcHAtbG9naW4tbWVoci1oZWFkZXIiLCJycCI6ZmFsc2V9',
|
|
186
|
+
state: 'eyJycyI6dHJ1ZSwicnYiOmZhbHNlLCJmaWQiOiJhcHAtbG9naW4tbWVoci1mb290ZXIiLCJoaWQiOiJhcHAtbG9naW4tbWVoci1oZWFkZXIiLCJycCI6ZmFsc2V9',
|
|
187
187
|
client_id: '83471082-5c13-4fce-8dcb-19d2a3fca413',
|
|
188
188
|
response_type: 'code',
|
|
189
189
|
scope: 'openid offline_access',
|
|
@@ -303,8 +303,7 @@ class Parcel extends utils.Adapter {
|
|
|
303
303
|
redirect_uri: 'dhllogin://de.deutschepost.dhl/login',
|
|
304
304
|
response_type: 'code',
|
|
305
305
|
scope: 'openid',
|
|
306
|
-
state:
|
|
307
|
-
'eyJycyI6dHJ1ZSwicnYiOmZhbHNlLCJmaWQiOiJhcHAtbG9naW4tbWVoci1mb290ZXIiLCJoaWQiOiJhcHAtbG9naW4tbWVoci1oZWFkZXIiLCJycCI6ZmFsc2V9',
|
|
306
|
+
state: 'eyJycyI6dHJ1ZSwicnYiOmZhbHNlLCJmaWQiOiJhcHAtbG9naW4tbWVoci1mb290ZXIiLCJoaWQiOiJhcHAtbG9naW4tbWVoci1oZWFkZXIiLCJycCI6ZmFsc2V9',
|
|
308
307
|
ui_locales: 'de-DE",',
|
|
309
308
|
},
|
|
310
309
|
headers: {
|
|
@@ -352,8 +351,7 @@ class Parcel extends utils.Adapter {
|
|
|
352
351
|
redirect_uri: 'dhllogin://de.deutschepost.dhl/login',
|
|
353
352
|
response_type: 'code',
|
|
354
353
|
scope: 'openid',
|
|
355
|
-
state:
|
|
356
|
-
'eyJycyI6dHJ1ZSwicnYiOmZhbHNlLCJmaWQiOiJhcHAtbG9naW4tbWVoci1mb290ZXIiLCJoaWQiOiJhcHAtbG9naW4tbWVoci1oZWFkZXIiLCJycCI6ZmFsc2V9',
|
|
354
|
+
state: 'eyJycyI6dHJ1ZSwicnYiOmZhbHNlLCJmaWQiOiJhcHAtbG9naW4tbWVoci1mb290ZXIiLCJoaWQiOiJhcHAtbG9naW4tbWVoci1oZWFkZXIiLCJycCI6ZmFsc2V9',
|
|
357
355
|
ui_locales: 'de-DE',
|
|
358
356
|
},
|
|
359
357
|
headers: {
|
|
@@ -611,8 +609,7 @@ class Parcel extends utils.Adapter {
|
|
|
611
609
|
'sec-ch-ua-mobile': '?0',
|
|
612
610
|
'sec-ch-ua-platform': '"macOS"',
|
|
613
611
|
'upgrade-insecure-requests': '1',
|
|
614
|
-
'user-agent':
|
|
615
|
-
'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': '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',
|
|
616
613
|
accept:
|
|
617
614
|
'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',
|
|
618
615
|
'sec-fetch-site': 'same-site',
|
|
@@ -656,8 +653,7 @@ class Parcel extends utils.Adapter {
|
|
|
656
653
|
accept: 'application/json, text/plain, */*',
|
|
657
654
|
'content-type': 'application/x-www-form-urlencoded',
|
|
658
655
|
'sec-ch-ua-mobile': '?0',
|
|
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',
|
|
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',
|
|
661
657
|
'sec-ch-ua-platform': '"macOS"',
|
|
662
658
|
origin: 'https://login.aliexpress.com',
|
|
663
659
|
'sec-fetch-site': 'same-site',
|
|
@@ -687,9 +683,7 @@ class Parcel extends utils.Adapter {
|
|
|
687
683
|
})
|
|
688
684
|
.then(async (res) => {
|
|
689
685
|
// this.log.debug(JSON.stringify(res.data));
|
|
690
|
-
res.data.indexOf('Session has expired') !== -1
|
|
691
|
-
? this.log.error('Session has expired')
|
|
692
|
-
: this.log.info('Login to Aliexpress successful');
|
|
686
|
+
res.data.indexOf('Session has expired') !== -1 ? this.log.error('Session has expired') : this.log.info('Login to Aliexpress successful');
|
|
693
687
|
})
|
|
694
688
|
.catch(async (error) => {
|
|
695
689
|
error.response && this.log.error(JSON.stringify(error.response.data));
|
|
@@ -783,7 +777,7 @@ class Parcel extends utils.Adapter {
|
|
|
783
777
|
.catch((error) => {
|
|
784
778
|
this.log.error('Amazon first login step failed');
|
|
785
779
|
this.log.error(
|
|
786
|
-
'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'
|
|
780
|
+
'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'
|
|
787
781
|
);
|
|
788
782
|
this.log.error(error);
|
|
789
783
|
if (error.response) {
|
|
@@ -817,7 +811,7 @@ class Parcel extends utils.Adapter {
|
|
|
817
811
|
this.log.error(JSON.stringify(error.response.data));
|
|
818
812
|
}
|
|
819
813
|
this.log.info(
|
|
820
|
-
'Delete amazon cookie please restart the adapter to trigger relogin. If this is not working please manualy delete parcel.0.auth.cookie'
|
|
814
|
+
'Delete amazon cookie please restart the adapter to trigger relogin. If this is not working please manualy delete parcel.0.auth.cookie'
|
|
821
815
|
);
|
|
822
816
|
delete this.cookieJar.store.idx['amazon.de'];
|
|
823
817
|
});
|
|
@@ -901,11 +895,11 @@ class Parcel extends utils.Adapter {
|
|
|
901
895
|
this.log.error('Login to Amazon failed, please login to Amazon manually and check the login');
|
|
902
896
|
if (res.data.indexOf('captcha-placeholder') !== -1) {
|
|
903
897
|
this.log.warn(
|
|
904
|
-
'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.'
|
|
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.'
|
|
905
899
|
);
|
|
906
900
|
}
|
|
907
901
|
this.log.info(
|
|
908
|
-
'Amazon cookie are removed. Please restart the adapter to trigger a relogin. If this is not working please manually delete parcel.0.auth.cookie'
|
|
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'
|
|
909
903
|
);
|
|
910
904
|
delete this.cookieJar.store.idx['amazon.de'];
|
|
911
905
|
this.log.info('Start relogin');
|
|
@@ -944,8 +938,7 @@ class Parcel extends utils.Adapter {
|
|
|
944
938
|
url: 'https://www.dpd.com/de/de/mydpd-anmelden-und-registrieren/',
|
|
945
939
|
headers: {
|
|
946
940
|
'content-type': 'application/x-www-form-urlencoded',
|
|
947
|
-
'user-agent':
|
|
948
|
-
'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',
|
|
941
|
+
'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',
|
|
949
942
|
accept:
|
|
950
943
|
'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',
|
|
951
944
|
'accept-language': 'de,en;q=0.9',
|
|
@@ -1222,7 +1215,7 @@ class Parcel extends utils.Adapter {
|
|
|
1222
1215
|
AuthenticationToken: this.upsAuthToken,
|
|
1223
1216
|
},
|
|
1224
1217
|
ServiceAccessToken: {
|
|
1225
|
-
AccessLicenseNumber: '
|
|
1218
|
+
AccessLicenseNumber: '3DE112BAD1F163E0',
|
|
1226
1219
|
},
|
|
1227
1220
|
},
|
|
1228
1221
|
GetEnrollmentsRequest: {
|
|
@@ -1388,6 +1381,7 @@ class Parcel extends utils.Adapter {
|
|
|
1388
1381
|
this.mergedJson = [];
|
|
1389
1382
|
this.mergedJsonObject = {};
|
|
1390
1383
|
this.inDelivery = [];
|
|
1384
|
+
this.notDelivered = [];
|
|
1391
1385
|
if (this.sessions['17track']) {
|
|
1392
1386
|
try {
|
|
1393
1387
|
const trackList = await this.getStateAsync('17t.trackList');
|
|
@@ -1528,7 +1522,7 @@ class Parcel extends utils.Adapter {
|
|
|
1528
1522
|
header: {
|
|
1529
1523
|
Connection: 'keep-alive',
|
|
1530
1524
|
Accept: 'application/json',
|
|
1531
|
-
AccessLicenseNumber: '
|
|
1525
|
+
AccessLicenseNumber: '3DE112BAD1F163E0',
|
|
1532
1526
|
AuthenticationToken: this.upsAuthToken,
|
|
1533
1527
|
addresstoken: this.upsAddressToken,
|
|
1534
1528
|
transID: uuidv4().substring(0, 25),
|
|
@@ -1663,7 +1657,14 @@ class Parcel extends utils.Adapter {
|
|
|
1663
1657
|
this.setState('allProviderJson', JSON.stringify(this.mergedJson), true);
|
|
1664
1658
|
this.setState('allProviderObjects', JSON.stringify(this.mergedJsonObject), true);
|
|
1665
1659
|
this.setState('inDelivery', JSON.stringify(this.inDelivery), true);
|
|
1660
|
+
this.setState('notDelivered', JSON.stringify(this.notDelivered), true);
|
|
1666
1661
|
this.setState('inDeliveryCount', this.inDelivery.length, true);
|
|
1662
|
+
this.setState('notDeliveredCount', this.notDelivered.length, true);
|
|
1663
|
+
const inDeliveryJson = {};
|
|
1664
|
+
for (const sendung of this.inDelivery) {
|
|
1665
|
+
inDeliveryJson[sendung.source] = inDeliveryJson[sendung.source] ? inDeliveryJson[sendung.source] + 1 : 1;
|
|
1666
|
+
}
|
|
1667
|
+
this.setState('inDeliveryCountJson', JSON.stringify(inDeliveryJson), true);
|
|
1667
1668
|
}
|
|
1668
1669
|
async cleanupProvider(id, data) {
|
|
1669
1670
|
if (id === 'dhl' && data.hasOwnProperty('grantToken')) {
|
|
@@ -1725,6 +1726,9 @@ class Parcel extends utils.Adapter {
|
|
|
1725
1726
|
sendungsObject.inDelivery = true;
|
|
1726
1727
|
this.inDelivery.push(sendungsObject);
|
|
1727
1728
|
}
|
|
1729
|
+
if (sendungsObject.delivery_status !== this.delivery_status.DELIVERED) {
|
|
1730
|
+
this.notDelivered.push(sendungsObject);
|
|
1731
|
+
}
|
|
1728
1732
|
sendungsObject.direction = sendung.sendungsinfo.sendungsrichtung;
|
|
1729
1733
|
this.mergedJsonObject[sendung.id] = sendungsObject;
|
|
1730
1734
|
return sendungsObject;
|
|
@@ -1746,6 +1750,9 @@ class Parcel extends utils.Adapter {
|
|
|
1746
1750
|
sendungsObject.inDelivery = true;
|
|
1747
1751
|
this.inDelivery.push(sendungsObject);
|
|
1748
1752
|
}
|
|
1753
|
+
if (sendungsObject.delivery_status !== this.delivery_status.DELIVERED) {
|
|
1754
|
+
this.notDelivered.push(sendungsObject);
|
|
1755
|
+
}
|
|
1749
1756
|
this.mergedJsonObject[sendung.id] = sendungsObject;
|
|
1750
1757
|
return sendungsObject;
|
|
1751
1758
|
});
|
|
@@ -1765,6 +1772,9 @@ class Parcel extends utils.Adapter {
|
|
|
1765
1772
|
sendungsObject.inDelivery = true;
|
|
1766
1773
|
this.inDelivery.push(sendungsObject);
|
|
1767
1774
|
}
|
|
1775
|
+
if (sendungsObject.delivery_status !== this.delivery_status.DELIVERED) {
|
|
1776
|
+
this.notDelivered.push(sendungsObject);
|
|
1777
|
+
}
|
|
1768
1778
|
this.mergedJsonObject[sendung.id] = sendungsObject;
|
|
1769
1779
|
|
|
1770
1780
|
return sendungsObject;
|
|
@@ -1787,11 +1797,14 @@ class Parcel extends utils.Adapter {
|
|
|
1787
1797
|
};
|
|
1788
1798
|
|
|
1789
1799
|
sendungsObject.delivery_status = this.deliveryStatusCheck(sendung, id, sendungsObject);
|
|
1800
|
+
this.mergedJsonObject[sendung.id] = sendungsObject;
|
|
1790
1801
|
if (sendungsObject.delivery_status === this.delivery_status.OUT_FOR_DELIVERY) {
|
|
1791
1802
|
sendungsObject.inDelivery = true;
|
|
1792
1803
|
this.inDelivery.push(sendungsObject);
|
|
1793
1804
|
}
|
|
1794
|
-
this.
|
|
1805
|
+
if (sendungsObject.delivery_status !== this.delivery_status.DELIVERED) {
|
|
1806
|
+
this.notDelivered.push(sendungsObject);
|
|
1807
|
+
}
|
|
1795
1808
|
|
|
1796
1809
|
return sendungsObject;
|
|
1797
1810
|
});
|
|
@@ -1816,6 +1829,9 @@ class Parcel extends utils.Adapter {
|
|
|
1816
1829
|
sendungsObject.inDelivery = true;
|
|
1817
1830
|
this.inDelivery.push(sendungsObject);
|
|
1818
1831
|
}
|
|
1832
|
+
if (sendungsObject.delivery_status !== this.delivery_status.DELIVERED) {
|
|
1833
|
+
this.notDelivered.push(sendungsObject);
|
|
1834
|
+
}
|
|
1819
1835
|
this.mergedJsonObject[sendung.id] = sendungsObject;
|
|
1820
1836
|
|
|
1821
1837
|
return sendungsObject;
|
|
@@ -1837,6 +1853,9 @@ class Parcel extends utils.Adapter {
|
|
|
1837
1853
|
sendungsObject.inDelivery = true;
|
|
1838
1854
|
this.inDelivery.push(sendungsObject);
|
|
1839
1855
|
}
|
|
1856
|
+
if (sendungsObject.delivery_status !== this.delivery_status.DELIVERED) {
|
|
1857
|
+
this.notDelivered.push(sendungsObject);
|
|
1858
|
+
}
|
|
1840
1859
|
this.mergedJsonObject[sendung.id] = sendungsObject;
|
|
1841
1860
|
|
|
1842
1861
|
return sendungsObject;
|
|
@@ -1857,7 +1876,9 @@ class Parcel extends utils.Adapter {
|
|
|
1857
1876
|
sendungsObject.inDelivery = true;
|
|
1858
1877
|
this.inDelivery.push(sendungsObject);
|
|
1859
1878
|
}
|
|
1860
|
-
|
|
1879
|
+
if (sendungsObject.delivery_status !== this.delivery_status.DELIVERED) {
|
|
1880
|
+
this.notDelivered.push(sendungsObject);
|
|
1881
|
+
}
|
|
1861
1882
|
this.mergedJsonObject[sendung.id] = sendungsObject;
|
|
1862
1883
|
}
|
|
1863
1884
|
return sendungsObject;
|
|
@@ -1882,7 +1903,9 @@ class Parcel extends utils.Adapter {
|
|
|
1882
1903
|
sendungsObject.inDelivery = true;
|
|
1883
1904
|
this.inDelivery.push(sendungsObject);
|
|
1884
1905
|
}
|
|
1885
|
-
|
|
1906
|
+
if (sendungsObject.delivery_status !== this.delivery_status.DELIVERED) {
|
|
1907
|
+
this.notDelivered.push(sendungsObject);
|
|
1908
|
+
}
|
|
1886
1909
|
this.mergedJsonObject[sendung.id] = sendungsObject;
|
|
1887
1910
|
}
|
|
1888
1911
|
return sendungsObject;
|
|
@@ -2198,8 +2221,7 @@ class Parcel extends utils.Adapter {
|
|
|
2198
2221
|
'sec-fetch-site': 'same-origin',
|
|
2199
2222
|
'sec-fetch-user': '?1',
|
|
2200
2223
|
'upgrade-insecure-requests': '1',
|
|
2201
|
-
'user-agent':
|
|
2202
|
-
'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',
|
|
2224
|
+
'user-agent': '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',
|
|
2203
2225
|
'viewport-width': '1264',
|
|
2204
2226
|
},
|
|
2205
2227
|
})
|
|
@@ -2340,8 +2362,7 @@ class Parcel extends utils.Adapter {
|
|
|
2340
2362
|
'Sec-Fetch-Site': 'none',
|
|
2341
2363
|
'Sec-Fetch-User': '?1',
|
|
2342
2364
|
'Upgrade-Insecure-Requests': '1',
|
|
2343
|
-
'User-Agent':
|
|
2344
|
-
'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',
|
|
2365
|
+
'User-Agent': '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',
|
|
2345
2366
|
'device-memory': '8',
|
|
2346
2367
|
downlink: '10',
|
|
2347
2368
|
dpr: '2',
|
|
@@ -2374,12 +2395,10 @@ class Parcel extends utils.Adapter {
|
|
|
2374
2395
|
|
|
2375
2396
|
for (const order of orders) {
|
|
2376
2397
|
const descHandle = order.querySelector(
|
|
2377
|
-
'.a-fixed-right-grid-col.a-col-left .a-fixed-left-grid-col.a-col-right div:first-child .a-link-normal'
|
|
2398
|
+
'.a-fixed-right-grid-col.a-col-left .a-fixed-left-grid-col.a-col-right div:first-child .a-link-normal'
|
|
2378
2399
|
);
|
|
2379
2400
|
const desc = descHandle ? descHandle.textContent.replace(/\n */g, '') : '';
|
|
2380
|
-
let url = order.querySelector('.track-package-button a')
|
|
2381
|
-
? order.querySelector('.track-package-button a').getAttribute('href')
|
|
2382
|
-
: '';
|
|
2401
|
+
let url = order.querySelector('.track-package-button a') ? order.querySelector('.track-package-button a').getAttribute('href') : '';
|
|
2383
2402
|
if (!url) {
|
|
2384
2403
|
const allLinks = order.querySelectorAll('.a-button-inner a');
|
|
2385
2404
|
for (const link of allLinks) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "iobroker.parcel",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.7",
|
|
4
4
|
"description": "Parcel tracking",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "TA2k",
|
|
@@ -26,30 +26,18 @@
|
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"@iobroker/adapter-core": "^3.0.4",
|
|
29
|
-
"axios": "^1.6.
|
|
29
|
+
"axios": "^1.6.5",
|
|
30
30
|
"http-cookie-agent": "^5.0.4",
|
|
31
31
|
"jsdom": "^21.1.2",
|
|
32
|
-
"json2iob": "^2.
|
|
32
|
+
"json2iob": "^2.6.6",
|
|
33
33
|
"qs": "^6.11.2",
|
|
34
34
|
"tough-cookie": "^4.1.3",
|
|
35
35
|
"uuid": "^9.0.1"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"@iobroker/testing": "^4.1.0",
|
|
39
|
-
"@types/
|
|
40
|
-
"
|
|
41
|
-
"@types/mocha": "^10.0.6",
|
|
42
|
-
"@types/node": "^20.10.4",
|
|
43
|
-
"@types/proxyquire": "^1.3.31",
|
|
44
|
-
"@types/sinon": "^10.0.20",
|
|
45
|
-
"@types/sinon-chai": "^3.2.12",
|
|
46
|
-
"chai": "^4.3.10",
|
|
47
|
-
"chai-as-promised": "^7.1.1",
|
|
48
|
-
"eslint": "^8.55.0",
|
|
49
|
-
"mocha": "^10.2.0",
|
|
50
|
-
"proxyquire": "^2.1.3",
|
|
51
|
-
"sinon": "^15.2.0",
|
|
52
|
-
"sinon-chai": "^3.7.0",
|
|
39
|
+
"@types/node": "^20.11.5",
|
|
40
|
+
"eslint": "^8.56.0",
|
|
53
41
|
"typescript": "~5.3.3"
|
|
54
42
|
},
|
|
55
43
|
"main": "main.js",
|