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.
package/lib/index.js CHANGED
@@ -5808,7 +5808,7 @@ function parseRSSXml(xmlText, maxItems) {
5808
5808
  }
5809
5809
  function fetchRSSItems(rssUrl, maxItems) {
5810
5810
  return _async_to_generator(function() {
5811
- var encoded, resp2, data, unused, resp21, text2, unused1, resp, text;
5811
+ var encoded, origin, resp, text, unused, resp1, data, unused1, resp2, text1, unused2;
5812
5812
  return _ts_generator(this, function(_state) {
5813
5813
  switch(_state.label){
5814
5814
  case 0:
@@ -5821,25 +5821,26 @@ function fetchRSSItems(rssUrl, maxItems) {
5821
5821
  ,
5822
5822
  6
5823
5823
  ]);
5824
+ origin = typeof window !== "undefined" ? window.location.origin : "";
5824
5825
  return [
5825
5826
  4,
5826
- fetch("https://api.allorigins.win/get?url=".concat(encoded))
5827
+ fetch("".concat(origin, "/api/rss-proxy?url=").concat(encoded))
5827
5828
  ];
5828
5829
  case 2:
5829
- resp2 = _state.sent();
5830
- if (!resp2.ok) return [
5830
+ resp = _state.sent();
5831
+ if (!resp.ok) return [
5831
5832
  3,
5832
5833
  4
5833
5834
  ];
5834
5835
  return [
5835
5836
  4,
5836
- resp2.json()
5837
+ resp.text()
5837
5838
  ];
5838
5839
  case 3:
5839
- data = _state.sent();
5840
- if (data.contents) return [
5840
+ text = _state.sent();
5841
+ if (text.includes("<item")) return [
5841
5842
  2,
5842
- parseRSSXml(data.contents, maxItems)
5843
+ parseRSSXml(text, maxItems)
5843
5844
  ];
5844
5845
  _state.label = 4;
5845
5846
  case 4:
@@ -5862,23 +5863,23 @@ function fetchRSSItems(rssUrl, maxItems) {
5862
5863
  ]);
5863
5864
  return [
5864
5865
  4,
5865
- fetch("https://corsproxy.io/?url=".concat(encoded))
5866
+ fetch("https://api.allorigins.win/get?url=".concat(encoded))
5866
5867
  ];
5867
5868
  case 7:
5868
- resp21 = _state.sent();
5869
- if (!resp21.ok) return [
5869
+ resp1 = _state.sent();
5870
+ if (!resp1.ok) return [
5870
5871
  3,
5871
5872
  9
5872
5873
  ];
5873
5874
  return [
5874
5875
  4,
5875
- resp21.text()
5876
+ resp1.json()
5876
5877
  ];
5877
5878
  case 8:
5878
- text2 = _state.sent();
5879
- if (text2) return [
5879
+ data = _state.sent();
5880
+ if (data.contents) return [
5880
5881
  2,
5881
- parseRSSXml(text2, maxItems)
5882
+ parseRSSXml(data.contents, maxItems)
5882
5883
  ];
5883
5884
  _state.label = 9;
5884
5885
  case 9:
@@ -5893,23 +5894,46 @@ function fetchRSSItems(rssUrl, maxItems) {
5893
5894
  11
5894
5895
  ];
5895
5896
  case 11:
5897
+ _state.trys.push([
5898
+ 11,
5899
+ 15,
5900
+ ,
5901
+ 16
5902
+ ]);
5896
5903
  return [
5897
5904
  4,
5898
- fetch("https://thingproxy.freeboard.io/fetch/".concat(rssUrl))
5905
+ fetch("https://corsproxy.io/?url=".concat(encoded))
5899
5906
  ];
5900
5907
  case 12:
5901
- resp = _state.sent();
5902
- if (!resp.ok) throw new Error("RSS fetch failed: ".concat(resp.status));
5908
+ resp2 = _state.sent();
5909
+ if (!resp2.ok) return [
5910
+ 3,
5911
+ 14
5912
+ ];
5903
5913
  return [
5904
5914
  4,
5905
- resp.text()
5915
+ resp2.text()
5906
5916
  ];
5907
5917
  case 13:
5908
- text = _state.sent();
5909
- return [
5918
+ text1 = _state.sent();
5919
+ if (text1) return [
5910
5920
  2,
5911
- parseRSSXml(text, maxItems)
5921
+ parseRSSXml(text1, maxItems)
5922
+ ];
5923
+ _state.label = 14;
5924
+ case 14:
5925
+ return [
5926
+ 3,
5927
+ 16
5928
+ ];
5929
+ case 15:
5930
+ unused2 = _state.sent();
5931
+ return [
5932
+ 3,
5933
+ 16
5912
5934
  ];
5935
+ case 16:
5936
+ throw new Error("All RSS proxies failed");
5913
5937
  }
5914
5938
  });
5915
5939
  })();