stormcloud-video-player 0.7.28 → 0.7.29

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.
@@ -460,7 +460,7 @@ function parseRSSXml(xmlText, maxItems) {
460
460
  }
461
461
  function fetchRSSItems(rssUrl, maxItems) {
462
462
  return _async_to_generator(function() {
463
- var encoded, resp2, data, unused, resp21, text2, unused1, resp, text;
463
+ var encoded, origin, resp, text, unused, resp1, data, unused1, resp2, text1, unused2;
464
464
  return _ts_generator(this, function(_state) {
465
465
  switch(_state.label){
466
466
  case 0:
@@ -473,25 +473,26 @@ function fetchRSSItems(rssUrl, maxItems) {
473
473
  ,
474
474
  6
475
475
  ]);
476
+ origin = typeof window !== "undefined" ? window.location.origin : "";
476
477
  return [
477
478
  4,
478
- fetch("https://api.allorigins.win/get?url=".concat(encoded))
479
+ fetch("".concat(origin, "/api/rss-proxy?url=").concat(encoded))
479
480
  ];
480
481
  case 2:
481
- resp2 = _state.sent();
482
- if (!resp2.ok) return [
482
+ resp = _state.sent();
483
+ if (!resp.ok) return [
483
484
  3,
484
485
  4
485
486
  ];
486
487
  return [
487
488
  4,
488
- resp2.json()
489
+ resp.text()
489
490
  ];
490
491
  case 3:
491
- data = _state.sent();
492
- if (data.contents) return [
492
+ text = _state.sent();
493
+ if (text.includes("<item")) return [
493
494
  2,
494
- parseRSSXml(data.contents, maxItems)
495
+ parseRSSXml(text, maxItems)
495
496
  ];
496
497
  _state.label = 4;
497
498
  case 4:
@@ -514,23 +515,23 @@ function fetchRSSItems(rssUrl, maxItems) {
514
515
  ]);
515
516
  return [
516
517
  4,
517
- fetch("https://corsproxy.io/?url=".concat(encoded))
518
+ fetch("https://api.allorigins.win/get?url=".concat(encoded))
518
519
  ];
519
520
  case 7:
520
- resp21 = _state.sent();
521
- if (!resp21.ok) return [
521
+ resp1 = _state.sent();
522
+ if (!resp1.ok) return [
522
523
  3,
523
524
  9
524
525
  ];
525
526
  return [
526
527
  4,
527
- resp21.text()
528
+ resp1.json()
528
529
  ];
529
530
  case 8:
530
- text2 = _state.sent();
531
- if (text2) return [
531
+ data = _state.sent();
532
+ if (data.contents) return [
532
533
  2,
533
- parseRSSXml(text2, maxItems)
534
+ parseRSSXml(data.contents, maxItems)
534
535
  ];
535
536
  _state.label = 9;
536
537
  case 9:
@@ -545,23 +546,46 @@ function fetchRSSItems(rssUrl, maxItems) {
545
546
  11
546
547
  ];
547
548
  case 11:
549
+ _state.trys.push([
550
+ 11,
551
+ 15,
552
+ ,
553
+ 16
554
+ ]);
548
555
  return [
549
556
  4,
550
- fetch("https://thingproxy.freeboard.io/fetch/".concat(rssUrl))
557
+ fetch("https://corsproxy.io/?url=".concat(encoded))
551
558
  ];
552
559
  case 12:
553
- resp = _state.sent();
554
- if (!resp.ok) throw new Error("RSS fetch failed: ".concat(resp.status));
560
+ resp2 = _state.sent();
561
+ if (!resp2.ok) return [
562
+ 3,
563
+ 14
564
+ ];
555
565
  return [
556
566
  4,
557
- resp.text()
567
+ resp2.text()
558
568
  ];
559
569
  case 13:
560
- text = _state.sent();
561
- return [
570
+ text1 = _state.sent();
571
+ if (text1) return [
562
572
  2,
563
- parseRSSXml(text, maxItems)
573
+ parseRSSXml(text1, maxItems)
574
+ ];
575
+ _state.label = 14;
576
+ case 14:
577
+ return [
578
+ 3,
579
+ 16
580
+ ];
581
+ case 15:
582
+ unused2 = _state.sent();
583
+ return [
584
+ 3,
585
+ 16
564
586
  ];
587
+ case 16:
588
+ throw new Error("All RSS proxies failed");
565
589
  }
566
590
  });
567
591
  })();