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.cjs CHANGED
@@ -5974,7 +5974,7 @@ function parseRSSXml(xmlText, maxItems) {
5974
5974
  }
5975
5975
  function fetchRSSItems(rssUrl, maxItems) {
5976
5976
  return _async_to_generator(function() {
5977
- var encoded, resp2, data, unused, resp21, text2, unused1, resp, text;
5977
+ var encoded, origin, resp, text, unused, resp1, data, unused1, resp2, text1, unused2;
5978
5978
  return _ts_generator(this, function(_state) {
5979
5979
  switch(_state.label){
5980
5980
  case 0:
@@ -5987,25 +5987,26 @@ function fetchRSSItems(rssUrl, maxItems) {
5987
5987
  ,
5988
5988
  6
5989
5989
  ]);
5990
+ origin = typeof window !== "undefined" ? window.location.origin : "";
5990
5991
  return [
5991
5992
  4,
5992
- fetch("https://api.allorigins.win/get?url=".concat(encoded))
5993
+ fetch("".concat(origin, "/api/rss-proxy?url=").concat(encoded))
5993
5994
  ];
5994
5995
  case 2:
5995
- resp2 = _state.sent();
5996
- if (!resp2.ok) return [
5996
+ resp = _state.sent();
5997
+ if (!resp.ok) return [
5997
5998
  3,
5998
5999
  4
5999
6000
  ];
6000
6001
  return [
6001
6002
  4,
6002
- resp2.json()
6003
+ resp.text()
6003
6004
  ];
6004
6005
  case 3:
6005
- data = _state.sent();
6006
- if (data.contents) return [
6006
+ text = _state.sent();
6007
+ if (text.includes("<item")) return [
6007
6008
  2,
6008
- parseRSSXml(data.contents, maxItems)
6009
+ parseRSSXml(text, maxItems)
6009
6010
  ];
6010
6011
  _state.label = 4;
6011
6012
  case 4:
@@ -6028,23 +6029,23 @@ function fetchRSSItems(rssUrl, maxItems) {
6028
6029
  ]);
6029
6030
  return [
6030
6031
  4,
6031
- fetch("https://corsproxy.io/?url=".concat(encoded))
6032
+ fetch("https://api.allorigins.win/get?url=".concat(encoded))
6032
6033
  ];
6033
6034
  case 7:
6034
- resp21 = _state.sent();
6035
- if (!resp21.ok) return [
6035
+ resp1 = _state.sent();
6036
+ if (!resp1.ok) return [
6036
6037
  3,
6037
6038
  9
6038
6039
  ];
6039
6040
  return [
6040
6041
  4,
6041
- resp21.text()
6042
+ resp1.json()
6042
6043
  ];
6043
6044
  case 8:
6044
- text2 = _state.sent();
6045
- if (text2) return [
6045
+ data = _state.sent();
6046
+ if (data.contents) return [
6046
6047
  2,
6047
- parseRSSXml(text2, maxItems)
6048
+ parseRSSXml(data.contents, maxItems)
6048
6049
  ];
6049
6050
  _state.label = 9;
6050
6051
  case 9:
@@ -6059,23 +6060,46 @@ function fetchRSSItems(rssUrl, maxItems) {
6059
6060
  11
6060
6061
  ];
6061
6062
  case 11:
6063
+ _state.trys.push([
6064
+ 11,
6065
+ 15,
6066
+ ,
6067
+ 16
6068
+ ]);
6062
6069
  return [
6063
6070
  4,
6064
- fetch("https://thingproxy.freeboard.io/fetch/".concat(rssUrl))
6071
+ fetch("https://corsproxy.io/?url=".concat(encoded))
6065
6072
  ];
6066
6073
  case 12:
6067
- resp = _state.sent();
6068
- if (!resp.ok) throw new Error("RSS fetch failed: ".concat(resp.status));
6074
+ resp2 = _state.sent();
6075
+ if (!resp2.ok) return [
6076
+ 3,
6077
+ 14
6078
+ ];
6069
6079
  return [
6070
6080
  4,
6071
- resp.text()
6081
+ resp2.text()
6072
6082
  ];
6073
6083
  case 13:
6074
- text = _state.sent();
6075
- return [
6084
+ text1 = _state.sent();
6085
+ if (text1) return [
6076
6086
  2,
6077
- parseRSSXml(text, maxItems)
6087
+ parseRSSXml(text1, maxItems)
6088
+ ];
6089
+ _state.label = 14;
6090
+ case 14:
6091
+ return [
6092
+ 3,
6093
+ 16
6094
+ ];
6095
+ case 15:
6096
+ unused2 = _state.sent();
6097
+ return [
6098
+ 3,
6099
+ 16
6078
6100
  ];
6101
+ case 16:
6102
+ throw new Error("All RSS proxies failed");
6079
6103
  }
6080
6104
  });
6081
6105
  })();