iobroker.parcel 0.2.0 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/io-package.json +2 -2
  2. package/main.js +28 -17
  3. package/package.json +1 -1
package/io-package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "common": {
3
3
  "name": "parcel",
4
- "version": "0.2.0",
4
+ "version": "0.2.1",
5
5
  "news": {
6
- "0.2.0": {
6
+ "0.2.1": {
7
7
  "en": "Fix for Briefankündigung",
8
8
  "de": "Briefankündigung wieder aktiviert"
9
9
  },
package/main.js CHANGED
@@ -181,7 +181,8 @@ class Parcel extends utils.Adapter {
181
181
  url: 'https://login.dhl.de/af5f9bb6-27ad-4af4-9445-008e7a5cddb8/login/authorize',
182
182
  params: {
183
183
  redirect_uri: 'dhllogin://de.deutschepost.dhl/login',
184
- state: 'eyJycyI6dHJ1ZSwicnYiOmZhbHNlLCJmaWQiOiJhcHAtbG9naW4tbWVoci1mb290ZXIiLCJoaWQiOiJhcHAtbG9naW4tbWVoci1oZWFkZXIiLCJycCI6ZmFsc2V9',
184
+ state:
185
+ 'eyJycyI6dHJ1ZSwicnYiOmZhbHNlLCJmaWQiOiJhcHAtbG9naW4tbWVoci1mb290ZXIiLCJoaWQiOiJhcHAtbG9naW4tbWVoci1oZWFkZXIiLCJycCI6ZmFsc2V9',
185
186
  client_id: '83471082-5c13-4fce-8dcb-19d2a3fca413',
186
187
  response_type: 'code',
187
188
  scope: 'openid offline_access',
@@ -301,7 +302,8 @@ class Parcel extends utils.Adapter {
301
302
  redirect_uri: 'dhllogin://de.deutschepost.dhl/login',
302
303
  response_type: 'code',
303
304
  scope: 'openid',
304
- state: 'eyJycyI6dHJ1ZSwicnYiOmZhbHNlLCJmaWQiOiJhcHAtbG9naW4tbWVoci1mb290ZXIiLCJoaWQiOiJhcHAtbG9naW4tbWVoci1oZWFkZXIiLCJycCI6ZmFsc2V9',
305
+ state:
306
+ 'eyJycyI6dHJ1ZSwicnYiOmZhbHNlLCJmaWQiOiJhcHAtbG9naW4tbWVoci1mb290ZXIiLCJoaWQiOiJhcHAtbG9naW4tbWVoci1oZWFkZXIiLCJycCI6ZmFsc2V9',
305
307
  ui_locales: 'de-DE",',
306
308
  },
307
309
  headers: {
@@ -349,7 +351,8 @@ class Parcel extends utils.Adapter {
349
351
  redirect_uri: 'dhllogin://de.deutschepost.dhl/login',
350
352
  response_type: 'code',
351
353
  scope: 'openid',
352
- state: 'eyJycyI6dHJ1ZSwicnYiOmZhbHNlLCJmaWQiOiJhcHAtbG9naW4tbWVoci1mb290ZXIiLCJoaWQiOiJhcHAtbG9naW4tbWVoci1oZWFkZXIiLCJycCI6ZmFsc2V9',
354
+ state:
355
+ 'eyJycyI6dHJ1ZSwicnYiOmZhbHNlLCJmaWQiOiJhcHAtbG9naW4tbWVoci1mb290ZXIiLCJoaWQiOiJhcHAtbG9naW4tbWVoci1oZWFkZXIiLCJycCI6ZmFsc2V9',
353
356
  ui_locales: 'de-DE',
354
357
  },
355
358
  headers: {
@@ -607,7 +610,8 @@ class Parcel extends utils.Adapter {
607
610
  'sec-ch-ua-mobile': '?0',
608
611
  'sec-ch-ua-platform': '"macOS"',
609
612
  'upgrade-insecure-requests': '1',
610
- 'user-agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.20 Safari/537.36',
613
+ 'user-agent':
614
+ 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.20 Safari/537.36',
611
615
  accept:
612
616
  'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9',
613
617
  'sec-fetch-site': 'same-site',
@@ -653,7 +657,8 @@ class Parcel extends utils.Adapter {
653
657
  accept: 'application/json, text/plain, */*',
654
658
  'content-type': 'application/x-www-form-urlencoded',
655
659
  'sec-ch-ua-mobile': '?0',
656
- 'user-agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.20 Safari/537.36',
660
+ 'user-agent':
661
+ '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
662
  'sec-ch-ua-platform': '"macOS"',
658
663
  origin: 'https://login.aliexpress.com',
659
664
  'sec-fetch-site': 'same-site',
@@ -683,7 +688,9 @@ class Parcel extends utils.Adapter {
683
688
  })
684
689
  .then(async (res) => {
685
690
  // this.log.debug(JSON.stringify(res.data));
686
- res.data.indexOf('Session has expired') !== -1 ? this.log.error('Session has expired') : this.log.info('Login to Aliexpress successful');
691
+ res.data.indexOf('Session has expired') !== -1
692
+ ? this.log.error('Session has expired')
693
+ : this.log.info('Login to Aliexpress successful');
687
694
  })
688
695
  .catch(async (error) => {
689
696
  error.response && this.log.error(JSON.stringify(error.response.data));
@@ -778,7 +785,7 @@ class Parcel extends utils.Adapter {
778
785
  .catch((error) => {
779
786
  this.log.error('Amazon first login step failed');
780
787
  this.log.error(
781
- 'https://www.amazon.de/ap/signin?_encoding=UTF8&accountStatusPolicy=P1&openid.assoc_handle=deflex&openid.claimed_id=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0%2Fidentifier_select&openid.identity=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0%2Fidentifier_select&openid.mode=checkid_setup&openid.ns=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0&openid.ns.pape=http%3A%2F%2Fspecs.openid.net%2Fextensions%2Fpape%2F1.0&openid.pape.max_auth_age=0&openid.return_to=https%3A%2F%2Fwww.amazon.de%2Fgp%2Fcss%2Forder-history%3Fie%3DUTF8%26ref_%3Dnav_orders_first&pageId=webcs-yourorder&showRmrMe=1'
788
+ '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',
782
789
  );
783
790
  this.log.error(error);
784
791
  if (error.response) {
@@ -814,7 +821,7 @@ class Parcel extends utils.Adapter {
814
821
  this.log.error(JSON.stringify(error.response.data));
815
822
  }
816
823
  this.log.info(
817
- 'Delete amazon cookie please restart the adapter to trigger relogin. If this is not working please manualy delete parcel.0.auth.cookie'
824
+ 'Delete amazon cookie please restart the adapter to trigger relogin. If this is not working please manualy delete parcel.0.auth.cookie',
818
825
  );
819
826
  delete this.cookieJar.store.idx['amazon.de'];
820
827
  });
@@ -902,11 +909,11 @@ class Parcel extends utils.Adapter {
902
909
  this.log.error('Login to Amazon failed, please login to Amazon manually and check the login');
903
910
  if (res.data.indexOf('captcha-placeholder') !== -1) {
904
911
  this.log.warn(
905
- '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.'
912
+ '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.',
906
913
  );
907
914
  }
908
915
  this.log.info(
909
- 'Amazon cookie are removed. Please restart the adapter to trigger a relogin. If this is not working please manually delete parcel.0.auth.cookie'
916
+ 'Amazon cookie are removed. Please restart the adapter to trigger a relogin. If this is not working please manually delete parcel.0.auth.cookie',
910
917
  );
911
918
  delete this.cookieJar.store.idx['amazon.de'];
912
919
  this.log.info('Start relogin');
@@ -947,7 +954,8 @@ class Parcel extends utils.Adapter {
947
954
  url: 'https://www.dpd.com/de/de/mydpd-anmelden-und-registrieren/',
948
955
  headers: {
949
956
  'content-type': 'application/x-www-form-urlencoded',
950
- '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',
957
+ 'user-agent':
958
+ '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',
951
959
  accept:
952
960
  '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',
953
961
  'accept-language': 'de,en;q=0.9',
@@ -1686,7 +1694,7 @@ class Parcel extends utils.Adapter {
1686
1694
  }
1687
1695
  async cleanupProvider(id, data) {
1688
1696
  if (id === 'dhl' && data.hasOwnProperty('grantToken')) {
1689
- // await this.delObjectAsync("dhl.briefe", { recursive: true });
1697
+ await this.delObjectAsync('dhl.briefe', { recursive: true });
1690
1698
  // await this.setObjectNotExistsAsync("dhl.briefe.json", {
1691
1699
  // type: "state",
1692
1700
  // common: {
@@ -2267,7 +2275,8 @@ class Parcel extends utils.Adapter {
2267
2275
  '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',
2268
2276
  'accept-language': 'de-de',
2269
2277
  'cache-control': 'max-age=0',
2270
- 'user-agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36',
2278
+ 'user-agent':
2279
+ 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36',
2271
2280
  'viewport-width': '1272',
2272
2281
  },
2273
2282
  })
@@ -2286,10 +2295,12 @@ class Parcel extends utils.Adapter {
2286
2295
 
2287
2296
  for (const order of orders) {
2288
2297
  const descHandle = order.querySelector(
2289
- '.a-fixed-right-grid-col.a-col-left .a-fixed-left-grid-col.a-col-right div:first-child .a-link-normal'
2298
+ '.a-fixed-right-grid-col.a-col-left .a-fixed-left-grid-col.a-col-right div:first-child .a-link-normal',
2290
2299
  );
2291
2300
  const desc = descHandle ? descHandle.textContent.replace(/\n */g, '') : '';
2292
- let url = order.querySelector('.track-package-button a') ? order.querySelector('.track-package-button a').getAttribute('href') : '';
2301
+ let url = order.querySelector('.track-package-button a')
2302
+ ? order.querySelector('.track-package-button a').getAttribute('href')
2303
+ : '';
2293
2304
  if (!url) {
2294
2305
  const allLinks = order.querySelectorAll('.a-button-inner a');
2295
2306
  for (const link of allLinks) {
@@ -2622,10 +2633,10 @@ class Parcel extends utils.Adapter {
2622
2633
  const pathArray = id.split('.');
2623
2634
  pathArray.pop();
2624
2635
  pathArray.push('image');
2625
- await this.setObjectNotExistsAsync(pathArray.join('.'), {
2636
+ await this.extendObjectAsync(pathArray.join('.'), {
2626
2637
  type: 'state',
2627
2638
  common: {
2628
- name: 'Image',
2639
+ name: 'Image Base64 Decrypted from URL',
2629
2640
  write: false,
2630
2641
  read: true,
2631
2642
  type: 'string',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "iobroker.parcel",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "Parcel tracking",
5
5
  "author": {
6
6
  "name": "TA2k",